Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
))
Expand Down
11 changes: 9 additions & 2 deletions tests/testsuite/script/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand Down