{"record":{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":2895,"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":2877,"sourceCodeEnd":2913,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/workspace/parser/mod.rs#L2877-L2913","documentation":"Thrown by the deprecated_underscore helper when an old underscore-style field (e.g. dev_dependencies, build_dependencies, default_run) is present and the edition is 2024 or later. In earlier editions the underscore form is deprecated with a warning; in 2024 it is removed entirely and becomes a hard error. The message names the old path, the new hyphenated path, the field's owner (name), and its kind.","triggerScenarios":"A Cargo.toml with edition = \"2024\" that uses [dev-dependencies] spelled as dev_dependencies, or build_dependencies, or default_run in a target. deprecated_underscore is called for dev-dependencies, build-dependencies, and target fields during package/workspace parsing.","commonSituations":"Upgrading a crate to edition 2024 without renaming underscore fields to hyphenated equivalents. Old manifests predating hyphen normalization. Templates or generators emitting underscore keys.","solutions":["Rename the underscore field to its hyphenated form (dev_dependencies -> dev-dependencies, build_dependencies -> build-dependencies, default_run -> default-run).","Run `cargo fix --edition` during the edition migration to auto-rename deprecated fields.","Audit all Cargo.toml files in the workspace for underscore-style keys before bumping the edition."],"exampleFix":"# before\n[dev_dependencies]\nserde = \"1.0\"\ndefault_run = \"my-bin\"\n\n# after\n[dev-dependencies]\nserde = \"1.0\"\ndefault-run = \"my-bin\"","handlingStrategy":"validation","validationCode":"const UNDERSCORE_FIELDS: &[&str] = &[\"dev_dependencies\",\"build_dependencies\",\"default_run\"];\nfn check_no_deprecated_underscores(toml: &str, edition: &str) -> Result<(), String> {\n    if edition >= \"2024\" {\n        for f in UNDERSCORE_FIELDS {\n            if toml.contains(&format!(\"{f} =\")) || toml.contains(&format!(\"[{f}]\")) {\n                return Err(format!(\"`{f}` is removed in edition 2024; use the hyphenated form\"));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":"fn manifest_uses_hyphen_fields(toml_text: &str) -> bool {\n    !UNDERSCORE_FIELDS.iter().any(|f| toml_text.contains(f))\n}","tryCatchPattern":null,"preventionTips":["Use hyphenated field names (dev-dependencies, build-dependencies, default-run) everywhere.","Run `cargo fix --edition` during edition upgrades to auto-rename.","Add a CI lint that rejects underscore-style manifest keys."],"tags":["cargo","manifest","edition-2024","deprecation","naming"],"backgroundTag":null,"analyzedSha":"98a09e7e7d62850f14e5b6132101fc1edd19a16f","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}