Rust: Allow for crate self-references in crate graph paths #19265
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.
The extractor produces fully crate-qualified paths for entities extracted from the crate graph, which our path resolution logic handles. However, for entities where the crate-qualifier refers to the defining crate itself, the extractor should have used the special
crate
qualifier instead of the name of the crate.For example, the
impl<T> Option<T>
block is extracted asimpl<T> core::option::Option<T>
instead ofimpl<T> crate::option::Option<T>
.This PR adjusts our path resolution logic to also handle crate self-references like above, but restricted to entities from the crate graph.
DCA shows that, while we maintain performance, we reduce the number of unresolved call targets by 16 % (down 1,699,468 from 2,012,848), all numbers computed across the entire DCA suite.
cc @aibaars