{"id":"f9d0864994f9a68a","repo":"rust-lang/cargo","slug":"default-features-false-cannot-override-workspa","errorCode":null,"errorMessage":"`default-features = false` cannot override workspace's `default-features`","messagePattern":"`default-features = false` cannot override workspace's `default-features`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":1274,"sourceCode":"    };\n    merged_dep.optional = *optional;\n    merged_dep.public = *public;\n    Ok(manifest::TomlDependency::Detailed(merged_dep))\n}\n\nfn deprecated_ws_default_features(\n    label: &str,\n    ws_def_feat: Option<bool>,\n    edition: Edition,\n    warnings: &mut Vec<String>,\n) -> CargoResult<()> {\n    let ws_def_feat = match ws_def_feat {\n        Some(true) => \"true\",\n        Some(false) => \"false\",\n        None => \"not specified\",\n    };\n    if Edition::Edition2024 <= edition {\n        anyhow::bail!(\"`default-features = false` cannot override workspace's `default-features`\");\n    } else {\n        warnings.push(format!(\n            \"`default-features` is ignored for {label}, since `default-features` was \\\n                {ws_def_feat} for `workspace.dependencies.{label}`, \\\n                this could become a hard error in the future\"\n        ));\n    }\n    Ok(())\n}\n\n#[tracing::instrument(skip_all)]\npub fn to_real_manifest(\n    contents: Option<String>,\n    document: Option<toml::Spanned<toml::de::DeTable<'static>>>,\n    original_toml: manifest::TomlManifest,\n    normalized_toml: manifest::TomlManifest,\n    features: Features,\n    workspace_config: WorkspaceConfig,","sourceCodeStart":1256,"sourceCodeEnd":1292,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/mod.rs#L1256-L1292","documentation":"Thrown by `deprecated_ws_default_features` at src/workspace/parser/mod.rs:1274. In edition 2024 and later, a member dependency that inherits from `workspace.dependencies` is no longer allowed to override `default-features = false`, because that contradicts the workspace's decision and the resolution was made stricter. Before 2024 this is only a warning; from 2024 it is a hard error (`Edition::Edition2024 <= edition`).","triggerScenarios":"A workspace member on edition 2024 with `foo = { workspace = true, default-features = false }` while `workspace.dependencies.foo` is defined (regardless of its own default-features setting).","commonSituations":"Upgrading a crate to edition 2024 that previously relied on the warning-only behavior; inheriting a dep but wanting fewer features.","solutions":["Set `default-features = false` at the workspace level: in `[workspace.dependencies] foo = { version = \"1.0\", default-features = false }`.","If only one member needs it, do not inherit — declare the dependency directly in that member with `default-features = false`.","Remove the member-level `default-features = false` and accept the workspace default."],"exampleFix":"# before (member, edition 2024)\n[dependencies]\nfoo = { workspace = true, default-features = false }\n# after (set at workspace root)\n# Cargo.toml (root):\n[workspace.dependencies]\nfoo = { version = \"1.0\", default-features = false }\n# member:\n[dependencies]\nfoo = { workspace = true }","handlingStrategy":"validation","validationCode":"// for edition >= 2024 members, forbid default-features on inherited deps\nfor (_k, item) in deps {\n    if let Some(t) = item.as_table_like() {\n        let inherits = t.get(\"workspace\").and_then(|v| v.as_bool()) == Some(true);\n        let overrides = t.contains_key(\"default-features\");\n        if edition >= 2024 && inherits && overrides {\n            return Err(\"set default-features at the workspace level\".into());\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On edition 2024, control `default-features` only in `[workspace.dependencies]`.","Don't inherit a dep if a single member needs different features — declare it locally."],"tags":["manifest","dependencies","edition-2024","workspace"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}