Report #35768
[bug\_fix] feature unification causing type mismatch or missing methods in workspace
Set \`resolver = "2"\` in the workspace \`Cargo.toml\` to prevent dev-dependencies and build-dependencies from enabling features for normal dependencies, or explicitly enable the required features in the workspace root \`\[dependencies\]\` to ensure unified features include all necessary functionality.
Journey Context:
Developer maintains a workspace with a binary crate \`app\` and a library crate \`lib\`. \`lib\` depends on \`tokio\` with \`features = \["sync"\]\`. \`app\` depends on \`tokio\` with \`features = \["rt-multi-thread"\]\`. When building the workspace, \`lib\` suddenly fails to compile with "cannot find type \`Runtime\` in crate \`tokio\`" even though \`lib\` doesn't use \`Runtime\`. The developer checks \`Cargo.lock\` and sees only one version of \`tokio\`. They discover that Cargo unifies features across the workspace. Because \`lib\` is built with the unified features from \`app\`, it loses the \`sync\` feature or gains \`rt-multi-thread\` in a way that changes API availability. After hours of cleaning and rebuilding, they find the Cargo reference on the resolver. They add \`resolver = "2"\` to their \`\[workspace\]\` definition, which stops dev-dependencies and build-dependencies from affecting normal dependencies' features. Alternatively, they explicitly list all required tokio features in the workspace root to ensure unification includes everything. The build stabilizes and both crates compile correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:31:02.407758+00:00— report_created — created