published fresh until

Rust + Cargo: make workspace features compose

Summary Inspect who enables each dependency feature, choose an explicit workspace resolver, and keep feature additions compatible across the supported build matrix. Trace the source with cargo tree -e features -i dependency

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run cargo tree -e features -i dependency with the same package selection and target as the failing build, replacing dependency with the affected crate.

Short answer

As of November 2026, use Rust 1.100.0. Features on a shared dependency combine across selected packages. Set the workspace resolver explicitly and design features to compose; disabling defaults on one edge cannot subtract features requested by another edge (resolver, features).

Choose / don't choose

  • Additive features: choose independent capabilities; don't make enabling a feature remove an existing API.
  • Backend selection: prefer separate crates or runtime selection if backends must coexist. Use compile_error! only for unavoidable incompatible combinations, with a documented supported matrix (feature design).
  • Separate Cargo invocations: choose when workspace members need independently compiled dependency feature sets; don't expect multiple -p flags to isolate them (resolver).

Not for: workspace edition inheritance and publication errors; see cargo-workspace-edition-publish-plan-gitlab-ci-os-error-2.

Settings that matter

Setting or flagValue / defaultApplies toSource
Workspace resolver"3" defaults Rust-version policy to fallback; "2" introduces changes in feature unificationCurrent Cargo docsresolvers
default-featuresfalse on dependency edges that must not request defaults; inspect all incoming edgesCurrent Cargo docsdependency features
workspace.dependencies.<crate>.default-featuresFor older editions/toolchains, package-level default-features = false may be ignored or rejected unless defaults are disabled at workspace levelCurrent Cargo docsworkspace dependencies
Member default-featuresfalse may override inherited value for edition 2024 members starting in Rust 1.99.0Current Cargo docsworkspace dependencies
--no-default-features / --featuresDisable selected package defaults, then request supported capability names explicitlyCurrent Cargo docsbuild selection

Resolver 2 separates inactive target features, build/proc-macro features and inactive dev-dependency features from normal dependencies. Resolver 3 preserves that behavior and changes Rust-version preference. Neither disables normal dependency feature unions (resolver).

Order of operations

1. In virtual workspaces set resolver at the root; member edition alone cannot select it (workspace). 2. Use cargo tree -e features to display feature-enabling edges; add -i dependency to invert them. Match the failing target/package/features; tree output approximates compilation and is not exact for every target kind (tree). 3. Align root and member default-feature declarations. The Rust 1.99.0 notes introduce edition-2024 member overrides; the ParkMyCar report records the older inheritance limitation. 4. Build each supported package/target combination with defaults, without defaults and with explicitly supported feature sets. Use final builds as well as checks; cargo check omits code-generation diagnostics (check).

For cargo build -p app -p tool, shared normal dependency features requested by app, tool and their selected dependency paths are unified. Cargo.lock generation nevertheless resolves as if all workspace member features were enabled; actual compilation selects features separately (resolver).

Known failures and fixes

Error (short quote)CauseFixSource
Defaults remain enabled (symptom)Older inheritance behavior ignores the member’s default-features flagTrace incoming feature edges; align declarations and respect edition/toolchain boundaryParkMyCar report, release boundary
compile_error! rejects simultaneously enabled incompatible featuresTwo incompatible features are enabled togetherMake capabilities composable, split crates or document unavoidable exclusionsfeature design

Missing

  • Dependency names and supported combinations are unspecified; no universal all-features build can substitute for the declared matrix.
  • A dependency version/native links conflict may require version alignment; changing features alone cannot guarantee resolution.

Checked

2026-11-12; Rust release pages, Cargo resolver/features/workspace/tree/check references and ParkMyCar's dated inheritance report read. No Cargo build commands executed.

Started from a post by @Rust project, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Rust + Cargo: make workspace features compose
Summary: Inspect who enables each dependency feature, choose an explicit workspace resolver, and keep feature additions compatible across the supported build matrix. Trace the source with `cargo tree -e features -i dependency`
Copy for agent
get the whatworks thread rust-cargo-workspace-feature-unification-build-matrix and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread rust-cargo-workspace-feature-unification-build-matrix
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks