@@ -315,33 +315,20 @@ impl Build {
315315 let in_tree_llvm_info = config. in_tree_llvm_info . clone ( ) ;
316316 let in_tree_gcc_info = config. in_tree_gcc_info . clone ( ) ;
317317
318- let initial_target_libdir_str = if config. dry_run ( ) {
319- "/dummy/lib/path/to/lib/" . to_string ( )
320- } else {
321- output (
322- Command :: new ( & config. initial_rustc )
323- . arg ( "--target" )
324- . arg ( config. build . rustc_target_arg ( ) )
325- . arg ( "--print" )
326- . arg ( "target-libdir" ) ,
327- )
328- } ;
318+ let initial_target_libdir_str =
319+ config. initial_sysroot . join ( "lib/rustlib" ) . join ( config. build ) . join ( "lib" ) ;
320+
329321 let initial_target_dir = Path :: new ( & initial_target_libdir_str) . parent ( ) . unwrap ( ) ;
330322 let initial_lld = initial_target_dir. join ( "bin" ) . join ( "rust-lld" ) ;
331323
332- let initial_sysroot = if config. dry_run ( ) {
333- "/dummy" . to_string ( )
334- } else {
335- output ( Command :: new ( & config. initial_rustc ) . arg ( "--print" ) . arg ( "sysroot" ) )
336- }
337- . trim ( )
338- . to_string ( ) ;
339-
340324 // FIXME(Zalathar): Determining this path occasionally fails locally for
341325 // unknown reasons, so we print some extra context to help track down why.
342326 let find_initial_libdir = || {
343- let initial_libdir =
344- initial_target_dir. parent ( ) ?. parent ( ) ?. strip_prefix ( & initial_sysroot) . ok ( ) ?;
327+ let initial_libdir = initial_target_dir
328+ . parent ( ) ?
329+ . parent ( ) ?
330+ . strip_prefix ( & config. initial_sysroot )
331+ . ok ( ) ?;
345332 Some ( initial_libdir. to_path_buf ( ) )
346333 } ;
347334 let Some ( initial_libdir) = find_initial_libdir ( ) else {
@@ -350,7 +337,6 @@ impl Build {
350337- config.initial_rustc: {rustc:?}
351338- initial_target_libdir_str: {initial_target_libdir_str:?}
352339- initial_target_dir: {initial_target_dir:?}
353- - initial_sysroot: {initial_sysroot:?}
354340" ,
355341 rustc = config. initial_rustc,
356342 ) ;
@@ -383,11 +369,11 @@ impl Build {
383369 }
384370
385371 let mut build = Build {
386- initial_rustc : config. initial_rustc . clone ( ) ,
387- initial_cargo : config. initial_cargo . clone ( ) ,
388372 initial_lld,
389373 initial_libdir,
390- initial_sysroot : initial_sysroot. into ( ) ,
374+ initial_rustc : config. initial_rustc . clone ( ) ,
375+ initial_cargo : config. initial_cargo . clone ( ) ,
376+ initial_sysroot : config. initial_sysroot . clone ( ) ,
391377 local_rebuild : config. local_rebuild ,
392378 fail_fast : config. cmd . fail_fast ( ) ,
393379 doc_tests : config. cmd . doc_tests ( ) ,
0 commit comments