Skip to content

Commit

Permalink
feat(toml): Warn on unset Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 29, 2024
1 parent 0955a80 commit 0f9d4a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] [..]
Expand Down

0 comments on commit 0f9d4a3

Please sign in to comment.