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 variables example with let statement in macro #18330

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

paldepind
Copy link
Contributor

@paldepind paldepind commented Dec 19, 2024

Adds a variables test with a let statement inside a macro.

The usage of var_in_macro doesn't lead to an instance of VariableAccess. This is because the Variable and VariableAccess instance for var_in_macro doesn't get matched up inside variableReachesCand. I'm guessing this is because the rank calculation uses locations, and the nodes in the expansion of the macro all have the same location.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 19, 2024
@paldepind paldepind marked this pull request as ready for review December 19, 2024 12:36
@Copilot Copilot bot review requested due to automatic review settings December 19, 2024 12:36

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.

Files not reviewed (3)
  • rust/ql/test/library-tests/variables/Cfg.expected: Language not supported
  • rust/ql/test/library-tests/variables/Ssa.expected: Language not supported
  • rust/ql/test/library-tests/variables/variables.expected: Language not supported
Comments suppressed due to low confidence (1)

rust/ql/test/library-tests/variables/variables.rs:555

  • The variable var_in_macro is not being correctly identified for read access within the macro. Ensure that the test framework can handle variable accesses within macro expansions.
let_in_macro!(37); // $ MISSING: read_access=var_in_macro

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@hvitved
Copy link
Contributor

hvitved commented Dec 19, 2024

I'm guessing this is because the rank calculation uses locations, and the nodes in the expansion of the macro all have the same location.

Sounds reasonable.

@paldepind paldepind merged commit 5141f7b into github:main Dec 19, 2024
12 checks passed
@paldepind paldepind deleted the rust-variables-macro branch December 19, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants