diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index e02cef235ae00..945b2a8e9a80e 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/rustdoc-json-types/Cargo.toml b/src/rustdoc-json-types/Cargo.toml index a692f6f896da7..d60699efd36cb 100644 --- a/src/rustdoc-json-types/Cargo.toml +++ b/src/rustdoc-json-types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-json-types" version = "0.1.0" -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/src/tools/rustdoc-themes/Cargo.toml b/src/tools/rustdoc-themes/Cargo.toml index 4b2ad982a84fb..3d8c77d36d70d 100644 --- a/src/tools/rustdoc-themes/Cargo.toml +++ b/src/tools/rustdoc-themes/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-themes" version = "0.1.0" -edition = "2018" +edition = "2021" [[bin]] name = "rustdoc-themes" diff --git a/src/tools/rustdoc/Cargo.toml b/src/tools/rustdoc/Cargo.toml index 5625707b25a53..c4101f72cc2da 100644 --- a/src/tools/rustdoc/Cargo.toml +++ b/src/tools/rustdoc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rustdoc-tool" version = "0.0.0" -edition = "2018" +edition = "2021" # Cargo adds a number of paths to the dylib search path on windows, which results in # the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool" diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs index 283c43e325c05..e58b690194f64 100644 --- a/src/tools/tidy/src/edition.rs +++ b/src/tools/tidy/src/edition.rs @@ -1,10 +1,13 @@ -//! Tidy check to ensure that crate `edition` is '2018' +//! Tidy check to ensure that crate `edition` is '2018' or '2021'. use std::path::Path; -fn is_edition_2018(mut line: &str) -> bool { +fn is_edition_2018_or_2021(mut line: &str) -> bool { line = line.trim(); - line == "edition = \"2018\"" || line == "edition = \'2018\'" + line == "edition = \"2018\"" + || line == "edition = \'2018\'" + || line == "edition = \"2021\"" + || line == "edition = \'2021\'" } pub fn check(path: &Path, bad: &mut bool) { @@ -17,11 +20,11 @@ pub fn check(path: &Path, bad: &mut bool) { if filename != "Cargo.toml" { return; } - let has_edition = contents.lines().any(is_edition_2018); + let has_edition = contents.lines().any(is_edition_2018_or_2021); if !has_edition { tidy_error!( bad, - "{} doesn't have `edition = \"2018\"` on a separate line", + "{} doesn't have `edition = \"2018\"` or `edition = \"2021\"` on a separate line", file.display() ); }