@@ -225,7 +225,7 @@ impl Step for StdLink {
225
225
/// output directory.
226
226
fn run ( self , builder : & Builder ) {
227
227
let compiler = self . compiler ;
228
- let target_compiler = self . target_compiler ;
228
+ let mut target_compiler = self . target_compiler ;
229
229
let target = self . target ;
230
230
builder. info ( & format ! ( "Copying stage{} std from stage{} ({} -> {} / {})" ,
231
231
target_compiler. stage,
@@ -243,6 +243,13 @@ impl Step for StdLink {
243
243
copy_apple_sanitizer_dylibs ( builder, & builder. native_dir ( target) , "osx" , & libdir) ;
244
244
}
245
245
246
+ // This is for the original compiler, but if we're forced to use stage 1, then
247
+ // std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
248
+ // we copy the libs forward.
249
+ if builder. force_use_stage1 ( target_compiler, target) {
250
+ target_compiler = builder. compiler ( 1 , target_compiler. host )
251
+ } ;
252
+
246
253
builder. cargo ( target_compiler, Mode :: ToolStd , target, "clean" ) ;
247
254
}
248
255
}
@@ -429,7 +436,7 @@ impl Step for TestLink {
429
436
/// Same as `std_link`, only for libtest
430
437
fn run ( self , builder : & Builder ) {
431
438
let compiler = self . compiler ;
432
- let target_compiler = self . target_compiler ;
439
+ let mut target_compiler = self . target_compiler ;
433
440
let target = self . target ;
434
441
builder. info ( & format ! ( "Copying stage{} test from stage{} ({} -> {} / {})" ,
435
442
target_compiler. stage,
@@ -440,6 +447,13 @@ impl Step for TestLink {
440
447
add_to_sysroot ( builder, & builder. sysroot_libdir ( target_compiler, target) ,
441
448
& libtest_stamp ( builder, compiler, target) ) ;
442
449
450
+ // This is for the original compiler, but if we're forced to use stage 1, then
451
+ // std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
452
+ // we copy the libs forward.
453
+ if builder. force_use_stage1 ( target_compiler, target) {
454
+ target_compiler = builder. compiler ( 1 , target_compiler. host )
455
+ } ;
456
+
443
457
builder. cargo ( target_compiler, Mode :: ToolTest , target, "clean" ) ;
444
458
}
445
459
}
@@ -588,7 +602,7 @@ impl Step for RustcLink {
588
602
/// Same as `std_link`, only for librustc
589
603
fn run ( self , builder : & Builder ) {
590
604
let compiler = self . compiler ;
591
- let target_compiler = self . target_compiler ;
605
+ let mut target_compiler = self . target_compiler ;
592
606
let target = self . target ;
593
607
builder. info ( & format ! ( "Copying stage{} rustc from stage{} ({} -> {} / {})" ,
594
608
target_compiler. stage,
@@ -598,6 +612,14 @@ impl Step for RustcLink {
598
612
target) ) ;
599
613
add_to_sysroot ( builder, & builder. sysroot_libdir ( target_compiler, target) ,
600
614
& librustc_stamp ( builder, compiler, target) ) ;
615
+
616
+ // This is for the original compiler, but if we're forced to use stage 1, then
617
+ // std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
618
+ // we copy the libs forward.
619
+ if builder. force_use_stage1 ( target_compiler, target) {
620
+ target_compiler = builder. compiler ( 1 , target_compiler. host )
621
+ } ;
622
+
601
623
builder. cargo ( target_compiler, Mode :: ToolRustc , target, "clean" ) ;
602
624
}
603
625
}
@@ -655,7 +677,6 @@ impl Step for CodegenBackend {
655
677
}
656
678
657
679
let out_dir = builder. cargo_out ( compiler, Mode :: Codegen , target) ;
658
- builder. clear_if_dirty ( & out_dir, & librustc_stamp ( builder, compiler, target) ) ;
659
680
660
681
let mut cargo = builder. cargo ( compiler, Mode :: Codegen , target, "rustc" ) ;
661
682
cargo. arg ( "--manifest-path" )
0 commit comments