File tree 1 file changed +14
-2
lines changed
src/bootstrap/src/core/build_steps
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -185,8 +185,20 @@ impl Step for Std {
185
185
186
186
let mut target_deps = builder. ensure ( StartupObjects { compiler, target } ) ;
187
187
188
- let compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
189
- if compiler_to_use != compiler {
188
+ let mut compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
189
+
190
+ // We only need to build std twice; therefore,
191
+ // - If stage 2 std is built, the artifacts are fully up to date. For the next stages, uplift the artifacts instead of compiling std again.
192
+ // - If `--build-std-on-stage0` was used it means std was already built on stage 0. So, if stage 1 is built, that means std is fully up to date.
193
+ // For the next stages, uplift the artifacts instead of compiling std again.
194
+ if ( compiler. stage > 2 || builder. config . build_std_on_stage0 ) && compiler_to_use != compiler
195
+ {
196
+ // If stage 2 std was built (not uplifted), uplift the artifacts from stage 2.
197
+ // (This is necessary; without this, they will be uplifted from stage 1).
198
+ if !builder. config . build_std_on_stage0 && compiler. stage > 2 {
199
+ compiler_to_use. stage = 2 ;
200
+ }
201
+
190
202
builder. ensure ( Std :: new ( compiler_to_use, target) ) ;
191
203
let msg = if compiler_to_use. host == target {
192
204
format ! (
You can’t perform that action at this time.
0 commit comments