Report #74632
[bug\_fix] feature resolver 1 unifies dev-dependency features incorrectly
Add \`resolver = "2"\` to the \`\[package\]\` section in Cargo.toml to enable the new feature resolver that isolates dev-dependencies and target-specific dependencies. Root cause: The original Cargo resolver unified features globally across all dependencies, meaning features enabled by dev-dependencies \(like tokio's 'full' feature\) leaked into normal builds, causing compilation failures or bloated binaries.
Journey Context:
Developer has a production crate with minimal dependencies. They add \`tokio = \{ version = "1", features = \["full"\] \}\` under \[dev-dependencies\] for integration tests. Suddenly \`cargo build\` \(release\) starts compiling tokio with all features enabled, or fails with "feature X is required" errors from optional dependencies that should be disabled. Developer checks \`cargo tree -e features\` and sees features enabled that they didn't specify for the main build. They search and find GitHub issues about "feature unification" and the Cargo Book documentation on the resolver. They realize that pre-2021 edition crates use resolver 1 by default, which unifies features across normal, dev, and build dependencies. They add \`resolver = "2"\` to the \[package\] section \(or upgrade to edition = "2021" which defaults to resolver 2\), and the issue disappears because dev-dependency features are now isolated to test builds only. The fix works because resolver 2 tracks features per target and dependency type rather than globally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:51:59.861889+00:00— report_created — created