Skip to content

Bound transitive unused dependency traversal#17165

Draft
enricoschaaf wants to merge 1 commit into
rust-lang:masterfrom
enricoschaaf:master
Draft

Bound transitive unused dependency traversal#17165
enricoschaaf wants to merge 1 commit into
rust-lang:masterfrom
enricoschaaf:master

Conversation

@enricoschaaf

@enricoschaaf enricoschaaf commented Jul 1, 2026

Copy link
Copy Markdown

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_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.

@epage

epage commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

We're not really setup for memory performance testing

@enricoschaaf

Copy link
Copy Markdown
Author

ok, what does that mean for this PR? just that I should not attempt to create any kind of (regression) test for this?

@epage

epage commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Yeah, we aren't really setup for that at this time.

@rustbot

rustbot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17230) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Z cargo-lints can make Cargo retain >100 GiB on large workspace

3 participants