Skip to content

fix(install): filter out binaries not included by selected features - #17544

Draft
bcully wants to merge 2 commits into
rust-lang:masterfrom
bcully:push-rqlrwyyvpyzu
Draft

bcully wants to merge 2 commits into
rust-lang:masterfrom
bcully:push-rqlrwyyvpyzu

Conversation

@bcully

@bcully bcully commented Oct 1, 2026 •

Copy link
Copy Markdown

Fixes #8703

What does this PR try to resolve?

Cargo install was computing all possible binaries for a package regardless of the requested features, and would conclude that the installed package was out-of-date if it hadn't installed all binaries, even if the requested features wouldn't actually produce any of the "missing" binaries.

For example, I found this bug because every time I ran cargo install jj-cli it would rebuild the package. This was because jj-cli can build some optional test/example binaries, but those aren't part of the default feature.

How to test and review this PR?

I've added a new test, and also manually checked cargo install jj-cli doesn't rebuild the package on the second install.
I'll add some more test cases to cover various other feature combinations, but wanted to get a check on the approach first.

Cargo install was computing all possible binaries for a package regardless
of the requested features, and would conclude that the installed package
was out-of-date if it hadn't installed all binaries, even if the requested
features wouldn't actually produce any of the "missing" binaries.

Fixes rust-lang#8703

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo rebuilds every time when installing a crate with binaries behind feature gates

2 participants