Add support for Rust Edition 2024

This commit is contained in:
Eric Huss 2024-06-12 15:53:56 -07:00
parent 94b922d27a
commit 1e4d4887e1
3 changed files with 7 additions and 0 deletions

View file

@ -345,6 +345,9 @@ impl MDBook {
RustEdition::E2021 => {
cmd.args(["--edition", "2021"]);
}
RustEdition::E2024 => {
cmd.args(["--edition", "2024", "-Zunstable-options"]);
}
}
}

View file

@ -504,6 +504,9 @@ pub struct RustConfig {
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
/// Rust edition to use for the code.
pub enum RustEdition {
/// The 2024 edition of Rust
#[serde(rename = "2024")]
E2024,
/// The 2021 edition of Rust
#[serde(rename = "2021")]
E2021,

View file

@ -902,6 +902,7 @@ fn add_playground_pre(
Some(RustEdition::E2015) => " edition2015",
Some(RustEdition::E2018) => " edition2018",
Some(RustEdition::E2021) => " edition2021",
Some(RustEdition::E2024) => " edition2024",
None => "",
}
};