@@ -222,17 +222,18 @@ impl Step for Cargo {
222222 compiler,
223223 target : self . host ,
224224 } ) ;
225- let mut cargo = builder. cargo ( compiler, Mode :: ToolRustc , self . host , "test" ) ;
226- cargo
227- . arg ( "--manifest-path" )
228- . arg ( builder. src . join ( "src/tools/cargo/Cargo.toml" ) ) ;
225+ let mut cargo = tool:: prepare_tool_cargo ( builder,
226+ compiler,
227+ Mode :: ToolRustc ,
228+ self . host ,
229+ "test" ,
230+ "src/tools/cargo" ,
231+ true ) ;
232+
229233 if !builder. fail_fast {
230234 cargo. arg ( "--no-fail-fast" ) ;
231235 }
232236
233- // Don't build tests dynamically, just a pain to work with
234- cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
235-
236237 // Don't run cross-compile tests, we may not have cross-compiled libstd libs
237238 // available.
238239 cargo. env ( "CFG_DISABLE_CROSS_TESTS" , "1" ) ;
@@ -289,9 +290,6 @@ impl Step for Rls {
289290 "src/tools/rls" ,
290291 true ) ;
291292
292- // Don't build tests dynamically, just a pain to work with
293- cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
294-
295293 builder. add_rustc_lib_path ( compiler, & mut cargo) ;
296294
297295 if try_run ( builder, & mut cargo) {
@@ -345,8 +343,6 @@ impl Step for Rustfmt {
345343 "src/tools/rustfmt" ,
346344 true ) ;
347345
348- // Don't build tests dynamically, just a pain to work with
349- cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
350346 let dir = testdir ( builder, compiler. host ) ;
351347 t ! ( fs:: create_dir_all( & dir) ) ;
352348 cargo. env ( "RUSTFMT_TEST_DIR" , dir) ;
@@ -394,13 +390,14 @@ impl Step for Miri {
394390 extra_features : Vec :: new ( ) ,
395391 } ) ;
396392 if let Some ( miri) = miri {
397- let mut cargo = builder. cargo ( compiler, Mode :: ToolRustc , host, "test" ) ;
398- cargo
399- . arg ( "--manifest-path" )
400- . arg ( builder. src . join ( "src/tools/miri/Cargo.toml" ) ) ;
393+ let mut cargo = tool:: prepare_tool_cargo ( builder,
394+ compiler,
395+ Mode :: ToolRustc ,
396+ host,
397+ "test" ,
398+ "src/tools/miri" ,
399+ true ) ;
401400
402- // Don't build tests dynamically, just a pain to work with
403- cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
404401 // miri tests need to know about the stage sysroot
405402 cargo. env ( "MIRI_SYSROOT" , builder. sysroot ( compiler) ) ;
406403 cargo. env ( "RUSTC_TEST_SUITE" , builder. rustc ( compiler) ) ;
@@ -452,13 +449,14 @@ impl Step for Clippy {
452449 extra_features : Vec :: new ( ) ,
453450 } ) ;
454451 if let Some ( clippy) = clippy {
455- let mut cargo = builder. cargo ( compiler, Mode :: ToolRustc , host, "test" ) ;
456- cargo
457- . arg ( "--manifest-path" )
458- . arg ( builder. src . join ( "src/tools/clippy/Cargo.toml" ) ) ;
452+ let mut cargo = tool:: prepare_tool_cargo ( builder,
453+ compiler,
454+ Mode :: ToolRustc ,
455+ host,
456+ "test" ,
457+ "src/tools/clippy" ,
458+ true ) ;
459459
460- // Don't build tests dynamically, just a pain to work with
461- cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
462460 // clippy tests need to know about the stage sysroot
463461 cargo. env ( "SYSROOT" , builder. sysroot ( compiler) ) ;
464462 cargo. env ( "RUSTC_TEST_SUITE" , builder. rustc ( compiler) ) ;
0 commit comments