Skip to content

Commit f461997

Browse files
committed
Rename build to host_target
Host is the machine where bootstrap runs, and this field represents the target of the (host) stage0/beta compiler. This is much clearer than `build`, which also conflicts with the `Build` struct, which is stored under the name `build` inside `Builder` (lol).
1 parent 40daf23 commit f461997

File tree

31 files changed

+326
-314
lines changed

31 files changed

+326
-314
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Step for Std {
8989
let stage = self.custom_stage.unwrap_or(builder.top_stage);
9090

9191
let target = self.target;
92-
let compiler = builder.compiler(stage, builder.config.build);
92+
let compiler = builder.compiler(stage, builder.config.host_target);
9393

9494
if stage == 0 {
9595
let mut is_explicitly_called =
@@ -244,7 +244,7 @@ impl Step for Rustc {
244244
/// the `compiler` targeting the `target` architecture. The artifacts
245245
/// created will also be linked into the sysroot directory.
246246
fn run(self, builder: &Builder<'_>) {
247-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
247+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
248248
let target = self.target;
249249

250250
if compiler.stage != 0 {
@@ -327,7 +327,7 @@ impl Step for CodegenBackend {
327327
return;
328328
}
329329

330-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
330+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
331331
let target = self.target;
332332
let backend = self.backend;
333333

@@ -382,7 +382,7 @@ impl Step for RustAnalyzer {
382382
}
383383

384384
fn run(self, builder: &Builder<'_>) {
385-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
385+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
386386
let target = self.target;
387387

388388
builder.ensure(Rustc::new(target, builder));
@@ -448,7 +448,7 @@ impl Step for Compiletest {
448448

449449
let compiler = builder.compiler(
450450
if mode == Mode::ToolBootstrap { 0 } else { builder.top_stage },
451-
builder.config.build,
451+
builder.config.host_target,
452452
);
453453

454454
if mode != Mode::ToolBootstrap {
@@ -527,7 +527,7 @@ fn run_tool_check_step(
527527
path: &str,
528528
) {
529529
let display_name = path.rsplit('/').next().unwrap();
530-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
530+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
531531

532532
builder.ensure(Rustc::new(target, builder));
533533

@@ -614,7 +614,7 @@ impl Step for CoverageDump {
614614
// Make sure we haven't forgotten any fields, if there are any.
615615
let Self {} = self;
616616
let display_name = "coverage-dump";
617-
let host = builder.config.build;
617+
let host = builder.config.host_target;
618618
let target = host;
619619
let mode = Mode::ToolBootstrap;
620620

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl Step for Std {
144144
builder.require_submodule("library/stdarch", None);
145145

146146
let target = self.target;
147-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
147+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
148148

149149
let mut cargo = builder::Cargo::new(
150150
builder,
@@ -204,7 +204,7 @@ impl Step for Rustc {
204204
/// This will lint the compiler for a particular stage of the build using
205205
/// the `compiler` targeting the `target` architecture.
206206
fn run(self, builder: &Builder<'_>) {
207-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
207+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
208208
let target = self.target;
209209

210210
if !builder.download_rustc() {
@@ -285,7 +285,7 @@ macro_rules! lint_any {
285285
}
286286

287287
fn run(self, builder: &Builder<'_>) -> Self::Output {
288-
let compiler = builder.compiler(builder.top_stage, builder.config.build);
288+
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
289289
let target = self.target;
290290

291291
if !builder.download_rustc() {

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Step for Std {
159159
let compiler = if builder.download_rustc() && self.force_recompile {
160160
// When there are changes in the library tree with CI-rustc, we want to build
161161
// the stageN library and that requires using stageN-1 compiler.
162-
builder.compiler(self.compiler.stage.saturating_sub(1), builder.config.build)
162+
builder.compiler(self.compiler.stage.saturating_sub(1), builder.config.host_target)
163163
} else {
164164
self.compiler
165165
};
@@ -301,7 +301,7 @@ impl Step for Std {
301301

302302
builder.ensure(StdLink::from_std(
303303
self,
304-
builder.compiler(compiler.stage, builder.config.build),
304+
builder.compiler(compiler.stage, builder.config.host_target),
305305
));
306306
}
307307
}
@@ -1084,8 +1084,8 @@ impl Step for Rustc {
10841084

10851085
// Ensure that build scripts and proc macros have a std / libproc_macro to link against.
10861086
builder.ensure(Std::new(
1087-
builder.compiler(self.compiler.stage, builder.config.build),
1088-
builder.config.build,
1087+
builder.compiler(self.compiler.stage, builder.config.host_target),
1088+
builder.config.host_target,
10891089
));
10901090

10911091
let mut cargo = builder::Cargo::new(
@@ -1150,7 +1150,7 @@ impl Step for Rustc {
11501150

11511151
builder.ensure(RustcLink::from_rustc(
11521152
self,
1153-
builder.compiler(compiler.stage, builder.config.build),
1153+
builder.compiler(compiler.stage, builder.config.host_target),
11541154
));
11551155

11561156
compiler.stage
@@ -1190,11 +1190,11 @@ pub fn rustc_cargo(
11901190
// We want to link against registerEnzyme and in the future we want to use additional
11911191
// functionality from Enzyme core. For that we need to link against Enzyme.
11921192
if builder.config.llvm_enzyme {
1193-
let arch = builder.build.build;
1193+
let arch = builder.build.host_target;
11941194
let enzyme_dir = builder.build.out.join(arch).join("enzyme").join("lib");
11951195
cargo.rustflag("-L").rustflag(enzyme_dir.to_str().expect("Invalid path"));
11961196

1197-
if let Some(llvm_config) = builder.llvm_config(builder.config.build) {
1197+
if let Some(llvm_config) = builder.llvm_config(builder.config.host_target) {
11981198
let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
11991199
cargo.rustflag("-l").rustflag(&format!("Enzyme-{llvm_version_major}"));
12001200
}
@@ -1813,7 +1813,7 @@ impl Step for Sysroot {
18131813
// If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0.
18141814
if builder.download_rustc() && compiler.stage != 0 {
18151815
assert_eq!(
1816-
builder.config.build, compiler.host,
1816+
builder.config.host_target, compiler.host,
18171817
"Cross-compiling is not yet supported with `download-rustc`",
18181818
);
18191819

@@ -1967,7 +1967,7 @@ impl Step for Assemble {
19671967
if target_compiler.stage == 0 {
19681968
trace!("stage 0 build compiler is always available, simply returning");
19691969
assert_eq!(
1970-
builder.config.build, target_compiler.host,
1970+
builder.config.host_target, target_compiler.host,
19711971
"Cannot obtain compiler for non-native build triple at stage 0"
19721972
);
19731973
// The stage 0 compiler for the build triple is always pre-built.
@@ -2080,15 +2080,16 @@ impl Step for Assemble {
20802080
debug!(
20812081
"ensuring build compiler is available: compiler(stage = {}, host = {:?})",
20822082
target_compiler.stage - 1,
2083-
builder.config.build,
2083+
builder.config.host_target,
20842084
);
2085-
let mut build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
2085+
let mut build_compiler =
2086+
builder.compiler(target_compiler.stage - 1, builder.config.host_target);
20862087

20872088
// Build enzyme
20882089
if builder.config.llvm_enzyme && !builder.config.dry_run() {
20892090
debug!("`llvm_enzyme` requested");
20902091
let enzyme_install = builder.ensure(llvm::Enzyme { target: build_compiler.host });
2091-
let llvm_config = builder.llvm_config(builder.config.build).unwrap();
2092+
let llvm_config = builder.llvm_config(builder.config.host_target).unwrap();
20922093
let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
20932094
let lib_ext = std::env::consts::DLL_EXTENSION;
20942095
let libenzyme = format!("libEnzyme-{llvm_version_major}");

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl Step for Rustc {
422422
}
423423

424424
let ra_proc_macro_srv_compiler =
425-
builder.compiler_for(compiler.stage, builder.config.build, compiler.host);
425+
builder.compiler_for(compiler.stage, builder.config.host_target, compiler.host);
426426
builder.ensure(compile::Rustc::new(ra_proc_macro_srv_compiler, compiler.host));
427427

428428
if let Some(ra_proc_macro_srv) = builder.ensure_if_default(
@@ -696,7 +696,7 @@ impl Step for Std {
696696
run.builder.ensure(Std {
697697
compiler: run.builder.compiler_for(
698698
run.builder.top_stage,
699-
run.builder.config.build,
699+
run.builder.config.host_target,
700700
run.target,
701701
),
702702
target: run.target,
@@ -748,7 +748,7 @@ impl Step for RustcDev {
748748
run.builder.ensure(RustcDev {
749749
compiler: run.builder.compiler_for(
750750
run.builder.top_stage,
751-
run.builder.config.build,
751+
run.builder.config.host_target,
752752
run.target,
753753
),
754754
target: run.target,
@@ -815,7 +815,7 @@ impl Step for Analysis {
815815
// through the sysroot uplifting.
816816
compiler: run.builder.compiler_for(
817817
run.builder.top_stage,
818-
run.builder.config.build,
818+
run.builder.config.host_target,
819819
run.target,
820820
),
821821
target: run.target,
@@ -1168,7 +1168,7 @@ impl Step for Cargo {
11681168
run.builder.ensure(Cargo {
11691169
compiler: run.builder.compiler_for(
11701170
run.builder.top_stage,
1171-
run.builder.config.build,
1171+
run.builder.config.host_target,
11721172
run.target,
11731173
),
11741174
target: run.target,
@@ -1224,7 +1224,7 @@ impl Step for RustAnalyzer {
12241224
run.builder.ensure(RustAnalyzer {
12251225
compiler: run.builder.compiler_for(
12261226
run.builder.top_stage,
1227-
run.builder.config.build,
1227+
run.builder.config.host_target,
12281228
run.target,
12291229
),
12301230
target: run.target,
@@ -1268,7 +1268,7 @@ impl Step for Clippy {
12681268
run.builder.ensure(Clippy {
12691269
compiler: run.builder.compiler_for(
12701270
run.builder.top_stage,
1271-
run.builder.config.build,
1271+
run.builder.config.host_target,
12721272
run.target,
12731273
),
12741274
target: run.target,
@@ -1317,7 +1317,7 @@ impl Step for Miri {
13171317
run.builder.ensure(Miri {
13181318
compiler: run.builder.compiler_for(
13191319
run.builder.top_stage,
1320-
run.builder.config.build,
1320+
run.builder.config.host_target,
13211321
run.target,
13221322
),
13231323
target: run.target,
@@ -1462,7 +1462,7 @@ impl Step for Rustfmt {
14621462
run.builder.ensure(Rustfmt {
14631463
compiler: run.builder.compiler_for(
14641464
run.builder.top_stage,
1465-
run.builder.config.build,
1465+
run.builder.config.host_target,
14661466
run.target,
14671467
),
14681468
target: run.target,
@@ -1507,7 +1507,7 @@ impl Step for Extended {
15071507
fn make_run(run: RunConfig<'_>) {
15081508
run.builder.ensure(Extended {
15091509
stage: run.builder.top_stage,
1510-
host: run.builder.config.build,
1510+
host: run.builder.config.host_target,
15111511
target: run.target,
15121512
});
15131513
}
@@ -2156,7 +2156,7 @@ fn maybe_install_llvm(
21562156
cmd.arg("--libfiles");
21572157
builder.verbose(|| println!("running {cmd:?}"));
21582158
let files = cmd.run_capture_stdout(builder).stdout();
2159-
let build_llvm_out = &builder.llvm_out(builder.config.build);
2159+
let build_llvm_out = &builder.llvm_out(builder.config.host_target);
21602160
let target_llvm_out = &builder.llvm_out(target);
21612161
for file in files.trim_end().split(' ') {
21622162
// If we're not using a custom LLVM, make sure we package for the target.
@@ -2340,7 +2340,7 @@ impl Step for LlvmBitcodeLinker {
23402340
run.builder.ensure(LlvmBitcodeLinker {
23412341
compiler: run.builder.compiler_for(
23422342
run.builder.top_stage,
2343-
run.builder.config.build,
2343+
run.builder.config.host_target,
23442344
run.target,
23452345
),
23462346
target: run.target,

src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl Step for TheBook {
209209

210210
fn make_run(run: RunConfig<'_>) {
211211
run.builder.ensure(TheBook {
212-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
212+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
213213
target: run.target,
214214
});
215215
}
@@ -329,7 +329,7 @@ impl Step for Standalone {
329329

330330
fn make_run(run: RunConfig<'_>) {
331331
run.builder.ensure(Standalone {
332-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
332+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
333333
target: run.target,
334334
});
335335
}
@@ -431,7 +431,7 @@ impl Step for Releases {
431431

432432
fn make_run(run: RunConfig<'_>) {
433433
run.builder.ensure(Releases {
434-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
434+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
435435
target: run.target,
436436
});
437437
}
@@ -449,7 +449,7 @@ impl Step for Releases {
449449
t!(fs::create_dir_all(&out));
450450

451451
builder.ensure(Standalone {
452-
compiler: builder.compiler(builder.top_stage, builder.config.build),
452+
compiler: builder.compiler(builder.top_stage, builder.config.host_target),
453453
target,
454454
});
455455

@@ -700,7 +700,7 @@ fn doc_std(
700700
extra_args: &[&str],
701701
requested_crates: &[String],
702702
) {
703-
let compiler = builder.compiler(stage, builder.config.build);
703+
let compiler = builder.compiler(stage, builder.config.host_target);
704704

705705
let target_doc_dir_name = if format == DocumentationFormat::Json { "json-doc" } else { "doc" };
706706
let target_dir = builder.stage_out(compiler, Mode::Std).join(target).join(target_doc_dir_name);
@@ -803,8 +803,8 @@ impl Step for Rustc {
803803

804804
// Build the standard library, so that proc-macros can use it.
805805
// (Normally, only the metadata would be necessary, but proc-macros are special since they run at compile-time.)
806-
let compiler = builder.compiler(stage, builder.config.build);
807-
builder.ensure(compile::Std::new(compiler, builder.config.build));
806+
let compiler = builder.compiler(stage, builder.config.host_target);
807+
builder.ensure(compile::Std::new(compiler, builder.config.host_target));
808808

809809
let _guard = builder.msg_sysroot_tool(
810810
Kind::Doc,
@@ -946,7 +946,7 @@ macro_rules! tool_doc {
946946
let out = builder.compiler_doc_out(target);
947947
t!(fs::create_dir_all(&out));
948948

949-
let compiler = builder.compiler(stage, builder.config.build);
949+
let compiler = builder.compiler(stage, builder.config.host_target);
950950
builder.ensure(compile::Std::new(compiler, target));
951951

952952
if true $(&& $rustc_tool)? {
@@ -1174,7 +1174,7 @@ impl Step for RustcBook {
11741174

11751175
fn make_run(run: RunConfig<'_>) {
11761176
run.builder.ensure(RustcBook {
1177-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
1177+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
11781178
target: run.target,
11791179
validate: false,
11801180
});
@@ -1261,7 +1261,7 @@ impl Step for Reference {
12611261

12621262
fn make_run(run: RunConfig<'_>) {
12631263
run.builder.ensure(Reference {
1264-
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
1264+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
12651265
target: run.target,
12661266
});
12671267
}
@@ -1272,7 +1272,7 @@ impl Step for Reference {
12721272

12731273
// This is needed for generating links to the standard library using
12741274
// the mdbook-spec plugin.
1275-
builder.ensure(compile::Std::new(self.compiler, builder.config.build));
1275+
builder.ensure(compile::Std::new(self.compiler, builder.config.host_target));
12761276

12771277
// Run rustbook/mdbook to generate the HTML pages.
12781278
builder.ensure(RustbookSrc {

src/bootstrap/src/core/build_steps/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub fn add_cg_gcc_cargo_flags(cargo: &mut Cargo, gcc: &GccOutput) {
285285
/// The absolute path to the downloaded GCC artifacts.
286286
#[cfg(not(test))]
287287
fn ci_gcc_root(config: &crate::Config) -> PathBuf {
288-
config.out.join(config.build).join("ci-gcc")
288+
config.out.join(config.host_target).join("ci-gcc")
289289
}
290290

291291
/// Detect whether GCC sources have been modified locally or not.

0 commit comments

Comments
 (0)