@@ -315,46 +315,19 @@ impl Build {
315
315
let in_tree_llvm_info = config. in_tree_llvm_info . clone ( ) ;
316
316
let in_tree_gcc_info = config. in_tree_gcc_info . clone ( ) ;
317
317
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
+
329
321
let initial_target_dir = Path :: new ( & initial_target_libdir_str) . parent ( ) . unwrap ( ) ;
330
322
let initial_lld = initial_target_dir. join ( "bin" ) . join ( "rust-lld" ) ;
331
323
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
-
340
- // FIXME(Zalathar): Determining this path occasionally fails locally for
341
- // unknown reasons, so we print some extra context to help track down why.
342
- let find_initial_libdir = || {
343
- let initial_libdir =
344
- initial_target_dir. parent ( ) ?. parent ( ) ?. strip_prefix ( & initial_sysroot) . ok ( ) ?;
345
- Some ( initial_libdir. to_path_buf ( ) )
346
- } ;
347
- let Some ( initial_libdir) = find_initial_libdir ( ) else {
348
- panic ! (
349
- "couldn't determine `initial_libdir`:
350
- - config.initial_rustc: {rustc:?}
351
- - initial_target_libdir_str: {initial_target_libdir_str:?}
352
- - initial_target_dir: {initial_target_dir:?}
353
- - initial_sysroot: {initial_sysroot:?}
354
- " ,
355
- rustc = config. initial_rustc,
356
- ) ;
357
- } ;
324
+ let initial_libdir = initial_target_dir
325
+ . ancestors ( )
326
+ . nth ( 2 )
327
+ . unwrap ( )
328
+ . strip_prefix ( & config. initial_sysroot )
329
+ . unwrap ( )
330
+ . to_path_buf ( ) ;
358
331
359
332
let version = std:: fs:: read_to_string ( src. join ( "src" ) . join ( "version" ) )
360
333
. expect ( "failed to read src/version" ) ;
@@ -383,11 +356,11 @@ impl Build {
383
356
}
384
357
385
358
let mut build = Build {
386
- initial_rustc : config. initial_rustc . clone ( ) ,
387
- initial_cargo : config. initial_cargo . clone ( ) ,
388
359
initial_lld,
389
360
initial_libdir,
390
- initial_sysroot : initial_sysroot. into ( ) ,
361
+ initial_rustc : config. initial_rustc . clone ( ) ,
362
+ initial_cargo : config. initial_cargo . clone ( ) ,
363
+ initial_sysroot : config. initial_sysroot . clone ( ) ,
391
364
local_rebuild : config. local_rebuild ,
392
365
fail_fast : config. cmd . fail_fast ( ) ,
393
366
doc_tests : config. cmd . doc_tests ( ) ,
0 commit comments