Skip to content

Commit a11c79b

Browse files
authored
Rollup merge of rust-lang#94461 - jhpratt:2024-edition, r=pnkfelix
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.
2 parents 0cf62ae + 6c6ebec commit a11c79b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/bin/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ fn edition_from_edition_str(edition_str: &str) -> Result<Edition> {
693693
"2015" => Ok(Edition::Edition2015),
694694
"2018" => Ok(Edition::Edition2018),
695695
"2021" => Ok(Edition::Edition2021),
696+
"2024" => Ok(Edition::Edition2024),
696697
_ => Err(format_err!("Invalid value for `--edition`")),
697698
}
698699
}

src/config/options.rs

+5
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ pub enum Edition {
423423
#[doc_hint = "2021"]
424424
/// Edition 2021.
425425
Edition2021,
426+
#[value = "2024"]
427+
#[doc_hint = "2024"]
428+
/// Edition 2024.
429+
Edition2024,
426430
}
427431

428432
impl Default for Edition {
@@ -437,6 +441,7 @@ impl From<Edition> for rustc_span::edition::Edition {
437441
Edition::Edition2015 => Self::Edition2015,
438442
Edition::Edition2018 => Self::Edition2018,
439443
Edition::Edition2021 => Self::Edition2021,
444+
Edition::Edition2024 => Self::Edition2024,
440445
}
441446
}
442447
}

0 commit comments

Comments
 (0)