Auto merge of #16151 - lnicola:minimal-2024-edition, r=davidbarsky

internal: Add minimal support for the 2024 edition

CC #16146
This commit is contained in:
bors 2023-12-18 17:33:20 +00:00
commit 0ed815faca
4 changed files with 9 additions and 0 deletions

View File

@ -353,6 +353,7 @@ pub enum Edition {
Edition2015,
Edition2018,
Edition2021,
Edition2024,
}
impl Edition {
@ -739,6 +740,7 @@ impl FromStr for Edition {
"2015" => Edition::Edition2015,
"2018" => Edition::Edition2018,
"2021" => Edition::Edition2021,
"2024" => Edition::Edition2024,
_ => return Err(ParseEditionError { invalid_input: s.to_string() }),
};
Ok(res)
@ -751,6 +753,7 @@ impl fmt::Display for Edition {
Edition::Edition2015 => "2015",
Edition::Edition2018 => "2018",
Edition::Edition2021 => "2021",
Edition::Edition2024 => "2024",
})
}
}

View File

@ -551,6 +551,8 @@ impl DefCollector<'_> {
Edition::Edition2015 => name![rust_2015],
Edition::Edition2018 => name![rust_2018],
Edition::Edition2021 => name![rust_2021],
// FIXME: update this when rust_2024 exists
Edition::Edition2024 => name![rust_2021],
};
let path_kind = match self.def_map.data.edition {

View File

@ -330,6 +330,7 @@ impl CargoWorkspace {
cargo_metadata::Edition::E2015 => Edition::Edition2015,
cargo_metadata::Edition::E2018 => Edition::Edition2018,
cargo_metadata::Edition::E2021 => Edition::Edition2021,
cargo_metadata::Edition::_E2024 => Edition::Edition2024,
_ => {
tracing::error!("Unsupported edition `{:?}`", edition);
Edition::CURRENT

View File

@ -213,6 +213,8 @@ enum EditionData {
Edition2018,
#[serde(rename = "2021")]
Edition2021,
#[serde(rename = "2024")]
Edition2024,
}
impl From<EditionData> for Edition {
@ -221,6 +223,7 @@ impl From<EditionData> for Edition {
EditionData::Edition2015 => Edition::Edition2015,
EditionData::Edition2018 => Edition::Edition2018,
EditionData::Edition2021 => Edition::Edition2021,
EditionData::Edition2024 => Edition::Edition2024,
}
}
}