diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 57f0ac2e00b..0147890c433 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -633,9 +633,10 @@ fn normalize_package_toml<'a>( if is_embedded { const DEFAULT_EDITION: crate::core::features::Edition = crate::core::features::Edition::LATEST_STABLE; - let _ = gctx.shell().warn(format_args!( + let report = [Group::with_title(Level::WARNING.secondary_title(format!( "`package.edition` is unspecified, defaulting to the latest edition (currently `{DEFAULT_EDITION}`)" - )); + )))]; + let _ = gctx.shell().print_report(&report, true); Some(manifest::InheritableField::Value( DEFAULT_EDITION.to_string(), )) diff --git a/tests/testsuite/script/cargo.rs b/tests/testsuite/script/cargo.rs index c2868fa9fd1..d06f84c8365 100644 --- a/tests/testsuite/script/cargo.rs +++ b/tests/testsuite/script/cargo.rs @@ -414,6 +414,7 @@ rustc = "non-existent-rustc" .masquerade_as_nightly_cargo(&["script"]) .with_status(101) .with_stderr_data(str![[r#" +[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `2024`) [ERROR] could not execute process `non-existent-rustc -vV` (never executed) Caused by: @@ -449,7 +450,10 @@ arg0: [..] args: ["-NotAnArg"] "#]]) - .with_stderr_data("") + .with_stderr_data(str![[r#" +[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`) + +"#]]) .run(); } @@ -468,7 +472,10 @@ arg0: [..] args: ["-NotAnArg"] "#]]) - .with_stderr_data("") + .with_stderr_data(str![[r#" +[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`) + +"#]]) .run(); }