-
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
base: main
Are you sure you want to change the base?
Rust: Generalize some models #20652
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 generalizes existing Rust models by replacing specific type implementations with trait models, improving data flow detection. The generalization transforms models like <specific_type as trait>::method
to <_ as trait>::method
, allowing the models to apply to all types implementing the trait rather than just specific implementations.
Key changes:
- Generalized trait models in stdlib framework definitions
- Updated test expectations to reflect improved data flow detection
- Added change note documenting the improvement
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
rust/ql/test/library-tests/dataflow/strings/main.rs | Updated comment to reflect newly detected taint flow |
rust/ql/test/library-tests/dataflow/strings/inline-taint-flow.expected | Updated test expectations with new generalized models and additional flow detection |
rust/ql/test/library-tests/dataflow/sources/InlineFlow.expected | Updated test expectations reflecting model generalizations and renumbering |
rust/ql/test/library-tests/dataflow/local/main.rs | Updated comments to reflect newly detected taint flows |
rust/ql/lib/codeql/rust/frameworks/stdlib/lang-core.model.yml | Generalized iterator and conversion trait models |
rust/ql/lib/codeql/rust/frameworks/stdlib/lang-alloc.model.yml | Generalized string, arithmetic, and allocator trait models |
rust/ql/lib/codeql/rust/frameworks/stdlib/io.model.yml | Generalized IO trait models |
rust/ql/lib/change-notes/2025-10-15-models.md | Added change note documenting the improvement |
DCA LGTM. |
Generalize some existing models to trait models.
<a as b>::c
with<_ as b>::c
, unless there's a good reason why that model only applies toa
.