Bound transitive unused dependency traversal#17165
Closed
enricoschaaf wants to merge 0 commit into
Closed
Conversation
Contributor
|
We're not really setup for memory performance testing |
Contributor
Author
|
ok, what does that mean for this PR? just that I should not attempt to create any kind of (regression) test for this? |
Contributor
|
Yeah, we aren't really setup for that at this time. |
Collaborator
|
☔ The latest upstream changes (possibly #17230) made this pull request unmergeable. Please resolve the merge conflicts. |
pull Bot
pushed a commit
to pepe57/cargo
that referenced
this pull request
Jul 21, 2026
) Note: this is a rebase of rust-lang#17165 ### What does this PR try to resolve? Fixes rust-lang#17154 Closes rust-lang#17165 The `cargo::unused_dependencies` transitive dependency check queued every path through the unit graph. For shared dependency graphs, the same unit could be enqueued many times, causing the traversal to grow with the number of paths instead of the number of units. This bounds the traversal by tracking visited units while keeping the existing breadth-first search behavior. ### How to test and review this PR? The implementation change is limited to `is_transitive_dep` in `src/cargo/diagnostics/rules/unused_dependencies.rs`. Reviewers should check that the traversal still skips the direct dependency as before, while only enqueueing each reachable unit once.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thanks for the pull request 🎉!
Please read the contribution guide: https://doc.crates.io/contrib/.
What does this PR try to resolve?
Fixes #17154.
The
cargo::unused_dependenciestransitive dependency check queued every path through the unit graph. For shared dependency graphs, the same unit could be enqueued many times, causing the traversal to grow with the number of paths instead of the number of units.This bounds the traversal by tracking visited units while keeping the existing breadth-first search behavior.
How to test and review this PR?
The implementation change is limited to
is_transitive_depinsrc/cargo/diagnostics/rules/unused_dependencies.rs. Reviewers should check that the traversal still skips the direct dependency as before, while only enqueueing each reachable unit once.