@@ -510,6 +510,14 @@ impl Build {
510
510
. arg ( "-j" ) . arg ( self . jobs ( ) . to_string ( ) )
511
511
. arg ( "--target" ) . arg ( target) ;
512
512
513
+ let stage;
514
+ if compiler. stage == 0 && self . config . rebuild {
515
+ // Assume the local-rebuild rustc already has stage1 features.
516
+ stage = 1 ;
517
+ } else {
518
+ stage = compiler. stage ;
519
+ }
520
+
513
521
// Customize the compiler we're running. Specify the compiler to cargo
514
522
// as our shim and then pass it some various options used to configure
515
523
// how the actual compiler itself is called.
@@ -518,7 +526,7 @@ impl Build {
518
526
// src/bootstrap/{rustc,rustdoc.rs}
519
527
cargo. env ( "RUSTC" , self . out . join ( "bootstrap/debug/rustc" ) )
520
528
. env ( "RUSTC_REAL" , self . compiler_path ( compiler) )
521
- . env ( "RUSTC_STAGE" , compiler . stage . to_string ( ) )
529
+ . env ( "RUSTC_STAGE" , stage. to_string ( ) )
522
530
. env ( "RUSTC_DEBUGINFO" , self . config . rust_debuginfo . to_string ( ) )
523
531
. env ( "RUSTC_CODEGEN_UNITS" ,
524
532
self . config . rust_codegen_units . to_string ( ) )
@@ -744,7 +752,7 @@ impl Build {
744
752
// In stage0 we're using a previously released stable compiler, so we
745
753
// use the stage0 bootstrap key. Otherwise we use our own build's
746
754
// bootstrap key.
747
- let bootstrap_key = if compiler. is_snapshot ( self ) {
755
+ let bootstrap_key = if compiler. is_snapshot ( self ) && ! self . config . rebuild {
748
756
& self . bootstrap_key_stage0
749
757
} else {
750
758
& self . bootstrap_key
0 commit comments