Skip to content

Commit 0ed815f

Browse files
committed
Auto merge of #16151 - lnicola:minimal-2024-edition, r=davidbarsky
internal: Add minimal support for the 2024 edition CC #16146
2 parents f663521 + fec0e04 commit 0ed815f

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

crates/base-db/src/input.rs

+3
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ pub enum Edition {
353353
Edition2015,
354354
Edition2018,
355355
Edition2021,
356+
Edition2024,
356357
}
357358

358359
impl Edition {
@@ -739,6 +740,7 @@ impl FromStr for Edition {
739740
"2015" => Edition::Edition2015,
740741
"2018" => Edition::Edition2018,
741742
"2021" => Edition::Edition2021,
743+
"2024" => Edition::Edition2024,
742744
_ => return Err(ParseEditionError { invalid_input: s.to_string() }),
743745
};
744746
Ok(res)
@@ -751,6 +753,7 @@ impl fmt::Display for Edition {
751753
Edition::Edition2015 => "2015",
752754
Edition::Edition2018 => "2018",
753755
Edition::Edition2021 => "2021",
756+
Edition::Edition2024 => "2024",
754757
})
755758
}
756759
}

crates/hir-def/src/nameres/collector.rs

+2
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@ impl DefCollector<'_> {
551551
Edition::Edition2015 => name![rust_2015],
552552
Edition::Edition2018 => name![rust_2018],
553553
Edition::Edition2021 => name![rust_2021],
554+
// FIXME: update this when rust_2024 exists
555+
Edition::Edition2024 => name![rust_2021],
554556
};
555557

556558
let path_kind = match self.def_map.data.edition {

crates/project-model/src/cargo_workspace.rs

+1
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ impl CargoWorkspace {
330330
cargo_metadata::Edition::E2015 => Edition::Edition2015,
331331
cargo_metadata::Edition::E2018 => Edition::Edition2018,
332332
cargo_metadata::Edition::E2021 => Edition::Edition2021,
333+
cargo_metadata::Edition::_E2024 => Edition::Edition2024,
333334
_ => {
334335
tracing::error!("Unsupported edition `{:?}`", edition);
335336
Edition::CURRENT

crates/project-model/src/project_json.rs

+3
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ enum EditionData {
213213
Edition2018,
214214
#[serde(rename = "2021")]
215215
Edition2021,
216+
#[serde(rename = "2024")]
217+
Edition2024,
216218
}
217219

218220
impl From<EditionData> for Edition {
@@ -221,6 +223,7 @@ impl From<EditionData> for Edition {
221223
EditionData::Edition2015 => Edition::Edition2015,
222224
EditionData::Edition2018 => Edition::Edition2018,
223225
EditionData::Edition2021 => Edition::Edition2021,
226+
EditionData::Edition2024 => Edition::Edition2024,
224227
}
225228
}
226229
}

0 commit comments

Comments
 (0)