Rust: Remove source/library deduplication in path resolution#20192
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes legacy deduplication logic for source and library code in Rust path resolution. Previously, when both source and library versions of functions existed, the code preferred source versions, but this is no longer needed since library code is no longer extracted as source code.
- Removes
getASuccessorFullmethod and related deduplication logic - Renames
getASuccessorFulltogetASuccessorthroughout the codebase - Updates all references to use the simplified successor method
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/ql/lib/codeql/rust/internal/PathResolution.qll | Removes deduplication logic and renames method calls from getASuccessorFull to getASuccessor |
| rust/ql/lib/codeql/rust/internal/CachedStages.qll | Updates method reference in cached stages from getASuccessorFull to getASuccessor |
geoffw0
left a comment
There was a problem hiding this comment.
I gather:
- we used to extract library code less completely than code in the source.
- the successors relation of interest here is on the item graph, it finds things that extend a path by a particular name.
- we used to prefer taking the source successor, presumably because that would be more complete? than a successor defined in a library?
- that's no longer necessary / useful because both versions would contain equally valid information now???
The last two bullets are guesswork. Please help fill the gaps in my understanding.
Prior to #19506, library code was extracted in a way where a crate could be extracted both as source code and as library code, and we would have to do deduplication in QL. After that PR, everything gets extracted as source code, and the extractor does the deduplication. |
geoffw0
left a comment
There was a problem hiding this comment.
LGTM. DCA run is clean. 👍
Removes logic that was left over from when library code was not extracted as source code.