Rust: Add a couple of simple data flow test cases#20439
Merged
geoffw0 merged 6 commits intogithub:mainfrom Sep 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 |
hvitved
reviewed
Sep 16, 2025
|
|
||
| let mut l = source(8); | ||
| l = l; | ||
| sink(l); // $ MISSING: hasValueFlow=8 |
Contributor
Author
There was a problem hiding this comment.
Yep that fixes the issue, if we merge that first I can merge it in and update the .expected here.
Contributor
Author
There was a problem hiding this comment.
Thanks for addressing this!
Contributor
Author
|
Merged with |
paldepind
approved these changes
Sep 19, 2025
hvitved
approved these changes
Sep 19, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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?