@@ -8,6 +8,9 @@ use std::path::Path;
88use std:: process:: Command ;
99use tracing:: info;
1010
11+ const EDITION : & str = "2021" ;
12+ const NIGHTLY : & str = "nightly-2025-06-01" ;
13+
1114fn dump_lib ( ) -> anyhow:: Result < ( ) > {
1215 let path_iterator = glob ( "*.rs" ) . context ( "globbing test sources" ) ?;
1316 let paths = path_iterator
@@ -29,8 +32,11 @@ enum TestCargoManifest<'a> {
2932 uses_proc_macro : bool ,
3033 uses_main : bool ,
3134 dependencies : & ' a [ String ] ,
35+ edition : & ' a str ,
36+ } ,
37+ Macro {
38+ edition : & ' a str ,
3239 } ,
33- Macro { } ,
3440}
3541
3642impl TestCargoManifest < ' _ > {
@@ -56,16 +62,26 @@ fn dump_cargo_manifest(dependencies: &[String]) -> anyhow::Result<()> {
5662 uses_proc_macro,
5763 uses_main : fs:: exists ( "main.rs" ) . context ( "checking existence of main.rs" ) ?,
5864 dependencies,
65+ edition : EDITION ,
5966 } ;
6067 if uses_proc_macro {
6168 TestCargoManifest :: Workspace { } . dump ( "" ) ?;
6269 lib_manifest. dump ( ".lib" ) ?;
63- TestCargoManifest :: Macro { } . dump ( ".proc_macro" )
70+ TestCargoManifest :: Macro { edition : EDITION } . dump ( ".proc_macro" )
6471 } else {
6572 lib_manifest. dump ( "" )
6673 }
6774}
6875
76+ fn dump_nightly_toolchain ( ) -> anyhow:: Result < ( ) > {
77+ fs:: write (
78+ "rust-toolchain.toml" ,
79+ format ! ( "[toolchain]\n channel = \" {NIGHTLY}\" \n " ) ,
80+ )
81+ . context ( "writing rust-toolchain.toml" ) ?;
82+ Ok ( ( ) )
83+ }
84+
6985fn set_sources ( config : & mut Config ) -> anyhow:: Result < ( ) > {
7086 let path_iterator = glob ( "**/*.rs" ) . context ( "globbing test sources" ) ?;
7187 config. inputs = path_iterator
@@ -79,6 +95,9 @@ pub(crate) fn prepare(config: &mut Config) -> anyhow::Result<()> {
7995 dump_lib ( ) ?;
8096 set_sources ( config) ?;
8197 dump_cargo_manifest ( & config. qltest_dependencies ) ?;
98+ if config. qltest_use_nightly {
99+ dump_nightly_toolchain ( ) ?;
100+ }
82101 if config. qltest_cargo_check {
83102 let status = Command :: new ( "cargo" )
84103 . env ( "RUSTFLAGS" , "-Awarnings" )
0 commit comments