feat(toml): Warn on unset Edition

This commit is contained in:
Ed Page 2024-02-13 16:20:56 -06:00
parent 0955a80a07
commit 0f9d4a352a
2 changed files with 6 additions and 0 deletions

View file

@ -570,6 +570,11 @@ pub fn to_real_manifest(
package.edition = Some(manifest::InheritableField::Value(edition.to_string()));
edition
} else {
warnings.push(format!(
"no edition set: defaulting to the {} edition while the latest is {}",
Edition::Edition2015,
Edition::LATEST_STABLE
));
Edition::Edition2015
};
// Add these lines if start a new unstable edition.

View file

@ -141,6 +141,7 @@ fn unset_edition_works_on_old_msrv() {
p.cargo("check -v")
.with_stderr(
"\
[WARNING] no edition set: defaulting to the 2015 edition while the latest is 2021
[CHECKING] foo [..]
[RUNNING] `rustc [..] --edition=2015 [..]`
[FINISHED] [..]