-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Add a couple of simple data flow test cases #20439
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds simple test cases for data flow analysis in Rust, specifically testing assignment patterns including self-assignment scenarios. The changes add test code to verify that data flow tracking correctly handles variable assignments, including cases where self-assignment should preserve data flow but appears to have issues.
- Adds test cases for variable assignment and data flow tracking
- Tests self-assignment scenario that appears to have missing data flow detection
- Updates expected test results to reflect current data flow analysis behavior
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
rust/ql/test/library-tests/dataflow/local/main.rs | Adds assignment test cases including self-assignment that should preserve data flow |
rust/ql/test/library-tests/dataflow/local/inline-flow.expected | Updates expected test results with new data flow edges and missing flow annotations |
|
||
let mut l = source(8); | ||
l = l; | ||
sink(l); // $ MISSING: hasValueFlow=8 |
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.
Should be fixed by #20443.
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.
Yep that fixes the issue, if we merge that first I can merge it in and update the .expected
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.
Thanks for addressing this!
Merged with |
Add a couple of simple data flow test cases. We don't seem to be getting self-assignment right.
@hvitved any idea what's wrong here?