{"id":"224530a4f5b14235","repo":"rust-lang/cargo","slug":"old-path-is-unsupported-as-of-the-2024-edition","errorCode":null,"errorMessage":"`{old_path}` is unsupported as of the 2024 edition; instead use `{new_path}`\n(in the `{name}` {kind})","messagePattern":"`(.+?)` is unsupported as of the 2024 edition; instead use `(.+?)`\n\\(in the `(.+?)` (.+?)\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":2917,"sourceCode":"    if let Err(err) = gctx.shell().print_report(&[group], true) {\n        return err.into();\n    }\n    return AlreadyPrintedError::new(e.into()).into();\n}\n\n/// Warn about paths that have been deprecated and may conflict.\nfn deprecated_underscore<T>(\n    old: &Option<T>,\n    new: &Option<T>,\n    new_path: &str,\n    name: &str,\n    kind: &str,\n    edition: Edition,\n    warnings: &mut Vec<String>,\n) -> CargoResult<()> {\n    let old_path = new_path.replace(\"-\", \"_\");\n    if old.is_some() && Edition::Edition2024 <= edition {\n        anyhow::bail!(\n            \"`{old_path}` is unsupported as of the 2024 edition; instead use `{new_path}`\\n(in the `{name}` {kind})\"\n        );\n    } else if old.is_some() && new.is_some() {\n        warnings.push(format!(\n            \"`{old_path}` is redundant with `{new_path}`, preferring `{new_path}` in the `{name}` {kind}\"\n        ))\n    } else if old.is_some() {\n        warnings.push(format!(\n            \"`{old_path}` is deprecated in favor of `{new_path}` and will not work in the 2024 edition\\n(in the `{name}` {kind})\"\n        ))\n    }\n    Ok(())\n}\n\nfn warn_on_unused(unused: &BTreeSet<String>, warnings: &mut Vec<String>) {\n    use std::fmt::Write as _;\n\n    for key in unused {","sourceCodeStart":2899,"sourceCodeEnd":2935,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/mod.rs#L2899-L2935","documentation":"Thrown by `deprecated_underscore` at src/workspace/parser/mod.rs:2917. Several manifest keys historically accepted an underscore spelling (`dev_dependencies`, `build_dependencies`, and target-section equivalents). In edition 2024 and later the underscore form is a hard error (`old.is_some() && Edition::Edition2024 <= edition`); cargo reports the old (underscore) path and the required hyphenated replacement, scoped to the package or platform target where it appeared.","triggerScenarios":"A Cargo.toml on edition 2024 that uses `[dev_dependencies]` or `[build_dependencies]` (underscore) instead of `[dev-dependencies]` / `[build-dependencies]` (hyphen), including under `[target.<cfg>]`.","commonSituations":"Upgrading an older crate to edition 2024; manifests written before the hyphen form was canonical; bulk find-replace that reintroduced underscores.","solutions":["Rename every underscored section to its hyphenated form: `[dev_dependencies]` → `[dev-dependencies]`, `[build_dependencies]` → `[build-dependencies]` (also inside `[target.*]`).","Run `cargo check`/`cargo fmt` after renaming to catch any remaining instances."],"exampleFix":"# before (edition 2024)\n[dev_dependencies]\nserde = \"1\"\n# after\n[dev-dependencies]\nserde = \"1\"","handlingStrategy":"validation","validationCode":"const UNDERSCORED: &[&str] = &[\"dev_dependencies\",\"build_dependencies\"];\nfor key in UNDERSCORED {\n    if doc.as_table().contains_key(*key) {\n        return Err(format!(\"{key} unsupported in edition 2024; use the hyphen form\"));\n    }\n}\n// also check [target.*] sub-tables","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use hyphenated `dev-dependencies`/`build-dependencies`.","Add a CI grep for underscored section names.","Run an edition-2024 upgrade linter on old crates."],"tags":["manifest","edition-2024","deprecation","naming"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}