From 5432a67a3ffe3e63637d647e7b73585293decf75 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 18 Sep 2021 17:31:54 -0700 Subject: [PATCH 1/3] Allow Rust 2021 crates in tidy Once all crates have been switched to Rust 2021, I think this code should be changed to be similar to the old version but with 2021 instead of 2018. For now, allow both editions during the transition. --- src/tools/tidy/src/edition.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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() ); } From ba8b8462ee37eb86f3fc80ffc4690f17fa818517 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 18 Sep 2021 11:29:31 -0700 Subject: [PATCH 2/3] Switch rustdoc to Rust 2021 --- src/librustdoc/Cargo.toml | 2 +- src/rustdoc-json-types/Cargo.toml | 2 +- src/tools/rustdoc/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/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" From 60c65894fda81dfd03c26afbc77c4da86c21f0d5 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 18 Sep 2021 11:38:40 -0700 Subject: [PATCH 3/3] Switch an internal rustdoc tool to Rust 2021 --- src/tools/rustdoc-themes/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"