Skip to content

Rust: Add variables example with let statement in macro#18330

Merged
paldepind merged 1 commit into
github:mainfrom
paldepind:rust-variables-macro
Dec 19, 2024
Merged

Rust: Add variables example with let statement in macro#18330
paldepind merged 1 commit into
github:mainfrom
paldepind:rust-variables-macro

Conversation

@paldepind
Copy link
Copy Markdown
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 AI review requested due to automatic review settings December 19, 2024 12:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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
Copy Markdown
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
@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.

3 participants