Report #52112
[bug\_fix] feature resolver v1 causes unexpected feature unification in workspaces \(e.g., dev-dependencies affecting normal dependencies\)
Set \`resolver = "2"\` in the \`\[workspace\]\` section of the workspace root \`Cargo.toml\`. Root cause: The legacy feature resolver \(v1, default in 2015/2018 editions\) unifies features across the entire dependency graph regardless of build type \(normal vs dev vs build\) or target platform. Resolver 2 isolates features for dev-dependencies, build-dependencies, and target-specific dependencies, preventing dev-only features \(like test mocks\) from leaking into the main build.
Journey Context:
Developer has a workspace with a library \`mylib\` and a binary \`mybin\`. \`mylib\` depends on \`tokio\` with minimal features. \`mybin\` has a dev-dependency on \`tokio-test\` which enables the \`full\` feature of \`tokio\`. After adding \`tokio-test\`, the developer notices that \`mylib\` suddenly compiles with \`tokio\`'s \`full\` feature enabled even in normal builds \(observed via longer compile times or specific feature-gated code being compiled\). They investigate \`Cargo.lock\` and feature flags. They find that dev-dependencies in v1 unify features with normal dependencies. They add \`resolver = "2"\` to the workspace root, which isolates the dev-dependency features, fixing the unexpected feature unification.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:58:00.682054+00:00— report_created — created