@@ -203,51 +203,31 @@ impl Step for Std {
203203
204204 let mut target_deps = builder. ensure ( StartupObjects { compiler : build_compiler, target } ) ;
205205
206- let compiler_to_use =
207- builder. compiler_for ( build_compiler. stage , build_compiler. host , target) ;
208- trace ! ( ?compiler_to_use) ;
209-
210- if compiler_to_use != build_compiler
211- // Never uplift std unless we have compiled stage 1; if stage 1 is compiled,
212- // uplift it from there.
213- //
214- // FIXME: improve `fn compiler_for` to avoid adding stage condition here.
215- && build_compiler. stage > 1
206+ // Stage of the stdlib that we're building
207+ let stage = build_compiler. stage ;
208+
209+ // If we're building a stage2+ libstd, full bootstrap is
210+ // disabled and we're not cross-compiling, then simply uplift a previously built
211+ // stage1 library.
212+ if build_compiler. stage > 1
213+ && !builder. config . full_bootstrap
214+ && target == builder. host_target
216215 {
217- trace ! (
218- ?compiler_to_use,
219- ?build_compiler,
220- "compiler != compiler_to_use, uplifting library"
221- ) ;
222-
223- builder. std ( compiler_to_use, target) ;
224- let msg = if compiler_to_use. host == target {
225- format ! (
226- "Uplifting library (stage{} -> stage{})" ,
227- compiler_to_use. stage, build_compiler. stage
228- )
229- } else {
230- format ! (
231- "Uplifting library (stage{}:{} -> stage{}:{})" ,
232- compiler_to_use. stage, compiler_to_use. host, build_compiler. stage, target
233- )
234- } ;
235- builder. info ( & msg) ;
216+ let build_compiler_for_std_to_uplift = builder. compiler ( 1 , builder. host_target ) ;
217+ builder. std ( build_compiler_for_std_to_uplift, target) ;
218+ builder. info ( & format ! (
219+ "Uplifting library (stage{} -> stage{stage})" ,
220+ build_compiler_for_std_to_uplift. stage
221+ ) ) ;
236222
237223 // Even if we're not building std this stage, the new sysroot must
238224 // still contain the third party objects needed by various targets.
239225 self . copy_extra_objects ( builder, & build_compiler, target) ;
240226
241- builder. ensure ( StdLink :: from_std ( self , compiler_to_use ) ) ;
227+ builder. ensure ( StdLink :: from_std ( self , build_compiler_for_std_to_uplift ) ) ;
242228 return ;
243229 }
244230
245- trace ! (
246- ?compiler_to_use,
247- ?build_compiler,
248- "compiler == compiler_to_use, handling not-cross-compile scenario"
249- ) ;
250-
251231 target_deps. extend ( self . copy_extra_objects ( builder, & build_compiler, target) ) ;
252232
253233 // We build a sysroot for mir-opt tests using the same trick that Miri does: A check build
0 commit comments