@@ -118,6 +118,7 @@ pub struct Build {
118
118
ver_date : Option < String > ,
119
119
version : String ,
120
120
package_vers : String ,
121
+ local_rebuild : bool ,
121
122
bootstrap_key : String ,
122
123
bootstrap_key_stage0 : String ,
123
124
@@ -174,6 +175,7 @@ impl Build {
174
175
Some ( ref s) => PathBuf :: from ( s) ,
175
176
None => stage0_root. join ( exe ( "cargo" , & config. build ) ) ,
176
177
} ;
178
+ let local_rebuild = config. local_rebuild ;
177
179
178
180
Build {
179
181
flags : flags,
@@ -189,6 +191,7 @@ impl Build {
189
191
short_ver_hash : None ,
190
192
ver_date : None ,
191
193
version : String :: new ( ) ,
194
+ local_rebuild : local_rebuild,
192
195
bootstrap_key : String :: new ( ) ,
193
196
bootstrap_key_stage0 : String :: new ( ) ,
194
197
package_vers : String :: new ( ) ,
@@ -219,6 +222,16 @@ impl Build {
219
222
sanity:: check ( self ) ;
220
223
self . verbose ( "collecting channel variables" ) ;
221
224
channel:: collect ( self ) ;
225
+ // If local-rust is the same as the current version, then force a local-rebuild
226
+ let local_version_verbose = output (
227
+ Command :: new ( & self . rustc ) . arg ( "--version" ) . arg ( "--verbose" ) ) ;
228
+ let local_release = local_version_verbose
229
+ . lines ( ) . filter ( |x| x. starts_with ( "release:" ) )
230
+ . next ( ) . unwrap ( ) . trim_left_matches ( "release:" ) . trim ( ) ;
231
+ if local_release == self . release {
232
+ self . verbose ( & format ! ( "auto-detected local-rebuild {}" , self . release) ) ;
233
+ self . local_rebuild = true ;
234
+ }
222
235
self . verbose ( "updating submodules" ) ;
223
236
self . update_submodules ( ) ;
224
237
@@ -525,7 +538,7 @@ impl Build {
525
538
. arg ( "--target" ) . arg ( target) ;
526
539
527
540
let stage;
528
- if compiler. stage == 0 && self . config . local_rebuild {
541
+ if compiler. stage == 0 && self . local_rebuild {
529
542
// Assume the local-rebuild rustc already has stage1 features.
530
543
stage = 1 ;
531
544
} else {
@@ -766,7 +779,7 @@ impl Build {
766
779
// In stage0 we're using a previously released stable compiler, so we
767
780
// use the stage0 bootstrap key. Otherwise we use our own build's
768
781
// bootstrap key.
769
- let bootstrap_key = if compiler. is_snapshot ( self ) && !self . config . local_rebuild {
782
+ let bootstrap_key = if compiler. is_snapshot ( self ) && !self . local_rebuild {
770
783
& self . bootstrap_key_stage0
771
784
} else {
772
785
& self . bootstrap_key
0 commit comments