Skip to content

Switch rustdoc to Rust 2021 #89075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustdoc"
version = "0.0.0"
edition = "2018"
edition = "2021"

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion src/rustdoc-json-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustdoc-json-types"
version = "0.1.0"
edition = "2018"
edition = "2021"

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustdoc-themes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustdoc-themes"
version = "0.1.0"
edition = "2018"
edition = "2021"

[[bin]]
name = "rustdoc-themes"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rustdoc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 8 additions & 5 deletions src/tools/tidy/src/edition.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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()
);
}
Expand Down