-
Notifications
You must be signed in to change notification settings - Fork 2k
Rust: Path resolution improvements #19051
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
Merged
hvitved
merged 12 commits into
github:main
from
hvitved:rust/path-resolution-cross-crate
Mar 24, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
92528f2
Rust: Add debug predicate
hvitved 6cf83d3
Rust: Add path resolution test for reexported items
hvitved c5106f7
Rust: Handle `pub use` reexports in path resolution
hvitved bd4c85a
Rust: Add cross-crate path resolution test
hvitved c911761
Rust: Cross-crate path resolution
hvitved 8f8f6f7
Rust: Add `use`+`self` path resolution test
hvitved 7c2bafe
Rust: Handle `self` in `use` statements
hvitved 8044b0d
Rust: Exclude macro call paths from `resolvePath`
hvitved 57dfbf4
Rust: Add path resolution test for `super` in `use` statement
hvitved b2fc7e7
Rust: Handle `super` in `use` statements
hvitved 3142dbb
Rust: Rework visibility handling in path resolution
hvitved 3f1f37f
Address review comments
hvitved File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| use lib::a_module::hello; | ||
| use lib::a_module::hello; // $ item=HELLO | ||
|
|
||
| mod a_module; | ||
|
|
||
| fn main() { | ||
| hello(); | ||
| hello(); // $ item=HELLO | ||
| } |
2 changes: 1 addition & 1 deletion
2
rust/ql/integration-tests/hello-workspace/lib/src/a_module/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| pub fn hello() { | ||
| println!("Hello, world!"); | ||
| } | ||
| } // HELLO |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import utils.test.PathResolutionInlineExpectationsTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
rust/ql/integration-tests/hello-workspace/summary.cargo.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
rust/ql/integration-tests/hello-workspace/summary.rust-project.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's a strong convention, but I've noticed that on our AST classes the
getAFoouse a phrasing that starts with "Gets any of the foos ...".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't like the
Gets any ...style, and it also seems to conflict with https://github.com/github/codeql/blob/main/docs/qldoc-style-guide.md#predicates-with-result.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this part of the rule:
That seems to conflict with how "if any" is used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the
"if any"bit can be removed.