@@ -510,6 +510,14 @@ impl Build {
510510 . arg ( "-j" ) . arg ( self . jobs ( ) . to_string ( ) )
511511 . arg ( "--target" ) . arg ( target) ;
512512
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+
513521 // Customize the compiler we're running. Specify the compiler to cargo
514522 // as our shim and then pass it some various options used to configure
515523 // how the actual compiler itself is called.
@@ -518,7 +526,7 @@ impl Build {
518526 // src/bootstrap/{rustc,rustdoc.rs}
519527 cargo. env ( "RUSTC" , self . out . join ( "bootstrap/debug/rustc" ) )
520528 . env ( "RUSTC_REAL" , self . compiler_path ( compiler) )
521- . env ( "RUSTC_STAGE" , compiler . stage . to_string ( ) )
529+ . env ( "RUSTC_STAGE" , stage. to_string ( ) )
522530 . env ( "RUSTC_DEBUGINFO" , self . config . rust_debuginfo . to_string ( ) )
523531 . env ( "RUSTC_CODEGEN_UNITS" ,
524532 self . config . rust_codegen_units . to_string ( ) )
@@ -744,7 +752,7 @@ impl Build {
744752 // In stage0 we're using a previously released stable compiler, so we
745753 // use the stage0 bootstrap key. Otherwise we use our own build's
746754 // bootstrap key.
747- let bootstrap_key = if compiler. is_snapshot ( self ) {
755+ let bootstrap_key = if compiler. is_snapshot ( self ) && ! self . config . rebuild {
748756 & self . bootstrap_key_stage0
749757 } else {
750758 & self . bootstrap_key
0 commit comments