{"id":"f8102f8ed5870479","repo":"rust-lang/cargo","slug":"use-of-default-features-in-key-is-unsupporte","errorCode":null,"errorMessage":"Use of `default_features` in `{key}` is unsupported, please switch to `default-features`","messagePattern":"Use of `default_features` in `(.+?)` is unsupported, please switch to `default-features`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/editor/dependency.rs","lineNumber":342,"sourceCode":"                        \"dependency ({key}) specified without \\\n                        providing a local path, Git repository, version, or \\\n                        workspace dependency to use\"\n                    );\n                };\n            let registry = if let Some(value) = table.get(\"registry\") {\n                Some(\n                    value\n                        .as_str()\n                        .ok_or_else(|| invalid_type(key, \"registry\", value.type_name(), \"string\"))?\n                        .to_owned(),\n                )\n            } else {\n                None\n            };\n\n            let default_features = table.get(\"default-features\").and_then(|v| v.as_bool());\n            if table.contains_key(\"default_features\") {\n                anyhow::bail!(\n                    \"Use of `default_features` in `{key}` is unsupported, please switch to `default-features`\"\n                );\n            }\n\n            let features = if let Some(value) = table.get(\"features\") {\n                Some(\n                    value\n                        .as_array()\n                        .ok_or_else(|| invalid_type(key, \"features\", value.type_name(), \"array\"))?\n                        .iter()\n                        .map(|v| {\n                            v.as_str().map(|s| s.to_owned()).ok_or_else(|| {\n                                invalid_type(key, \"features\", v.type_name(), \"string\")\n                            })\n                        })\n                        .collect::<CargoResult<IndexSet<String>>>()?,\n                )\n            } else {","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/editor/dependency.rs#L324-L360","documentation":"Thrown by `Dependency::from_toml` (editor) at src/workspace/editor/dependency.rs:342. Cargo's manifest format requires the hyphenated key `default-features`; the underscore variant `default_features` (leftover from early TOML/Python conventions) is explicitly rejected by the dependency editor so manifests stay canonical.","triggerScenarios":"A dependency table containing `default_features = false` (underscore), e.g. `foo = { version = \"1.0\", default_features = false }`. The check is `table.contains_key(\"default_features\")` and fires regardless of value.","commonSituations":"Copy-pasting from old blog posts or non-Rust TOML examples; auto-formatters or LLM suggestions using underscores; porting config from another ecosystem.","solutions":["Rename the key to `default-features`: `foo = { version = \"1.0\", default-features = false }`.","Run `cargo fmt --manifest-path Cargo.toml`/a find-and-replace of `default_features` → `default-features` in all dependency tables."],"exampleFix":"# before\nfoo = { version = \"1.0\", default_features = false }\n# after\nfoo = { version = \"1.0\", default-features = false }","handlingStrategy":"validation","validationCode":"// reject the underscore spelling in any dependency table\nfor (_k, item) in deps {\n    if let Some(t) = item.as_table_like() {\n        if t.contains_key(\"default_features\") {\n            eprintln!(\"use `default-features` (hyphen), not default_features\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the hyphenated `default-features`.","Add a CI grep: `rg 'default_features'` should return nothing in Cargo.toml files.","Configure editors/LLMs to use the canonical spelling."],"tags":["manifest","dependencies","naming"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}