-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Generalize some models #20652
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
Merged
Merged
Rust: Generalize some models #20652
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ea6c7cf
Rust: Generalize stdlib 'a as b' models.
geoffw0 483ab59
Rust: Combine and expand some of the models.
geoffw0 612e95b
Rust: More deduplication.
geoffw0 5105976
Rust: Change note.
geoffw0 217508e
Merge branch 'main' into gen1
geoffw0 c30e9a9
Rust: Accept changes to other test expectations.
geoffw0 c56de30
Rust: Fix merge conflict in .expected file.
geoffw0 ee86655
Rust: Update another affected test.
geoffw0 b933f8d
Merge branch 'main' into gen1
geoffw0 d4a599c
Rust: Accept more minor test expectation changes.
geoffw0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Generalized some existing models to improve data flow. |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -508,9 +508,9 @@ fn parse() { | |
| let d: i64 = b.parse().unwrap(); | ||
|
|
||
| sink(a); // $ hasValueFlow=90 | ||
| sink_string(b); // $ MISSING: we are not currently able to resolve the `to_string` call above, which comes from `impl<T: fmt::Display + ?Sized> ToString for T` | ||
| sink(c); // $ MISSING: hasTaintFlow=90 - we are not currently able to resolve the `parse` call above | ||
| sink(d); // $ MISSING: hasTaintFlow=90 - we are not currently able to resolve the `parse` call above | ||
| sink_string(b); // $ hasTaintFlow=90 | ||
| sink(c); // $ hasTaintFlow=90 | ||
| sink(d); // $ hasTaintFlow=90 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! 🎉 |
||
| } | ||
|
|
||
| fn iterators() { | ||
|
|
||
Oops, something went wrong.
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.
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.
Is this model needed?
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.
Yes - its needed for this line in the
dataflow/stringstest:i.e. its a workaround for dealing with the implicit dereference on the RHS when the
+is appending strings.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.
I wonder if we should have made the model more explicit then, i.e.
alloc::string::String as core::ops::arith::Add, since the implementation of+uses a&stras the RHS type instead of the defaultSelf: https://doc.rust-lang.org/std/string/struct.String.html#impl-Add%3C%26str%3E-for-String.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.
I'd rather keep it general I think - I don't think there's anything stopping people implementing it that way for other types and if they do, we'll cover that.