Skip to content

Commit 0f9d4a3

Browse files
committed
feat(toml): Warn on unset Edition
1 parent 0955a80 commit 0f9d4a3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ pub fn to_real_manifest(
570570
package.edition = Some(manifest::InheritableField::Value(edition.to_string()));
571571
edition
572572
} else {
573+
warnings.push(format!(
574+
"no edition set: defaulting to the {} edition while the latest is {}",
575+
Edition::Edition2015,
576+
Edition::LATEST_STABLE
577+
));
573578
Edition::Edition2015
574579
};
575580
// Add these lines if start a new unstable edition.

tests/testsuite/edition.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ fn unset_edition_works_on_old_msrv() {
141141
p.cargo("check -v")
142142
.with_stderr(
143143
"\
144+
[WARNING] no edition set: defaulting to the 2015 edition while the latest is 2021
144145
[CHECKING] foo [..]
145146
[RUNNING] `rustc [..] --edition=2015 [..]`
146147
[FINISHED] [..]

0 commit comments

Comments
 (0)