@@ -91,17 +91,24 @@ pub enum Edition {
9191 Rust2015 ,
9292 Rust2018 ,
9393 Rust2021 ,
94+ Rust2024 ,
9495}
9596
9697impl Edition {
9798 #[ cfg( test) ]
98- pub ( crate ) const ALL : [ Self ; 3 ] = [ Self :: Rust2015 , Self :: Rust2018 , Self :: Rust2021 ] ;
99+ pub ( crate ) const ALL : [ Self ; 4 ] = [
100+ Self :: Rust2015 ,
101+ Self :: Rust2018 ,
102+ Self :: Rust2021 ,
103+ Self :: Rust2024 ,
104+ ] ;
99105
100106 pub ( crate ) fn to_str ( self ) -> & ' static str {
101107 match self {
102108 Edition :: Rust2015 => "2015" ,
103109 Edition :: Rust2018 => "2018" ,
104110 Edition :: Rust2021 => "2021" ,
111+ Edition :: Rust2024 => "2024" ,
105112 }
106113 }
107114
@@ -221,6 +228,10 @@ impl ExecuteRequest {
221228
222229impl CargoTomlModifier for ExecuteRequest {
223230 fn modify_cargo_toml ( & self , mut cargo_toml : toml:: Value ) -> toml:: Value {
231+ if self . edition == Edition :: Rust2024 {
232+ cargo_toml = modify_cargo_toml:: set_feature_edition2024 ( cargo_toml) ;
233+ }
234+
224235 cargo_toml = modify_cargo_toml:: set_edition ( cargo_toml, self . edition . to_cargo_toml_key ( ) ) ;
225236
226237 if let Some ( crate_type) = self . crate_type . to_library_cargo_toml_key ( ) {
@@ -321,6 +332,10 @@ impl CompileRequest {
321332
322333impl CargoTomlModifier for CompileRequest {
323334 fn modify_cargo_toml ( & self , mut cargo_toml : toml:: Value ) -> toml:: Value {
335+ if self . edition == Edition :: Rust2024 {
336+ cargo_toml = modify_cargo_toml:: set_feature_edition2024 ( cargo_toml) ;
337+ }
338+
324339 cargo_toml = modify_cargo_toml:: set_edition ( cargo_toml, self . edition . to_cargo_toml_key ( ) ) ;
325340
326341 if let Some ( crate_type) = self . crate_type . to_library_cargo_toml_key ( ) {
@@ -1526,8 +1541,16 @@ mod tests {
15261541 #[ snafu:: report]
15271542 async fn execute_edition ( ) -> Result < ( ) > {
15281543 let params = [
1529- ( r#"fn x() { let dyn = true; }"# , [ true , false , false ] ) ,
1530- ( r#"fn x() { u16::try_from(1u8); }"# , [ false , false , true ] ) ,
1544+ ( r#"fn x() { let dyn = true; }"# , [ true , false , false , false ] ) ,
1545+ (
1546+ r#"fn x() { u16::try_from(1u8); }"# ,
1547+ [ false , false , true , true ] ,
1548+ ) ,
1549+ (
1550+ r#"#![feature(gen_blocks)]
1551+ fn x() { gen { yield 1u8 }; }"# ,
1552+ [ false , false , false , true ] ,
1553+ ) ,
15311554 ] ;
15321555
15331556 let tests = params. into_iter ( ) . flat_map ( |( code, works_in) | {
0 commit comments