diff --git a/src/bin/main.rs b/src/bin/main.rs index c7d3a060d54..fe24276311e 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -770,6 +770,7 @@ fn style_edition_from_style_edition_str(edition_str: &str) -> Result Ok(StyleEdition::Edition2018), "2021" => Ok(StyleEdition::Edition2021), "2024" => Ok(StyleEdition::Edition2024), + "2027" => Ok(StyleEdition::Edition2027), _ => Err(format_err!("Invalid value for `--style-edition`")), } } diff --git a/src/config/options.rs b/src/config/options.rs index c526b5c678f..c0f4bdc135c 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -514,6 +514,11 @@ pub enum StyleEdition { #[unstable_variant] /// [Edition 2024](). Edition2024, + #[value = "2027"] + #[doc_hint = "2027"] + #[unstable_variant] + /// [Edition 2027](). + Edition2027, } impl From for rustc_span::edition::Edition { @@ -523,6 +528,8 @@ impl From for rustc_span::edition::Edition { StyleEdition::Edition2018 => Self::Edition2018, StyleEdition::Edition2021 => Self::Edition2021, StyleEdition::Edition2024 => Self::Edition2024, + // TODO: should update to Edition2027 when it becomes available + StyleEdition::Edition2027 => Self::Edition2024, } } } diff --git a/src/config/style_edition.rs b/src/config/style_edition.rs index c34eca9c8e1..c896ae21647 100644 --- a/src/config/style_edition.rs +++ b/src/config/style_edition.rs @@ -30,7 +30,9 @@ macro_rules! style_edition_default { $crate::config::StyleEdition::Edition2015 | $crate::config::StyleEdition::Edition2018 | $crate::config::StyleEdition::Edition2021 => $default_2015, - $crate::config::StyleEdition::Edition2024 => $default_2024, + // TODO: should update macro when default_2027 becomes available + $crate::config::StyleEdition::Edition2024 + | $crate::config::StyleEdition::Edition2027 => $default_2024, } } } @@ -52,6 +54,7 @@ mod test { assert_eq!(Unit::style_edition_default(StyleEdition::Edition2018), 100); assert_eq!(Unit::style_edition_default(StyleEdition::Edition2021), 100); assert_eq!(Unit::style_edition_default(StyleEdition::Edition2024), 100); + assert_eq!(Unit::style_edition_default(StyleEdition::Edition2027), 100); } #[test] @@ -66,5 +69,6 @@ mod test { // style edition 2024 assert_eq!(Unit::style_edition_default(StyleEdition::Edition2024), 50); + assert_eq!(Unit::style_edition_default(StyleEdition::Edition2027), 50); } }