Skip to content

Commit

Permalink
Rollup merge of rust-lang#94461 - jhpratt:2024-edition, r=pnkfelix
Browse files Browse the repository at this point in the history
Create (unstable) 2024 edition

[On Zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Deprecating.20macro.20scoping.20shenanigans/near/272860652), there was a small aside regarding creating the 2024 edition now as opposed to later. There was a reasonable amount of support and no stated opposition.

This change creates the 2024 edition in the compiler and creates a prelude for the 2024 edition. There is no current difference between the 2021 and 2024 editions. Cargo and other tools will need to be updated separately, as it's not in the same repository. This change permits the vast majority of work towards the next edition to proceed _now_ instead of waiting until 2024.

For sanity purposes, I've merged the "hello" UI tests into a single file with multiple revisions. Otherwise we'd end up with a file per edition, despite them being essentially identical.

````@rustbot```` label +T-lang +S-waiting-on-review

Not sure on the relevant team, to be honest.
  • Loading branch information
Dylan-DPC authored Apr 15, 2022
2 parents 0cf62ae + 6c6ebec commit a11c79b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ fn edition_from_edition_str(edition_str: &str) -> Result<Edition> {
"2015" => Ok(Edition::Edition2015),
"2018" => Ok(Edition::Edition2018),
"2021" => Ok(Edition::Edition2021),
"2024" => Ok(Edition::Edition2024),
_ => Err(format_err!("Invalid value for `--edition`")),
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ pub enum Edition {
#[doc_hint = "2021"]
/// Edition 2021.
Edition2021,
#[value = "2024"]
#[doc_hint = "2024"]
/// Edition 2024.
Edition2024,
}

impl Default for Edition {
Expand All @@ -437,6 +441,7 @@ impl From<Edition> for rustc_span::edition::Edition {
Edition::Edition2015 => Self::Edition2015,
Edition::Edition2018 => Self::Edition2018,
Edition::Edition2021 => Self::Edition2021,
Edition::Edition2024 => Self::Edition2024,
}
}
}
Expand Down

0 comments on commit a11c79b

Please sign in to comment.