Skip to content

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Sep 15, 2025

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?

@geoffw0 geoffw0 requested a review from a team as a code owner September 15, 2025 16:39
@geoffw0 geoffw0 added no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code labels Sep 15, 2025
@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 16:39
Copy link
Contributor

@Copilot 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.

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for addressing this!

@geoffw0
Copy link
Contributor Author

geoffw0 commented Sep 17, 2025

Merged with main including the fix, the test has expected results now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants