@@ -37,11 +37,12 @@ use crate::{
37
37
debug, trace,
38
38
} ;
39
39
40
- /// Build a standard library for the given `target` using the given `compiler `.
40
+ /// Build a standard library for the given `target` using the given `build_compiler `.
41
41
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
42
42
pub struct Std {
43
43
pub target : TargetSelection ,
44
- pub compiler : Compiler ,
44
+ /// Compiler that builds the standard library.
45
+ pub build_compiler : Compiler ,
45
46
/// Whether to build only a subset of crates in the standard library.
46
47
///
47
48
/// This shouldn't be used from other steps; see the comment on [`Rustc`].
@@ -54,10 +55,10 @@ pub struct Std {
54
55
}
55
56
56
57
impl Std {
57
- pub fn new ( compiler : Compiler , target : TargetSelection ) -> Self {
58
+ pub fn new ( build_compiler : Compiler , target : TargetSelection ) -> Self {
58
59
Self {
59
60
target,
60
- compiler ,
61
+ build_compiler ,
61
62
crates : Default :: default ( ) ,
62
63
force_recompile : false ,
63
64
extra_rust_args : & [ ] ,
@@ -121,7 +122,7 @@ impl Step for Std {
121
122
trace ! ( force_recompile) ;
122
123
123
124
run. builder . ensure ( Std {
124
- compiler : run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ,
125
+ build_compiler : run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ,
125
126
target : run. target ,
126
127
crates,
127
128
force_recompile,
@@ -152,19 +153,20 @@ impl Step for Std {
152
153
let target = self . target ;
153
154
154
155
// We already have std ready to be used for stage 0.
155
- if self . compiler . stage == 0 {
156
- let compiler = self . compiler ;
156
+ if self . build_compiler . stage == 0 {
157
+ let compiler = self . build_compiler ;
157
158
builder. ensure ( StdLink :: from_std ( self , compiler) ) ;
158
159
159
160
return ;
160
161
}
161
162
162
- let compiler = if builder. download_rustc ( ) && self . force_recompile {
163
+ let build_compiler = if builder. download_rustc ( ) && self . force_recompile {
163
164
// When there are changes in the library tree with CI-rustc, we want to build
164
165
// the stageN library and that requires using stageN-1 compiler.
165
- builder. compiler ( self . compiler . stage . saturating_sub ( 1 ) , builder. config . host_target )
166
+ builder
167
+ . compiler ( self . build_compiler . stage . saturating_sub ( 1 ) , builder. config . host_target )
166
168
} else {
167
- self . compiler
169
+ self . build_compiler
168
170
} ;
169
171
170
172
// When using `download-rustc`, we already have artifacts for the host available. Don't
@@ -173,7 +175,8 @@ impl Step for Std {
173
175
&& builder. config . is_host_target ( target)
174
176
&& !self . force_recompile
175
177
{
176
- let sysroot = builder. ensure ( Sysroot { compiler, force_recompile : false } ) ;
178
+ let sysroot =
179
+ builder. ensure ( Sysroot { compiler : build_compiler, force_recompile : false } ) ;
177
180
cp_rustc_component_to_ci_sysroot (
178
181
builder,
179
182
& sysroot,
@@ -182,65 +185,70 @@ impl Step for Std {
182
185
return ;
183
186
}
184
187
185
- if builder. config . keep_stage . contains ( & compiler . stage )
186
- || builder. config . keep_stage_std . contains ( & compiler . stage )
188
+ if builder. config . keep_stage . contains ( & build_compiler . stage )
189
+ || builder. config . keep_stage_std . contains ( & build_compiler . stage )
187
190
{
188
191
trace ! ( keep_stage = ?builder. config. keep_stage) ;
189
192
trace ! ( keep_stage_std = ?builder. config. keep_stage_std) ;
190
193
191
194
builder. info ( "WARNING: Using a potentially old libstd. This may not behave well." ) ;
192
195
193
- builder. ensure ( StartupObjects { compiler, target } ) ;
196
+ builder. ensure ( StartupObjects { compiler : build_compiler , target } ) ;
194
197
195
- self . copy_extra_objects ( builder, & compiler , target) ;
198
+ self . copy_extra_objects ( builder, & build_compiler , target) ;
196
199
197
- builder. ensure ( StdLink :: from_std ( self , compiler ) ) ;
200
+ builder. ensure ( StdLink :: from_std ( self , build_compiler ) ) ;
198
201
return ;
199
202
}
200
203
201
- let mut target_deps = builder. ensure ( StartupObjects { compiler, target } ) ;
204
+ let mut target_deps = builder. ensure ( StartupObjects { compiler : build_compiler , target } ) ;
202
205
203
- let compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
206
+ let compiler_to_use =
207
+ builder. compiler_for ( build_compiler. stage , build_compiler. host , target) ;
204
208
trace ! ( ?compiler_to_use) ;
205
209
206
- if compiler_to_use != compiler
210
+ if compiler_to_use != build_compiler
207
211
// Never uplift std unless we have compiled stage 1; if stage 1 is compiled,
208
212
// uplift it from there.
209
213
//
210
214
// FIXME: improve `fn compiler_for` to avoid adding stage condition here.
211
- && compiler . stage > 1
215
+ && build_compiler . stage > 1
212
216
{
213
- trace ! ( ?compiler_to_use, ?compiler, "compiler != compiler_to_use, uplifting library" ) ;
217
+ trace ! (
218
+ ?compiler_to_use,
219
+ ?build_compiler,
220
+ "compiler != compiler_to_use, uplifting library"
221
+ ) ;
214
222
215
223
builder. std ( compiler_to_use, target) ;
216
224
let msg = if compiler_to_use. host == target {
217
225
format ! (
218
226
"Uplifting library (stage{} -> stage{})" ,
219
- compiler_to_use. stage, compiler . stage
227
+ compiler_to_use. stage, build_compiler . stage
220
228
)
221
229
} else {
222
230
format ! (
223
231
"Uplifting library (stage{}:{} -> stage{}:{})" ,
224
- compiler_to_use. stage, compiler_to_use. host, compiler . stage, target
232
+ compiler_to_use. stage, compiler_to_use. host, build_compiler . stage, target
225
233
)
226
234
} ;
227
235
builder. info ( & msg) ;
228
236
229
237
// Even if we're not building std this stage, the new sysroot must
230
238
// still contain the third party objects needed by various targets.
231
- self . copy_extra_objects ( builder, & compiler , target) ;
239
+ self . copy_extra_objects ( builder, & build_compiler , target) ;
232
240
233
241
builder. ensure ( StdLink :: from_std ( self , compiler_to_use) ) ;
234
242
return ;
235
243
}
236
244
237
245
trace ! (
238
246
?compiler_to_use,
239
- ?compiler ,
247
+ ?build_compiler ,
240
248
"compiler == compiler_to_use, handling not-cross-compile scenario"
241
249
) ;
242
250
243
- target_deps. extend ( self . copy_extra_objects ( builder, & compiler , target) ) ;
251
+ target_deps. extend ( self . copy_extra_objects ( builder, & build_compiler , target) ) ;
244
252
245
253
// We build a sysroot for mir-opt tests using the same trick that Miri does: A check build
246
254
// with -Zalways-encode-mir. This frees us from the need to have a target linker, and the
@@ -249,7 +257,7 @@ impl Step for Std {
249
257
trace ! ( "building special sysroot for mir-opt tests" ) ;
250
258
let mut cargo = builder:: Cargo :: new_for_mir_opt_tests (
251
259
builder,
252
- compiler ,
260
+ build_compiler ,
253
261
Mode :: Std ,
254
262
SourceType :: InTree ,
255
263
target,
@@ -262,7 +270,7 @@ impl Step for Std {
262
270
trace ! ( "building regular sysroot" ) ;
263
271
let mut cargo = builder:: Cargo :: new (
264
272
builder,
265
- compiler ,
273
+ build_compiler ,
266
274
Mode :: Std ,
267
275
SourceType :: InTree ,
268
276
target,
@@ -285,29 +293,29 @@ impl Step for Std {
285
293
286
294
let _guard = builder. msg (
287
295
Kind :: Build ,
288
- compiler . stage ,
296
+ build_compiler . stage ,
289
297
format_args ! ( "library artifacts{}" , crate_description( & self . crates) ) ,
290
- compiler . host ,
298
+ build_compiler . host ,
291
299
target,
292
300
) ;
293
301
run_cargo (
294
302
builder,
295
303
cargo,
296
304
vec ! [ ] ,
297
- & build_stamp:: libstd_stamp ( builder, compiler , target) ,
305
+ & build_stamp:: libstd_stamp ( builder, build_compiler , target) ,
298
306
target_deps,
299
307
self . is_for_mir_opt_tests , // is_check
300
308
false ,
301
309
) ;
302
310
303
311
builder. ensure ( StdLink :: from_std (
304
312
self ,
305
- builder. compiler ( compiler . stage , builder. config . host_target ) ,
313
+ builder. compiler ( build_compiler . stage , builder. config . host_target ) ,
306
314
) ) ;
307
315
}
308
316
309
317
fn metadata ( & self ) -> Option < StepMetadata > {
310
- Some ( StepMetadata :: build ( "std" , self . target ) . built_by ( self . compiler ) )
318
+ Some ( StepMetadata :: build ( "std" , self . target ) . built_by ( self . build_compiler ) )
311
319
}
312
320
}
313
321
@@ -688,7 +696,7 @@ impl StdLink {
688
696
pub fn from_std ( std : Std , host_compiler : Compiler ) -> Self {
689
697
Self {
690
698
compiler : host_compiler,
691
- target_compiler : std. compiler ,
699
+ target_compiler : std. build_compiler ,
692
700
target : std. target ,
693
701
crates : std. crates ,
694
702
force_recompile : std. force_recompile ,
0 commit comments