@@ -1235,6 +1235,7 @@ impl<'a> Builder<'a> {
12351235 assert ! ( run_compiler. stage > 0 , "miri can not be invoked at stage 0" ) ;
12361236 let build_compiler = self . compiler ( run_compiler. stage - 1 , self . build . build ) ;
12371237
1238+ // Prepare the tools
12381239 let miri = self . ensure ( tool:: Miri {
12391240 compiler : build_compiler,
12401241 target : self . build . build ,
@@ -1245,7 +1246,7 @@ impl<'a> Builder<'a> {
12451246 target : self . build . build ,
12461247 extra_features : Vec :: new ( ) ,
12471248 } ) ;
1248- // Invoke cargo-miri, make sure we can find miri and cargo.
1249+ // Invoke cargo-miri, make sure it can find miri and cargo.
12491250 let mut cmd = Command :: new ( cargo_miri) ;
12501251 cmd. env ( "MIRI" , & miri) ;
12511252 cmd. env ( "CARGO" , & self . initial_cargo ) ;
@@ -1711,6 +1712,15 @@ impl<'a> Builder<'a> {
17111712 cargo. env ( "RUSTC_WRAPPER_REAL" , existing_wrapper) ;
17121713 }
17131714
1715+ // If this is for `miri-test`, prepare the sysroots.
1716+ if cmd == "miri-test" {
1717+ self . ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
1718+ let host_sysroot = self . sysroot ( compiler) ;
1719+ let miri_sysroot = test:: Miri :: build_miri_sysroot ( self , compiler, target) ;
1720+ cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
1721+ cargo. env ( "MIRI_HOST_SYSROOT" , & host_sysroot) ;
1722+ }
1723+
17141724 cargo. env ( profile_var ( "STRIP" ) , self . config . rust_strip . to_string ( ) ) ;
17151725
17161726 if let Some ( stack_protector) = & self . config . rust_stack_protector {
0 commit comments