Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: add some toString implementations #18035

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions rust/ql/.generated.list

Large diffs are not rendered by default.

44 changes: 0 additions & 44 deletions rust/ql/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/ql/integration-tests/hello-project/functions.expected
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| src/main.rs:4:1:6:1 | main |
| src/main.rs:4:1:6:1 | fn main |
4 changes: 2 additions & 2 deletions rust/ql/integration-tests/hello-workspace/functions.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| exe/src/main.rs:5:1:7:1 | main |
| lib/src/a_module/mod.rs:1:1:3:1 | hello |
| exe/src/main.rs:5:1:7:1 | fn main |
| lib/src/a_module/mod.rs:1:1:3:1 | fn hello |
6 changes: 3 additions & 3 deletions rust/ql/integration-tests/options/cfg/functions.expected
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
| src/lib.rs:7:1:8:19 | cfg_no_flag |
| src/lib.rs:10:1:11:18 | cfg_no_key |
| src/lib.rs:16:1:17:24 | pointer_width_64 |
| src/lib.rs:7:1:8:19 | fn cfg_no_flag |
| src/lib.rs:10:1:11:18 | fn cfg_no_key |
| src/lib.rs:16:1:17:24 | fn pointer_width_64 |
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| src/lib.rs:1:1:2:16 | cfg_flag |
| src/lib.rs:4:1:5:15 | cfg_key |
| src/lib.rs:13:1:14:12 | test |
| src/lib.rs:19:1:20:24 | pointer_width_32 |
| src/lib.rs:1:1:2:16 | fn cfg_flag |
| src/lib.rs:4:1:5:15 | fn cfg_key |
| src/lib.rs:13:1:14:12 | fn test |
| src/lib.rs:19:1:20:24 | fn pointer_width_32 |
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
| src/lib.rs:1:1:2:11 | foo |
| src/lib.rs:4:1:5:11 | bar |
| src/lib.rs:7:1:7:14 | always |
| src/lib.rs:1:1:2:11 | fn foo |
| src/lib.rs:4:1:5:11 | fn bar |
| src/lib.rs:7:1:7:14 | fn always |
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| src/lib.rs:4:1:5:11 | bar |
| src/lib.rs:7:1:7:14 | always |
| src/lib.rs:4:1:5:11 | fn bar |
| src/lib.rs:7:1:7:14 | fn always |
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| src/lib.rs:7:1:7:14 | always |
| src/lib.rs:7:1:7:14 | fn always |
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| src/lib.rs:1:1:2:11 | foo |
| src/lib.rs:7:1:7:14 | always |
| src/lib.rs:1:1:2:11 | fn foo |
| src/lib.rs:7:1:7:14 | fn always |
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| src/lib.rs:7:1:8:13 | macos |
| src/lib.rs:7:1:8:13 | fn macos |
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| src/lib.rs:1:1:2:13 | linux |
| src/lib.rs:1:1:2:13 | fn linux |
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| src/lib.rs:4:1:5:15 | windows |
| src/lib.rs:4:1:5:15 | fn windows |

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
| test.rs:4:1:7:1 | fn foo |
1 change: 0 additions & 1 deletion rust/ql/integration-tests/qltest/lib/functions.expected

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
| test.rs:1:1:1:11 | fn foo |
2 changes: 0 additions & 2 deletions rust/ql/integration-tests/qltest/main/functions.expected

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
| main.rs:1:1:1:12 | fn main |
| test.rs:1:1:1:11 | fn foo |
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ def default_options(codeql):
threads = 1,
show_extractor_output = True,
check_databases = False,
learn = True,
)

@pytest.mark.parametrize("dir", ["lib", "main", "dependencies"])
def test(codeql, rust, dir):
def test(codeql, rust, expected_files, dir):
expected_files.add(f"{dir}/functions.expected", expected=".nested.expected")
codeql.test.run(dir)

def test_failing_cargo_check(codeql, rust):
Expand Down
6 changes: 4 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/ArrayExprImpl.qll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `ArrayExpr`.
*
Expand All @@ -12,12 +11,15 @@ private import codeql.rust.elements.internal.generated.ArrayExpr
* be referenced directly.
*/
module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* An array expression. For example:
* ```rust
* [1, 2, 3];
* [1; 10];
* ```
*/
class ArrayExpr extends Generated::ArrayExpr { }
class ArrayExpr extends Generated::ArrayExpr {
override string toString() { result = "[...]" }
}
}
6 changes: 4 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/AwaitExprImpl.qll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `AwaitExpr`.
*
Expand All @@ -12,6 +11,7 @@ private import codeql.rust.elements.internal.generated.AwaitExpr
* be referenced directly.
*/
module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* An `await` expression. For example:
* ```rust
Expand All @@ -21,5 +21,7 @@ module Impl {
* }
* ```
*/
class AwaitExpr extends Generated::AwaitExpr { }
class AwaitExpr extends Generated::AwaitExpr {
override string toString() { result = "await ..." }
}
}
6 changes: 4 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/BecomeExprImpl.qll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `BecomeExpr`.
*
Expand All @@ -12,6 +11,7 @@ private import codeql.rust.elements.internal.generated.BecomeExpr
* be referenced directly.
*/
module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* A `become` expression. For example:
* ```rust
Expand All @@ -24,5 +24,7 @@ module Impl {
* }
* ```
*/
class BecomeExpr extends Generated::BecomeExpr { }
class BecomeExpr extends Generated::BecomeExpr {
override string toString() { result = "become ..." }
}
}
6 changes: 4 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/BlockExprImpl.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading