about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-12 03:14:53 +0200
committerGitHub <noreply@github.com>2025-06-12 03:14:53 +0200
commitbb9dda1272d30ec6a3fbc04ab6abbb8f57fa6eab (patch)
treee560c1b6cd276f1b22c3e93d3ed9876852bb79b7 /src/bootstrap
parent75c186bf43167618b7e13c8ddf47b30918bb2721 (diff)
parent20e83257daea7cb5a683b49f88e74777a79f3f28 (diff)
downloadrust-bb9dda1272d30ec6a3fbc04ab6abbb8f57fa6eab.tar.gz
rust-bb9dda1272d30ec6a3fbc04ab6abbb8f57fa6eab.zip
Rollup merge of #142303 - Kobzol:bootstrap-cleanup-1, r=jieyouxu
Assorted bootstrap cleanups (step 1)

Now that the stage0 redesign has landed, we can finally start cleaning up many things in bootstrap, and lord knows it deserves it! I plan to send many PRs once I figure out an incremental way forward, this is the first one of them. It doesn't actually change anything, just renames stuff and adds more documentation, but the rename is bitrotty, so I wanted to push the PR eagerly.

r? `@jieyouxu`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs14
-rw-r--r--src/bootstrap/src/core/build_steps/clippy.rs6
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs119
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs24
-rw-r--r--src/bootstrap/src/core/build_steps/doc.rs22
-rw-r--r--src/bootstrap/src/core/build_steps/gcc.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/install.rs6
-rw-r--r--src/bootstrap/src/core/build_steps/llvm.rs26
-rw-r--r--src/bootstrap/src/core/build_steps/perf.rs8
-rw-r--r--src/bootstrap/src/core/build_steps/run.rs4
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs43
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs32
-rw-r--r--src/bootstrap/src/core/builder/mod.rs20
-rw-r--r--src/bootstrap/src/core/builder/tests.rs18
-rw-r--r--src/bootstrap/src/core/config/config.rs36
-rw-r--r--src/bootstrap/src/core/config/flags.rs2
-rw-r--r--src/bootstrap/src/core/config/toml/mod.rs2
-rw-r--r--src/bootstrap/src/core/config/toml/rust.rs6
-rw-r--r--src/bootstrap/src/core/config/toml/target.rs2
-rw-r--r--src/bootstrap/src/core/download.rs18
-rw-r--r--src/bootstrap/src/core/sanity.rs10
-rw-r--r--src/bootstrap/src/lib.rs28
-rw-r--r--src/bootstrap/src/utils/cc_detect.rs6
-rw-r--r--src/bootstrap/src/utils/cc_detect/tests.rs2
25 files changed, 243 insertions, 215 deletions
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index 911a51b0e16..f47873590a1 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -89,7 +89,7 @@ impl Step for Std {
         let stage = self.custom_stage.unwrap_or(builder.top_stage);
 
         let target = self.target;
-        let compiler = builder.compiler(stage, builder.config.build);
+        let compiler = builder.compiler(stage, builder.config.host_target);
 
         if stage == 0 {
             let mut is_explicitly_called =
@@ -244,7 +244,7 @@ impl Step for Rustc {
     /// the `compiler` targeting the `target` architecture. The artifacts
     /// created will also be linked into the sysroot directory.
     fn run(self, builder: &Builder<'_>) {
-        let compiler = builder.compiler(builder.top_stage, builder.config.build);
+        let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
         let target = self.target;
 
         if compiler.stage != 0 {
@@ -327,7 +327,7 @@ impl Step for CodegenBackend {
             return;
         }
 
-        let compiler = builder.compiler(builder.top_stage, builder.config.build);
+        let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
         let target = self.target;
         let backend = self.backend;
 
@@ -382,7 +382,7 @@ impl Step for RustAnalyzer {
     }
 
     fn run(self, builder: &Builder<'_>) {
-        let compiler = builder.compiler(builder.top_stage, builder.config.build);
+        let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
         let target = self.target;
 
         builder.ensure(Rustc::new(target, builder));
@@ -448,7 +448,7 @@ impl Step for Compiletest {
 
         let compiler = builder.compiler(
             if mode == Mode::ToolBootstrap { 0 } else { builder.top_stage },
-            builder.config.build,
+            builder.config.host_target,
         );
 
         if mode != Mode::ToolBootstrap {
@@ -527,7 +527,7 @@ fn run_tool_check_step(
     path: &str,
 ) {
     let display_name = path.rsplit('/').next().unwrap();
-    let compiler = builder.compiler(builder.top_stage, builder.config.build);
+    let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
 
     builder.ensure(Rustc::new(target, builder));
 
@@ -614,7 +614,7 @@ impl Step for CoverageDump {
         // Make sure we haven't forgotten any fields, if there are any.
         let Self {} = self;
         let display_name = "coverage-dump";
-        let host = builder.config.build;
+        let host = builder.config.host_target;
         let target = host;
         let mode = Mode::ToolBootstrap;
 
diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs
index 0652c08ff49..788a3b9601d 100644
--- a/src/bootstrap/src/core/build_steps/clippy.rs
+++ b/src/bootstrap/src/core/build_steps/clippy.rs
@@ -144,7 +144,7 @@ impl Step for Std {
         builder.require_submodule("library/stdarch", None);
 
         let target = self.target;
-        let compiler = builder.compiler(builder.top_stage, builder.config.build);
+        let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
 
         let mut cargo = builder::Cargo::new(
             builder,
@@ -204,7 +204,7 @@ impl Step for Rustc {
     /// This will lint the compiler for a particular stage of the build using
     /// the `compiler` targeting the `target` architecture.
     fn run(self, builder: &Builder<'_>) {
-        let compiler = builder.compiler(builder.top_stage, builder.config.build);
+        let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
         let target = self.target;
 
         if !builder.download_rustc() {
@@ -285,7 +285,7 @@ macro_rules! lint_any {
             }
 
             fn run(self, builder: &Builder<'_>) -> Self::Output {
-                let compiler = builder.compiler(builder.top_stage, builder.config.build);
+                let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
                 let target = self.target;
 
                 if !builder.download_rustc() {
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 5ecce31fe15..560925abba6 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -35,6 +35,7 @@ use crate::utils::helpers::{
 };
 use crate::{CLang, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode, debug, trace};
 
+/// Build a standard library for the given `target` using the given `compiler`.
 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub struct Std {
     pub target: TargetSelection,
@@ -159,7 +160,7 @@ impl Step for Std {
         let compiler = if builder.download_rustc() && self.force_recompile {
             // When there are changes in the library tree with CI-rustc, we want to build
             // the stageN library and that requires using stageN-1 compiler.
-            builder.compiler(self.compiler.stage.saturating_sub(1), builder.config.build)
+            builder.compiler(self.compiler.stage.saturating_sub(1), builder.config.host_target)
         } else {
             self.compiler
         };
@@ -301,7 +302,7 @@ impl Step for Std {
 
         builder.ensure(StdLink::from_std(
             self,
-            builder.compiler(compiler.stage, builder.config.build),
+            builder.compiler(compiler.stage, builder.config.host_target),
         ));
     }
 }
@@ -960,11 +961,18 @@ fn cp_rustc_component_to_ci_sysroot(builder: &Builder<'_>, sysroot: &Path, conte
     }
 }
 
+/// Build rustc using the passed `build_compiler`.
+///
+/// - Makes sure that `build_compiler` has a standard library prepared for its host target,
+///   so that it can compile build scripts and proc macros when building this `rustc`.
+/// - Makes sure that `build_compiler` has a standard library prepared for `target`,
+///   so that the built `rustc` can *link to it* and use it at runtime.
 #[derive(Debug, PartialOrd, Ord, Clone, PartialEq, Eq, Hash)]
 pub struct Rustc {
+    /// The target on which rustc will run (its host).
     pub target: TargetSelection,
-    /// The **previous** compiler used to compile this compiler.
-    pub compiler: Compiler,
+    /// The **previous** compiler used to compile this rustc.
+    pub build_compiler: Compiler,
     /// Whether to build a subset of crates, rather than the whole compiler.
     ///
     /// This should only be requested by the user, not used within bootstrap itself.
@@ -974,8 +982,8 @@ pub struct Rustc {
 }
 
 impl Rustc {
-    pub fn new(compiler: Compiler, target: TargetSelection) -> Self {
-        Self { target, compiler, crates: Default::default() }
+    pub fn new(build_compiler: Compiler, target: TargetSelection) -> Self {
+        Self { target, build_compiler, crates: Default::default() }
     }
 }
 
@@ -1007,7 +1015,7 @@ impl Step for Rustc {
     fn make_run(run: RunConfig<'_>) {
         let crates = run.cargo_crates_in_set();
         run.builder.ensure(Rustc {
-            compiler: run
+            build_compiler: run
                 .builder
                 .compiler(run.builder.top_stage.saturating_sub(1), run.build_triple()),
             target: run.target,
@@ -1018,7 +1026,7 @@ impl Step for Rustc {
     /// Builds the compiler.
     ///
     /// This will build the compiler for a particular stage of the build using
-    /// the `compiler` targeting the `target` architecture. The artifacts
+    /// the `build_compiler` targeting the `target` architecture. The artifacts
     /// created will also be linked into the sysroot directory.
     #[cfg_attr(
         feature = "tracing",
@@ -1026,54 +1034,58 @@ impl Step for Rustc {
             level = "debug",
             name = "Rustc::run",
             skip_all,
-            fields(previous_compiler = ?self.compiler, target = ?self.target),
+            fields(previous_compiler = ?self.build_compiler, target = ?self.target),
         ),
     )]
     fn run(self, builder: &Builder<'_>) -> u32 {
-        let compiler = self.compiler;
+        let build_compiler = self.build_compiler;
         let target = self.target;
 
         // NOTE: the ABI of the stage0 compiler is different from the ABI of the downloaded compiler,
         // so its artifacts can't be reused.
-        if builder.download_rustc() && compiler.stage != 0 {
-            trace!(stage = compiler.stage, "`download_rustc` requested");
+        if builder.download_rustc() && build_compiler.stage != 0 {
+            trace!(stage = build_compiler.stage, "`download_rustc` requested");
 
-            let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false });
+            let sysroot =
+                builder.ensure(Sysroot { compiler: build_compiler, force_recompile: false });
             cp_rustc_component_to_ci_sysroot(
                 builder,
                 &sysroot,
                 builder.config.ci_rustc_dev_contents(),
             );
-            return compiler.stage;
+            return build_compiler.stage;
         }
 
-        builder.ensure(Std::new(compiler, target));
+        // Build a standard library for `target` using the `build_compiler`.
+        // This will be the standard library that the rustc which we build *links to*.
+        builder.ensure(Std::new(build_compiler, target));
 
-        if builder.config.keep_stage.contains(&compiler.stage) {
-            trace!(stage = compiler.stage, "`keep-stage` requested");
+        if builder.config.keep_stage.contains(&build_compiler.stage) {
+            trace!(stage = build_compiler.stage, "`keep-stage` requested");
 
             builder.info("WARNING: Using a potentially old librustc. This may not behave well.");
             builder.info("WARNING: Use `--keep-stage-std` if you want to rebuild the compiler when it changes");
-            builder.ensure(RustcLink::from_rustc(self, compiler));
+            builder.ensure(RustcLink::from_rustc(self, build_compiler));
 
-            return compiler.stage;
+            return build_compiler.stage;
         }
 
-        let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
-        if compiler_to_use != compiler {
+        let compiler_to_use =
+            builder.compiler_for(build_compiler.stage, build_compiler.host, target);
+        if compiler_to_use != build_compiler {
             builder.ensure(Rustc::new(compiler_to_use, target));
             let msg = if compiler_to_use.host == target {
                 format!(
                     "Uplifting rustc (stage{} -> stage{})",
                     compiler_to_use.stage,
-                    compiler.stage + 1
+                    build_compiler.stage + 1
                 )
             } else {
                 format!(
                     "Uplifting rustc (stage{}:{} -> stage{}:{})",
                     compiler_to_use.stage,
                     compiler_to_use.host,
-                    compiler.stage + 1,
+                    build_compiler.stage + 1,
                     target
                 )
             };
@@ -1082,22 +1094,26 @@ impl Step for Rustc {
             return compiler_to_use.stage;
         }
 
-        // Ensure that build scripts and proc macros have a std / libproc_macro to link against.
+        // Build a standard library for the current host target using the `build_compiler`.
+        // This standard library will be used when building `rustc` for compiling
+        // build scripts and proc macros.
+        // If we are not cross-compiling, the Std build above will be the same one as the one we
+        // prepare here.
         builder.ensure(Std::new(
-            builder.compiler(self.compiler.stage, builder.config.build),
-            builder.config.build,
+            builder.compiler(self.build_compiler.stage, builder.config.host_target),
+            builder.config.host_target,
         ));
 
         let mut cargo = builder::Cargo::new(
             builder,
-            compiler,
+            build_compiler,
             Mode::Rustc,
             SourceType::InTree,
             target,
             Kind::Build,
         );
 
-        rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
+        rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates);
 
         // NB: all RUSTFLAGS should be added to `rustc_cargo()` so they will be
         // consistently applied by check/doc/test modes too.
@@ -1106,19 +1122,19 @@ impl Step for Rustc {
             cargo.arg("-p").arg(krate);
         }
 
-        if builder.build.config.enable_bolt_settings && compiler.stage == 1 {
+        if builder.build.config.enable_bolt_settings && build_compiler.stage == 1 {
             // Relocations are required for BOLT to work.
             cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
         }
 
         let _guard = builder.msg_sysroot_tool(
             Kind::Build,
-            compiler.stage,
+            build_compiler.stage,
             format_args!("compiler artifacts{}", crate_description(&self.crates)),
-            compiler.host,
+            build_compiler.host,
             target,
         );
-        let stamp = build_stamp::librustc_stamp(builder, compiler, target);
+        let stamp = build_stamp::librustc_stamp(builder, build_compiler, target);
         run_cargo(
             builder,
             cargo,
@@ -1150,10 +1166,10 @@ impl Step for Rustc {
 
         builder.ensure(RustcLink::from_rustc(
             self,
-            builder.compiler(compiler.stage, builder.config.build),
+            builder.compiler(build_compiler.stage, builder.config.host_target),
         ));
 
-        compiler.stage
+        build_compiler.stage
     }
 }
 
@@ -1161,7 +1177,7 @@ pub fn rustc_cargo(
     builder: &Builder<'_>,
     cargo: &mut Cargo,
     target: TargetSelection,
-    compiler: &Compiler,
+    build_compiler: &Compiler,
     crates: &[String],
 ) {
     cargo
@@ -1190,11 +1206,11 @@ pub fn rustc_cargo(
     // We want to link against registerEnzyme and in the future we want to use additional
     // functionality from Enzyme core. For that we need to link against Enzyme.
     if builder.config.llvm_enzyme {
-        let arch = builder.build.build;
+        let arch = builder.build.host_target;
         let enzyme_dir = builder.build.out.join(arch).join("enzyme").join("lib");
         cargo.rustflag("-L").rustflag(enzyme_dir.to_str().expect("Invalid path"));
 
-        if let Some(llvm_config) = builder.llvm_config(builder.config.build) {
+        if let Some(llvm_config) = builder.llvm_config(builder.config.host_target) {
             let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
             cargo.rustflag("-l").rustflag(&format!("Enzyme-{llvm_version_major}"));
         }
@@ -1208,7 +1224,7 @@ pub fn rustc_cargo(
         cargo.rustflag("-Zdefault-visibility=protected");
     }
 
-    if is_lto_stage(compiler) {
+    if is_lto_stage(build_compiler) {
         match builder.config.rust_lto {
             RustcLto::Thin | RustcLto::Fat => {
                 // Since using LTO for optimizing dylibs is currently experimental,
@@ -1241,7 +1257,7 @@ pub fn rustc_cargo(
     // is already on by default in MSVC optimized builds, which is interpreted as --icf=all:
     // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746
     // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827
-    if builder.config.lld_mode.is_used() && !compiler.host.is_msvc() {
+    if builder.config.lld_mode.is_used() && !build_compiler.host.is_msvc() {
         cargo.rustflag("-Clink-args=-Wl,--icf=all");
     }
 
@@ -1249,7 +1265,7 @@ pub fn rustc_cargo(
         panic!("Cannot use and generate PGO profiles at the same time");
     }
     let is_collecting = if let Some(path) = &builder.config.rust_profile_generate {
-        if compiler.stage == 1 {
+        if build_compiler.stage == 1 {
             cargo.rustflag(&format!("-Cprofile-generate={path}"));
             // Apparently necessary to avoid overflowing the counters during
             // a Cargo build profile
@@ -1259,7 +1275,7 @@ pub fn rustc_cargo(
             false
         }
     } else if let Some(path) = &builder.config.rust_profile_use {
-        if compiler.stage == 1 {
+        if build_compiler.stage == 1 {
             cargo.rustflag(&format!("-Cprofile-use={path}"));
             if builder.is_verbose() {
                 cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function");
@@ -1284,20 +1300,20 @@ pub fn rustc_cargo(
     // useful.
     // This is only performed for non-incremental builds, as ccache cannot deal with these.
     if let Some(ref ccache) = builder.config.ccache
-        && compiler.stage == 0
+        && build_compiler.stage == 0
         && !builder.config.incremental
     {
         cargo.env("RUSTC_WRAPPER", ccache);
     }
 
-    rustc_cargo_env(builder, cargo, target, compiler.stage);
+    rustc_cargo_env(builder, cargo, target, build_compiler.stage);
 }
 
 pub fn rustc_cargo_env(
     builder: &Builder<'_>,
     cargo: &mut Cargo,
     target: TargetSelection,
-    stage: u32,
+    build_stage: u32,
 ) {
     // Set some configuration variables picked up by build scripts and
     // the compiler alike
@@ -1364,7 +1380,7 @@ pub fn rustc_cargo_env(
             crate::core::build_steps::llvm::prebuilt_llvm_config(builder, target, false)
                 .should_build();
         // `top_stage == stage` might be false for `check --stage 1`, if we are building the stage 1 compiler
-        let can_skip_build = builder.kind == Kind::Check && builder.top_stage == stage;
+        let can_skip_build = builder.kind == Kind::Check && builder.top_stage == build_stage;
         let should_skip_build = building_is_expensive && can_skip_build;
         if !should_skip_build {
             rustc_llvm_env(builder, cargo, target)
@@ -1475,7 +1491,7 @@ impl RustcLink {
     fn from_rustc(rustc: Rustc, host_compiler: Compiler) -> Self {
         Self {
             compiler: host_compiler,
-            previous_stage_compiler: rustc.compiler,
+            previous_stage_compiler: rustc.build_compiler,
             target: rustc.target,
             crates: rustc.crates,
         }
@@ -1813,7 +1829,7 @@ impl Step for Sysroot {
         // If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0.
         if builder.download_rustc() && compiler.stage != 0 {
             assert_eq!(
-                builder.config.build, compiler.host,
+                builder.config.host_target, compiler.host,
                 "Cross-compiling is not yet supported with `download-rustc`",
             );
 
@@ -1967,7 +1983,7 @@ impl Step for Assemble {
         if target_compiler.stage == 0 {
             trace!("stage 0 build compiler is always available, simply returning");
             assert_eq!(
-                builder.config.build, target_compiler.host,
+                builder.config.host_target, target_compiler.host,
                 "Cannot obtain compiler for non-native build triple at stage 0"
             );
             // The stage 0 compiler for the build triple is always pre-built.
@@ -2080,15 +2096,16 @@ impl Step for Assemble {
         debug!(
             "ensuring build compiler is available: compiler(stage = {}, host = {:?})",
             target_compiler.stage - 1,
-            builder.config.build,
+            builder.config.host_target,
         );
-        let mut build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
+        let mut build_compiler =
+            builder.compiler(target_compiler.stage - 1, builder.config.host_target);
 
         // Build enzyme
         if builder.config.llvm_enzyme && !builder.config.dry_run() {
             debug!("`llvm_enzyme` requested");
             let enzyme_install = builder.ensure(llvm::Enzyme { target: build_compiler.host });
-            let llvm_config = builder.llvm_config(builder.config.build).unwrap();
+            let llvm_config = builder.llvm_config(builder.config.host_target).unwrap();
             let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
             let lib_ext = std::env::consts::DLL_EXTENSION;
             let libenzyme = format!("libEnzyme-{llvm_version_major}");
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 7aa9e6cc2b5..e0f632eda0e 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -422,7 +422,7 @@ impl Step for Rustc {
             }
 
             let ra_proc_macro_srv_compiler =
-                builder.compiler_for(compiler.stage, builder.config.build, compiler.host);
+                builder.compiler_for(compiler.stage, builder.config.host_target, compiler.host);
             builder.ensure(compile::Rustc::new(ra_proc_macro_srv_compiler, compiler.host));
 
             if let Some(ra_proc_macro_srv) = builder.ensure_if_default(
@@ -696,7 +696,7 @@ impl Step for Std {
         run.builder.ensure(Std {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -748,7 +748,7 @@ impl Step for RustcDev {
         run.builder.ensure(RustcDev {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -815,7 +815,7 @@ impl Step for Analysis {
             // through the sysroot uplifting.
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1168,7 +1168,7 @@ impl Step for Cargo {
         run.builder.ensure(Cargo {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1224,7 +1224,7 @@ impl Step for RustAnalyzer {
         run.builder.ensure(RustAnalyzer {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1268,7 +1268,7 @@ impl Step for Clippy {
         run.builder.ensure(Clippy {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1317,7 +1317,7 @@ impl Step for Miri {
         run.builder.ensure(Miri {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1462,7 +1462,7 @@ impl Step for Rustfmt {
         run.builder.ensure(Rustfmt {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
@@ -1507,7 +1507,7 @@ impl Step for Extended {
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(Extended {
             stage: run.builder.top_stage,
-            host: run.builder.config.build,
+            host: run.builder.config.host_target,
             target: run.target,
         });
     }
@@ -2157,7 +2157,7 @@ fn maybe_install_llvm(
         cmd.arg("--libfiles");
         builder.verbose(|| println!("running {cmd:?}"));
         let files = cmd.run_capture_stdout(builder).stdout();
-        let build_llvm_out = &builder.llvm_out(builder.config.build);
+        let build_llvm_out = &builder.llvm_out(builder.config.host_target);
         let target_llvm_out = &builder.llvm_out(target);
         for file in files.trim_end().split(' ') {
             // If we're not using a custom LLVM, make sure we package for the target.
@@ -2341,7 +2341,7 @@ impl Step for LlvmBitcodeLinker {
         run.builder.ensure(LlvmBitcodeLinker {
             compiler: run.builder.compiler_for(
                 run.builder.top_stage,
-                run.builder.config.build,
+                run.builder.config.host_target,
                 run.target,
             ),
             target: run.target,
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 7fccf85a0ea..215c155651a 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -209,7 +209,7 @@ impl Step for TheBook {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(TheBook {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -329,7 +329,7 @@ impl Step for Standalone {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(Standalone {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -431,7 +431,7 @@ impl Step for Releases {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(Releases {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -449,7 +449,7 @@ impl Step for Releases {
         t!(fs::create_dir_all(&out));
 
         builder.ensure(Standalone {
-            compiler: builder.compiler(builder.top_stage, builder.config.build),
+            compiler: builder.compiler(builder.top_stage, builder.config.host_target),
             target,
         });
 
@@ -700,7 +700,7 @@ fn doc_std(
     extra_args: &[&str],
     requested_crates: &[String],
 ) {
-    let compiler = builder.compiler(stage, builder.config.build);
+    let compiler = builder.compiler(stage, builder.config.host_target);
 
     let target_doc_dir_name = if format == DocumentationFormat::Json { "json-doc" } else { "doc" };
     let target_dir = builder.stage_out(compiler, Mode::Std).join(target).join(target_doc_dir_name);
@@ -803,8 +803,8 @@ impl Step for Rustc {
 
         // Build the standard library, so that proc-macros can use it.
         // (Normally, only the metadata would be necessary, but proc-macros are special since they run at compile-time.)
-        let compiler = builder.compiler(stage, builder.config.build);
-        builder.ensure(compile::Std::new(compiler, builder.config.build));
+        let compiler = builder.compiler(stage, builder.config.host_target);
+        builder.ensure(compile::Std::new(compiler, builder.config.host_target));
 
         let _guard = builder.msg_sysroot_tool(
             Kind::Doc,
@@ -946,7 +946,7 @@ macro_rules! tool_doc {
                 let out = builder.compiler_doc_out(target);
                 t!(fs::create_dir_all(&out));
 
-                let compiler = builder.compiler(stage, builder.config.build);
+                let compiler = builder.compiler(stage, builder.config.host_target);
                 builder.ensure(compile::Std::new(compiler, target));
 
                 if true $(&& $rustc_tool)? {
@@ -1174,7 +1174,7 @@ impl Step for RustcBook {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(RustcBook {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
             validate: false,
         });
@@ -1261,7 +1261,7 @@ impl Step for Reference {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(Reference {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -1272,7 +1272,7 @@ impl Step for Reference {
 
         // This is needed for generating links to the standard library using
         // the mdbook-spec plugin.
-        builder.ensure(compile::Std::new(self.compiler, builder.config.build));
+        builder.ensure(compile::Std::new(self.compiler, builder.config.host_target));
 
         // Run rustbook/mdbook to generate the HTML pages.
         builder.ensure(RustbookSrc {
diff --git a/src/bootstrap/src/core/build_steps/gcc.rs b/src/bootstrap/src/core/build_steps/gcc.rs
index ee8bd8286da..899e3fd9a45 100644
--- a/src/bootstrap/src/core/build_steps/gcc.rs
+++ b/src/bootstrap/src/core/build_steps/gcc.rs
@@ -285,7 +285,7 @@ pub fn add_cg_gcc_cargo_flags(cargo: &mut Cargo, gcc: &GccOutput) {
 /// The absolute path to the downloaded GCC artifacts.
 #[cfg(not(test))]
 fn ci_gcc_root(config: &crate::Config) -> PathBuf {
-    config.out.join(config.build).join("ci-gcc")
+    config.out.join(config.host_target).join("ci-gcc")
 }
 
 /// Detect whether GCC sources have been modified locally or not.
diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs
index 5419540aa2e..4434d6658eb 100644
--- a/src/bootstrap/src/core/build_steps/install.rs
+++ b/src/bootstrap/src/core/build_steps/install.rs
@@ -73,7 +73,7 @@ fn install_sh(
     let prefix = default_path(&builder.config.prefix, "/usr/local");
     let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc"));
     let destdir_env = env::var_os("DESTDIR").map(PathBuf::from);
-    let is_cygwin = builder.config.build.is_cygwin();
+    let is_cygwin = builder.config.host_target.is_cygwin();
 
     // Sanity checks on the write access of user.
     //
@@ -187,7 +187,7 @@ macro_rules! install {
 
             fn make_run(run: RunConfig<'_>) {
                 run.builder.ensure($name {
-                    compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+                    compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
                     target: run.target,
                 });
             }
@@ -246,7 +246,7 @@ install!((self, builder, _config),
             );
         }
     };
-    LlvmTools, alias = "llvm-tools", _config.llvm_tools_enabled && _config.llvm_enabled(_config.build), only_hosts: true, {
+    LlvmTools, alias = "llvm-tools", _config.llvm_tools_enabled && _config.llvm_enabled(_config.host_target), only_hosts: true, {
         if let Some(tarball) = builder.ensure(dist::LlvmTools { target: self.target }) {
             install_sh(builder, "llvm-tools", self.compiler.stage, Some(self.target), &tarball);
         } else {
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 2b7703000cb..8f2f143c352 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -132,14 +132,14 @@ pub fn prebuilt_llvm_config(
     let build_llvm_config = if let Some(build_llvm_config) = builder
         .config
         .target_config
-        .get(&builder.config.build)
+        .get(&builder.config.host_target)
         .and_then(|config| config.llvm_config.clone())
     {
         build_llvm_config
     } else {
-        let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
+        let mut llvm_config_ret_dir = builder.llvm_out(builder.config.host_target);
         llvm_config_ret_dir.push("bin");
-        llvm_config_ret_dir.join(exe("llvm-config", builder.config.build))
+        llvm_config_ret_dir.join(exe("llvm-config", builder.config.host_target))
     };
 
     let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");
@@ -235,8 +235,8 @@ pub(crate) fn is_ci_llvm_available_for_target(config: &Config, asserts: bool) ->
         ("x86_64-unknown-netbsd", false),
     ];
 
-    if !supported_platforms.contains(&(&*config.build.triple, asserts))
-        && (asserts || !supported_platforms.contains(&(&*config.build.triple, true)))
+    if !supported_platforms.contains(&(&*config.host_target.triple, asserts))
+        && (asserts || !supported_platforms.contains(&(&*config.host_target.triple, true)))
     {
         return false;
     }
@@ -480,7 +480,7 @@ impl Step for Llvm {
         // https://llvm.org/docs/HowToCrossCompileLLVM.html
         if !builder.config.is_host_target(target) {
             let LlvmResult { llvm_config, .. } =
-                builder.ensure(Llvm { target: builder.config.build });
+                builder.ensure(Llvm { target: builder.config.host_target });
             if !builder.config.dry_run() {
                 let llvm_bindir =
                     command(&llvm_config).arg("--bindir").run_capture_stdout(builder).stdout();
@@ -494,7 +494,8 @@ impl Step for Llvm {
             }
             cfg.define("LLVM_CONFIG_PATH", llvm_config);
             if builder.config.llvm_clang {
-                let build_bin = builder.llvm_out(builder.config.build).join("build").join("bin");
+                let build_bin =
+                    builder.llvm_out(builder.config.host_target).join("build").join("bin");
                 let clang_tblgen = build_bin.join("clang-tblgen").with_extension(EXE_EXTENSION);
                 if !builder.config.dry_run() && !clang_tblgen.exists() {
                     panic!("unable to find {}", clang_tblgen.display());
@@ -628,7 +629,7 @@ fn configure_cmake(
     if builder.ninja() {
         cfg.generator("Ninja");
     }
-    cfg.target(&target.triple).host(&builder.config.build.triple);
+    cfg.target(&target.triple).host(&builder.config.host_target.triple);
 
     if !builder.config.is_host_target(target) {
         cfg.define("CMAKE_CROSSCOMPILING", "True");
@@ -813,7 +814,7 @@ fn configure_cmake(
         ldflags.push_all(flags);
     }
 
-    if let Some(flags) = get_var("LDFLAGS", &builder.config.build.triple, &target.triple) {
+    if let Some(flags) = get_var("LDFLAGS", &builder.config.host_target.triple, &target.triple) {
         ldflags.push_all(&flags);
     }
 
@@ -1135,7 +1136,8 @@ impl Step for Sanitizers {
             return runtimes;
         }
 
-        let LlvmResult { llvm_config, .. } = builder.ensure(Llvm { target: builder.config.build });
+        let LlvmResult { llvm_config, .. } =
+            builder.ensure(Llvm { target: builder.config.host_target });
 
         static STAMP_HASH_MEMO: OnceLock<String> = OnceLock::new();
         let smart_stamp_hash = STAMP_HASH_MEMO.get_or_init(|| {
@@ -1345,7 +1347,7 @@ impl Step for CrtBeginEnd {
         cfg.cargo_metadata(false)
             .out_dir(&out_dir)
             .target(&self.target.triple)
-            .host(&builder.config.build.triple)
+            .host(&builder.config.host_target.triple)
             .warnings(false)
             .debug(false)
             .opt_level(3)
@@ -1424,7 +1426,7 @@ impl Step for Libunwind {
                 cfg.archiver(ar);
             }
             cfg.target(&self.target.triple);
-            cfg.host(&builder.config.build.triple);
+            cfg.host(&builder.config.host_target.triple);
             cfg.warnings(false);
             cfg.debug(false);
             // get_compiler() need set opt_level first.
diff --git a/src/bootstrap/src/core/build_steps/perf.rs b/src/bootstrap/src/core/build_steps/perf.rs
index 14c7b7cf5e9..c43043b48f4 100644
--- a/src/bootstrap/src/core/build_steps/perf.rs
+++ b/src/bootstrap/src/core/build_steps/perf.rs
@@ -136,8 +136,8 @@ impl Display for Scenario {
 /// Performs profiling using `rustc-perf` on a built version of the compiler.
 pub fn perf(builder: &Builder<'_>, args: &PerfArgs) {
     let collector = builder.ensure(RustcPerf {
-        compiler: builder.compiler(0, builder.config.build),
-        target: builder.config.build,
+        compiler: builder.compiler(0, builder.config.host_target),
+        target: builder.config.host_target,
     });
 
     let is_profiling = match &args.cmd {
@@ -151,8 +151,8 @@ pub fn perf(builder: &Builder<'_>, args: &PerfArgs) {
 Consider setting `rust.debuginfo-level = 1` in `bootstrap.toml`."#);
     }
 
-    let compiler = builder.compiler(builder.top_stage, builder.config.build);
-    builder.ensure(Std::new(compiler, builder.config.build));
+    let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
+    builder.ensure(Std::new(compiler, builder.config.host_target));
 
     if let Some(opts) = args.cmd.shared_opts()
         && opts.profiles.contains(&Profile::Doc)
diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs
index 6ef1b13abcd..b3104ae05e8 100644
--- a/src/bootstrap/src/core/build_steps/run.rs
+++ b/src/bootstrap/src/core/build_steps/run.rs
@@ -116,7 +116,7 @@ impl Step for Miri {
     }
 
     fn run(self, builder: &Builder<'_>) {
-        let host = builder.build.build;
+        let host = builder.build.host_target;
         let target = self.target;
 
         // `x run` uses stage 0 by default but miri does not work well with stage 0.
@@ -448,7 +448,7 @@ impl Step for Rustfmt {
     }
 
     fn run(self, builder: &Builder<'_>) {
-        let host = builder.build.build;
+        let host = builder.build.host_target;
 
         // `x run` uses stage 0 by default but rustfmt does not work well with stage 0.
         // Change the stage to 1 if it's not set explicitly.
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 25adfdf1601..86b7456d7b4 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -260,7 +260,7 @@ impl Step for Link {
         }
 
         let stage_path =
-            ["build", config.build.rustc_target_arg(), "stage1"].join(MAIN_SEPARATOR_STR);
+            ["build", config.host_target.rustc_target_arg(), "stage1"].join(MAIN_SEPARATOR_STR);
 
         if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
             attempt_toolchain_link(builder, &stage_path[..]);
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index dddce8fe05d..ebb926d81ce 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -70,7 +70,7 @@ impl Step for CrateBootstrap {
     }
 
     fn run(self, builder: &Builder<'_>) {
-        let bootstrap_host = builder.config.build;
+        let bootstrap_host = builder.config.host_target;
         let compiler = builder.compiler(0, bootstrap_host);
         let mut path = self.path.to_str().unwrap();
 
@@ -128,7 +128,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
         builder.info(&format!("Linkcheck ({host})"));
 
         // Test the linkchecker itself.
-        let bootstrap_host = builder.config.build;
+        let bootstrap_host = builder.config.host_target;
         let compiler = builder.compiler(0, bootstrap_host);
 
         let cargo = tool::prepare_tool_cargo(
@@ -525,7 +525,7 @@ impl Step for Miri {
 
     /// Runs `cargo test` for miri.
     fn run(self, builder: &Builder<'_>) {
-        let host = builder.build.build;
+        let host = builder.build.host_target;
         let target = self.target;
         let stage = builder.top_stage;
         if stage == 0 {
@@ -637,7 +637,7 @@ impl Step for CargoMiri {
 
     /// Tests `cargo miri test`.
     fn run(self, builder: &Builder<'_>) {
-        let host = builder.build.build;
+        let host = builder.build.host_target;
         let target = self.target;
         let stage = builder.top_stage;
         if stage == 0 {
@@ -915,7 +915,7 @@ impl Step for RustdocJSStd {
             Kind::Test,
             builder.top_stage,
             "rustdoc-js-std",
-            builder.config.build,
+            builder.config.host_target,
             self.target,
         );
         command.run(builder);
@@ -1607,7 +1607,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
             // At stage 0 (stage - 1) we are using the stage0 compiler. Using `self.target` can lead
             // finding an incorrect compiler path on cross-targets, as the stage 0 is always equal to
             // `build.build` in the configuration.
-            let build = builder.build.build;
+            let build = builder.build.host_target;
             compiler = builder.compiler(compiler.stage - 1, build);
             let test_stage = compiler.stage + 1;
             (test_stage, format!("stage{test_stage}-{build}"))
@@ -1729,7 +1729,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
         cmd.arg("--mode").arg(mode);
         cmd.arg("--target").arg(target.rustc_target_arg());
         cmd.arg("--host").arg(&*compiler.host.triple);
-        cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
+        cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.host_target));
 
         if builder.build.config.llvm_enzyme {
             cmd.arg("--has-enzyme");
@@ -1900,7 +1900,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
         let mut copts_passed = false;
         if builder.config.llvm_enabled(compiler.host) {
             let llvm::LlvmResult { llvm_config, .. } =
-                builder.ensure(llvm::Llvm { target: builder.config.build });
+                builder.ensure(llvm::Llvm { target: builder.config.host_target });
             if !builder.config.dry_run() {
                 let llvm_version = get_llvm_version(builder, &llvm_config);
                 let llvm_components =
@@ -1947,7 +1947,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
                 // If LLD is available, add it to the PATH
                 if builder.config.lld_enabled {
                     let lld_install_root =
-                        builder.ensure(llvm::Lld { target: builder.config.build });
+                        builder.ensure(llvm::Lld { target: builder.config.host_target });
 
                     let lld_bin_path = lld_install_root.join("bin");
 
@@ -2202,7 +2202,7 @@ impl BookTest {
             let mut lib_paths = vec![];
             for dep in self.dependencies {
                 let mode = Mode::ToolRustc;
-                let target = builder.config.build;
+                let target = builder.config.host_target;
                 let cargo = tool::prepare_tool_cargo(
                     builder,
                     compiler,
@@ -2384,7 +2384,7 @@ impl Step for ErrorIndex {
         // error_index_generator depends on librustdoc. Use the compiler that
         // is normally used to build rustdoc for other tests (like compiletest
         // tests in tests/rustdoc) so that it shares the same artifacts.
-        let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.build);
+        let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.host_target);
         run.builder.ensure(ErrorIndex { compiler });
     }
 
@@ -2983,7 +2983,7 @@ impl Step for Distcheck {
             .arg("--enable-vendor")
             .current_dir(&dir)
             .run(builder);
-        command(helpers::make(&builder.config.build.triple))
+        command(helpers::make(&builder.config.host_target.triple))
             .arg("check")
             .current_dir(&dir)
             .run(builder);
@@ -3024,7 +3024,7 @@ impl Step for Bootstrap {
 
     /// Tests the build system itself.
     fn run(self, builder: &Builder<'_>) {
-        let host = builder.config.build;
+        let host = builder.config.host_target;
         let compiler = builder.compiler(0, host);
         let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);
 
@@ -3035,7 +3035,7 @@ impl Step for Bootstrap {
         check_bootstrap
             .args(["-m", "unittest", "bootstrap_test.py"])
             .env("BUILD_DIR", &builder.out)
-            .env("BUILD_PLATFORM", builder.build.build.triple)
+            .env("BUILD_PLATFORM", builder.build.host_target.triple)
             .env("BOOTSTRAP_TEST_RUSTC_BIN", &builder.initial_rustc)
             .env("BOOTSTRAP_TEST_CARGO_BIN", &builder.initial_cargo)
             .current_dir(builder.src.join("src/bootstrap/"));
@@ -3090,8 +3090,11 @@ impl Step for TierCheck {
     }
 
     fn make_run(run: RunConfig<'_>) {
-        let compiler =
-            run.builder.compiler_for(run.builder.top_stage, run.builder.build.build, run.target);
+        let compiler = run.builder.compiler_for(
+            run.builder.top_stage,
+            run.builder.build.host_target,
+            run.target,
+        );
         run.builder.ensure(TierCheck { compiler });
     }
 
@@ -3142,7 +3145,7 @@ impl Step for LintDocs {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(LintDocs {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -3168,7 +3171,7 @@ impl Step for RustInstaller {
 
     /// Ensure the version placeholder replacement tool builds
     fn run(self, builder: &Builder<'_>) {
-        let bootstrap_host = builder.config.build;
+        let bootstrap_host = builder.config.host_target;
         let compiler = builder.compiler(0, bootstrap_host);
         let cargo = tool::prepare_tool_cargo(
             builder,
@@ -3270,7 +3273,7 @@ impl Step for TestHelpers {
         cfg.cargo_metadata(false)
             .out_dir(&dst)
             .target(&target.triple)
-            .host(&builder.config.build.triple)
+            .host(&builder.config.host_target.triple)
             .opt_level(0)
             .warnings(false)
             .debug(false)
@@ -3560,7 +3563,7 @@ impl Step for TestFloatParse {
     }
 
     fn run(self, builder: &Builder<'_>) {
-        let bootstrap_host = builder.config.build;
+        let bootstrap_host = builder.config.host_target;
         let compiler = builder.compiler(builder.top_stage, bootstrap_host);
         let path = self.path.to_str().unwrap();
         let crate_name = self.path.iter().next_back().unwrap().to_str().unwrap();
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 717accb399a..680718f0552 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -341,14 +341,14 @@ pub(crate) fn get_tool_rustc_compiler(
 
     if builder.download_rustc() && target_compiler.stage == 1 {
         // We shouldn't drop to stage0 compiler when using CI rustc.
-        return builder.compiler(1, builder.config.build);
+        return builder.compiler(1, builder.config.host_target);
     }
 
     // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
     // we'd have stageN/bin/rustc and stageN/bin/$rustc_tool be effectively different stage
     // compilers, which isn't what we want. Rustc tools should be linked in the same way as the
     // compiler it's paired with, so it must be built with the previous stage compiler.
-    builder.compiler(target_compiler.stage.saturating_sub(1), builder.config.build)
+    builder.compiler(target_compiler.stage.saturating_sub(1), builder.config.host_target)
 }
 
 /// Links a built tool binary with the given `name` from the build directory to the
@@ -389,8 +389,8 @@ macro_rules! bootstrap_tool {
                 match tool {
                     $(Tool::$name =>
                         self.ensure($name {
-                            compiler: self.compiler(0, self.config.build),
-                            target: self.config.build,
+                            compiler: self.compiler(0, self.config.host_target),
+                            target: self.config.host_target,
                         }).tool_path,
                     )+
                 }
@@ -414,7 +414,7 @@ macro_rules! bootstrap_tool {
             fn make_run(run: RunConfig<'_>) {
                 run.builder.ensure($name {
                     // snapshot compiler
-                    compiler: run.builder.compiler(0, run.builder.config.build),
+                    compiler: run.builder.compiler(0, run.builder.config.host_target),
                     target: run.target,
                 });
             }
@@ -531,7 +531,7 @@ impl Step for RustcPerf {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(RustcPerf {
-            compiler: run.builder.compiler(0, run.builder.config.build),
+            compiler: run.builder.compiler(0, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -572,7 +572,7 @@ impl ErrorIndex {
     pub fn command(builder: &Builder<'_>) -> BootstrapCommand {
         // Error-index-generator links with the rustdoc library, so we need to add `rustc_lib_paths`
         // for rustc_private and libLLVM.so, and `sysroot_lib` for libstd, etc.
-        let host = builder.config.build;
+        let host = builder.config.host_target;
         let compiler = builder.compiler_for(builder.top_stage, host, host);
         let mut cmd = command(builder.ensure(ErrorIndex { compiler }).tool_path);
         let mut dylib_paths = builder.rustc_lib_paths(compiler);
@@ -595,7 +595,7 @@ impl Step for ErrorIndex {
         // src/tools/error-index-generator` which almost nobody does.
         // Normally, `x.py test` or `x.py doc` will use the
         // `ErrorIndex::command` function instead.
-        let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.build);
+        let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.host_target);
         run.builder.ensure(ErrorIndex { compiler });
     }
 
@@ -630,7 +630,7 @@ impl Step for RemoteTestServer {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(RemoteTestServer {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -787,7 +787,7 @@ impl Step for Cargo {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(Cargo {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -905,7 +905,7 @@ impl Step for RustAnalyzer {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(RustAnalyzer {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -950,7 +950,7 @@ impl Step for RustAnalyzerProcMacroSrv {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(RustAnalyzerProcMacroSrv {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             target: run.target,
         });
     }
@@ -1003,7 +1003,7 @@ impl Step for LlvmBitcodeLinker {
 
     fn make_run(run: RunConfig<'_>) {
         run.builder.ensure(LlvmBitcodeLinker {
-            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+            compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
             extra_features: Vec::new(),
             target: run.target,
         });
@@ -1141,7 +1141,7 @@ macro_rules! tool_extended {
 
             fn make_run(run: RunConfig<'_>) {
                 run.builder.ensure($name {
-                    compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+                    compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target),
                     target: run.target,
                 });
             }
@@ -1283,7 +1283,7 @@ impl Step for TestFloatParse {
     }
 
     fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
-        let bootstrap_host = builder.config.build;
+        let bootstrap_host = builder.config.host_target;
         let compiler = builder.compiler(builder.top_stage, bootstrap_host);
 
         builder.ensure(ToolBuild {
@@ -1306,7 +1306,7 @@ impl Builder<'_> {
     /// `host`.
     pub fn tool_cmd(&self, tool: Tool) -> BootstrapCommand {
         let mut cmd = command(self.tool_exe(tool));
-        let compiler = self.compiler(0, self.config.build);
+        let compiler = self.compiler(0, self.config.host_target);
         let host = &compiler.host;
         // Prepares the `cmd` provided to be able to run the `compiler` provided.
         //
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
index 8b1520de3a8..887db683f78 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -137,7 +137,7 @@ pub struct RunConfig<'a> {
 
 impl RunConfig<'_> {
     pub fn build_triple(&self) -> TargetSelection {
-        self.builder.build.build
+        self.builder.build.host_target
     }
 
     /// Return a list of crate names selected by `run.paths`.
@@ -1297,10 +1297,10 @@ impl<'a> Builder<'a> {
     ) -> Compiler {
         let mut resolved_compiler = if self.build.force_use_stage2(stage) {
             trace!(target: "COMPILER_FOR", ?stage, "force_use_stage2");
-            self.compiler(2, self.config.build)
+            self.compiler(2, self.config.host_target)
         } else if self.build.force_use_stage1(stage, target) {
             trace!(target: "COMPILER_FOR", ?stage, "force_use_stage1");
-            self.compiler(1, self.config.build)
+            self.compiler(1, self.config.host_target)
         } else {
             trace!(target: "COMPILER_FOR", ?stage, ?host, "no force, fallback to `compiler()`");
             self.compiler(stage, host)
@@ -1358,7 +1358,7 @@ impl<'a> Builder<'a> {
     /// Windows.
     pub fn libdir_relative(&self, compiler: Compiler) -> &Path {
         if compiler.is_snapshot(self) {
-            libdir(self.config.build).as_ref()
+            libdir(self.config.host_target).as_ref()
         } else {
             match self.config.libdir_relative() {
                 Some(relative_libdir) if compiler.stage >= 1 => relative_libdir,
@@ -1439,9 +1439,10 @@ impl<'a> Builder<'a> {
             return cmd;
         }
 
-        let _ = self.ensure(tool::Clippy { compiler: run_compiler, target: self.build.build });
-        let cargo_clippy =
-            self.ensure(tool::CargoClippy { compiler: run_compiler, target: self.build.build });
+        let _ =
+            self.ensure(tool::Clippy { compiler: run_compiler, target: self.build.host_target });
+        let cargo_clippy = self
+            .ensure(tool::CargoClippy { compiler: run_compiler, target: self.build.host_target });
         let mut dylib_path = helpers::dylib_path();
         dylib_path.insert(0, self.sysroot(run_compiler).join("lib"));
 
@@ -1454,9 +1455,10 @@ impl<'a> Builder<'a> {
     pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand {
         assert!(run_compiler.stage > 0, "miri can not be invoked at stage 0");
         // Prepare the tools
-        let miri = self.ensure(tool::Miri { compiler: run_compiler, target: self.build.build });
+        let miri =
+            self.ensure(tool::Miri { compiler: run_compiler, target: self.build.host_target });
         let cargo_miri =
-            self.ensure(tool::CargoMiri { compiler: run_compiler, target: self.build.build });
+            self.ensure(tool::CargoMiri { compiler: run_compiler, target: self.build.host_target });
         // Invoke cargo-miri, make sure it can find miri and cargo.
         let mut cmd = command(cargo_miri.tool_path);
         cmd.env("MIRI", &miri.tool_path);
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index a264d772c56..a26a96f2815 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -46,7 +46,7 @@ fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config
         .join(&thread::current().name().unwrap_or("unknown").replace(":", "-"));
     t!(fs::create_dir_all(&dir));
     config.out = dir;
-    config.build = TargetSelection::from_user(TEST_TRIPLE_1);
+    config.host_target = TargetSelection::from_user(TEST_TRIPLE_1);
     config.hosts = host.iter().map(|s| TargetSelection::from_user(s)).collect();
     config.targets = target.iter().map(|s| TargetSelection::from_user(s)).collect();
     config
@@ -1102,7 +1102,7 @@ fn test_prebuilt_llvm_config_path_resolution() {
     let actual = drop_win_disk_prefix_if_present(actual);
     assert_eq!(expected, actual);
 
-    let actual = prebuilt_llvm_config(&builder, builder.config.build, false)
+    let actual = prebuilt_llvm_config(&builder, builder.config.host_target, false)
         .llvm_result()
         .llvm_config
         .clone();
@@ -1120,15 +1120,15 @@ fn test_prebuilt_llvm_config_path_resolution() {
     let build = Build::new(config.clone());
     let builder = Builder::new(&build);
 
-    let actual = prebuilt_llvm_config(&builder, builder.config.build, false)
+    let actual = prebuilt_llvm_config(&builder, builder.config.host_target, false)
         .llvm_result()
         .llvm_config
         .clone();
     let expected = builder
         .out
-        .join(builder.config.build)
+        .join(builder.config.host_target)
         .join("llvm/bin")
-        .join(exe("llvm-config", builder.config.build));
+        .join(exe("llvm-config", builder.config.host_target));
     assert_eq!(expected, actual);
 
     let config = configure(
@@ -1143,15 +1143,15 @@ fn test_prebuilt_llvm_config_path_resolution() {
         let build = Build::new(config.clone());
         let builder = Builder::new(&build);
 
-        let actual = prebuilt_llvm_config(&builder, builder.config.build, false)
+        let actual = prebuilt_llvm_config(&builder, builder.config.host_target, false)
             .llvm_result()
             .llvm_config
             .clone();
         let expected = builder
             .out
-            .join(builder.config.build)
+            .join(builder.config.host_target)
             .join("ci-llvm/bin")
-            .join(exe("llvm-config", builder.config.build));
+            .join(exe("llvm-config", builder.config.host_target));
         assert_eq!(expected, actual);
     }
 }
@@ -1163,7 +1163,7 @@ fn test_is_builder_target() {
 
     for (target1, target2) in [(target1, target2), (target2, target1)] {
         let mut config = configure("build", &[], &[]);
-        config.build = target1;
+        config.host_target = target1;
         let build = Build::new(config);
         let builder = Builder::new(&build);
 
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 860aa120326..6aff376bde3 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -221,7 +221,7 @@ pub struct Config {
 
     pub reproducible_artifacts: Vec<String>,
 
-    pub build: TargetSelection,
+    pub host_target: TargetSelection,
     pub hosts: Vec<TargetSelection>,
     pub targets: Vec<TargetSelection>,
     pub local_rebuild: bool,
@@ -346,7 +346,7 @@ impl Config {
             stderr_is_tty: std::io::stderr().is_terminal(),
 
             // set by build.rs
-            build: TargetSelection::from_user(env!("BUILD_TRIPLE")),
+            host_target: TargetSelection::from_user(env!("BUILD_TRIPLE")),
 
             src: {
                 let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
@@ -727,7 +727,7 @@ impl Config {
         config.jobs = Some(threads_from_config(flags.jobs.unwrap_or(jobs.unwrap_or(0))));
 
         if let Some(file_build) = build {
-            config.build = TargetSelection::from_user(&file_build);
+            config.host_target = TargetSelection::from_user(&file_build);
         };
 
         set(&mut config.out, flags.build_dir.or_else(|| build_dir.map(PathBuf::from)));
@@ -753,10 +753,10 @@ impl Config {
             config.download_beta_toolchain();
             config
                 .out
-                .join(config.build)
+                .join(config.host_target)
                 .join("stage0")
                 .join("bin")
-                .join(exe("rustc", config.build))
+                .join(exe("rustc", config.host_target))
         };
 
         config.initial_sysroot = t!(PathBuf::from_str(
@@ -777,7 +777,7 @@ impl Config {
             cargo
         } else {
             config.download_beta_toolchain();
-            config.initial_sysroot.join("bin").join(exe("cargo", config.build))
+            config.initial_sysroot.join("bin").join(exe("cargo", config.host_target))
         };
 
         // NOTE: it's important this comes *after* we set `initial_rustc` just above.
@@ -792,7 +792,7 @@ impl Config {
         } else if let Some(file_host) = host {
             file_host.iter().map(|h| TargetSelection::from_user(h)).collect()
         } else {
-            vec![config.build]
+            vec![config.host_target]
         };
         config.targets = if let Some(TargetSelectionList(arg_target)) = flags.target {
             arg_target
@@ -926,17 +926,19 @@ impl Config {
         }
 
         if config.llvm_from_ci {
-            let triple = &config.build.triple;
+            let triple = &config.host_target.triple;
             let ci_llvm_bin = config.ci_llvm_root().join("bin");
             let build_target = config
                 .target_config
-                .entry(config.build)
+                .entry(config.host_target)
                 .or_insert_with(|| Target::from_triple(triple));
 
             check_ci_llvm!(build_target.llvm_config);
             check_ci_llvm!(build_target.llvm_filecheck);
-            build_target.llvm_config = Some(ci_llvm_bin.join(exe("llvm-config", config.build)));
-            build_target.llvm_filecheck = Some(ci_llvm_bin.join(exe("FileCheck", config.build)));
+            build_target.llvm_config =
+                Some(ci_llvm_bin.join(exe("llvm-config", config.host_target)));
+            build_target.llvm_filecheck =
+                Some(ci_llvm_bin.join(exe("FileCheck", config.host_target)));
         }
 
         config.apply_dist_config(toml.dist);
@@ -953,7 +955,7 @@ impl Config {
             );
         }
 
-        if config.lld_enabled && config.is_system_llvm(config.build) {
+        if config.lld_enabled && config.is_system_llvm(config.host_target) {
             eprintln!(
                 "Warning: LLD is enabled when using external llvm-config. LLD will not be built and copied to the sysroot."
             );
@@ -1147,13 +1149,13 @@ impl Config {
     /// The absolute path to the downloaded LLVM artifacts.
     pub(crate) fn ci_llvm_root(&self) -> PathBuf {
         assert!(self.llvm_from_ci);
-        self.out.join(self.build).join("ci-llvm")
+        self.out.join(self.host_target).join("ci-llvm")
     }
 
     /// Directory where the extracted `rustc-dev` component is stored.
     pub(crate) fn ci_rustc_dir(&self) -> PathBuf {
         assert!(self.download_rustc());
-        self.out.join(self.build).join("ci-rustc")
+        self.out.join(self.host_target).join("ci-rustc")
     }
 
     /// Determine whether llvm should be linked dynamically.
@@ -1237,7 +1239,7 @@ impl Config {
                         // Check the config compatibility
                         // FIXME: this doesn't cover `--set` flags yet.
                         let res = check_incompatible_options_for_ci_rustc(
-                            self.build,
+                            self.host_target,
                             current_config_toml,
                             ci_config_toml,
                         );
@@ -1473,7 +1475,7 @@ impl Config {
         debug_assertions_requested: bool,
         llvm_assertions: bool,
     ) -> Option<String> {
-        if !is_download_ci_available(&self.build.triple, llvm_assertions) {
+        if !is_download_ci_available(&self.host_target.triple, llvm_assertions) {
             return None;
         }
 
@@ -1709,7 +1711,7 @@ impl Config {
 
     /// Checks if the given target is the same as the host target.
     pub fn is_host_target(&self, target: TargetSelection) -> bool {
-        self.build == target
+        self.host_target == target
     }
 
     /// Returns `true` if this is an external version of LLVM not managed by bootstrap.
diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs
index bc4fa73a362..ea0251e209a 100644
--- a/src/bootstrap/src/core/config/flags.rs
+++ b/src/bootstrap/src/core/config/flags.rs
@@ -59,7 +59,7 @@ pub struct Flags {
     pub build_dir: Option<PathBuf>,
 
     #[arg(global = true, long, value_hint = clap::ValueHint::Other, value_name = "BUILD")]
-    /// build target of the stage0 compiler
+    /// host target of the stage0 compiler
     pub build: Option<String>,
 
     #[arg(global = true, long, value_hint = clap::ValueHint::Other, value_name = "HOST", value_parser = target_selection_list)]
diff --git a/src/bootstrap/src/core/config/toml/mod.rs b/src/bootstrap/src/core/config/toml/mod.rs
index ac4e249e580..01eb243159c 100644
--- a/src/bootstrap/src/core/config/toml/mod.rs
+++ b/src/bootstrap/src/core/config/toml/mod.rs
@@ -147,7 +147,7 @@ impl Config {
         }
 
         let builder_config_path =
-            self.out.join(self.build.triple).join(build_name).join(BUILDER_CONFIG_FILENAME);
+            self.out.join(self.host_target.triple).join(build_name).join(BUILDER_CONFIG_FILENAME);
         Self::get_toml(&builder_config_path)
     }
 
diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs
index bb18fa802af..642f2f2271d 100644
--- a/src/bootstrap/src/core/config/toml/rust.rs
+++ b/src/bootstrap/src/core/config/toml/rust.rs
@@ -621,13 +621,13 @@ impl Config {
         //   thus, disabled
         // - similarly, lld will not be built nor used by default when explicitly asked not to, e.g.
         //   when the config sets `rust.lld = false`
-        if self.build.triple == "x86_64-unknown-linux-gnu"
-            && self.hosts == [self.build]
+        if self.host_target.triple == "x86_64-unknown-linux-gnu"
+            && self.hosts == [self.host_target]
             && (self.channel == "dev" || self.channel == "nightly")
         {
             let no_llvm_config = self
                 .target_config
-                .get(&self.build)
+                .get(&self.host_target)
                 .is_some_and(|target_config| target_config.llvm_config.is_none());
             let enable_lld = self.llvm_from_ci || no_llvm_config;
             // Prefer the config setting in case an explicit opt-out is needed.
diff --git a/src/bootstrap/src/core/config/toml/target.rs b/src/bootstrap/src/core/config/toml/target.rs
index b8fc3e74c35..b9f6780ca3f 100644
--- a/src/bootstrap/src/core/config/toml/target.rs
+++ b/src/bootstrap/src/core/config/toml/target.rs
@@ -101,7 +101,7 @@ impl Config {
                 let mut target = Target::from_triple(&triple);
 
                 if let Some(ref s) = cfg.llvm_config {
-                    if self.download_rustc_commit.is_some() && triple == *self.build.triple {
+                    if self.download_rustc_commit.is_some() && triple == *self.host_target.triple {
                         panic!(
                             "setting llvm_config for the host is incompatible with download-rustc"
                         );
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index f349b9a87ed..88a58e580e6 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -256,7 +256,7 @@ impl Config {
         }
         curl.arg(url);
         if !self.check_run(&mut curl) {
-            if self.build.contains("windows-msvc") {
+            if self.host_target.contains("windows-msvc") {
                 eprintln!("Fallback to PowerShell");
                 for _ in 0..3 {
                     let powershell = command("PowerShell.exe").allow_failure().args([
@@ -411,7 +411,7 @@ impl Config {
 
         let date = &self.stage0_metadata.compiler.date;
         let version = &self.stage0_metadata.compiler.version;
-        let host = self.build;
+        let host = self.host_target;
 
         let clippy_stamp =
             BuildStamp::new(&self.initial_sysroot).with_prefix("clippy").add_stamp(date);
@@ -449,7 +449,7 @@ impl Config {
         let VersionMetadata { date, version } = self.stage0_metadata.rustfmt.as_ref()?;
         let channel = format!("{version}-{date}");
 
-        let host = self.build;
+        let host = self.host_target;
         let bin_root = self.out.join(host).join("rustfmt");
         let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host));
         let rustfmt_stamp = BuildStamp::new(&bin_root).with_prefix("rustfmt").add_stamp(channel);
@@ -557,11 +557,11 @@ impl Config {
         extra_components: &[&str],
         download_component: fn(&Config, String, &str, &str),
     ) {
-        let host = self.build.triple;
+        let host = self.host_target.triple;
         let bin_root = self.out.join(host).join(sysroot);
         let rustc_stamp = BuildStamp::new(&bin_root).with_prefix("rustc").add_stamp(stamp_key);
 
-        if !bin_root.join("bin").join(exe("rustc", self.build)).exists()
+        if !bin_root.join("bin").join(exe("rustc", self.host_target)).exists()
             || !rustc_stamp.is_up_to_date()
         {
             if bin_root.exists() {
@@ -630,7 +630,7 @@ impl Config {
             t!(fs::create_dir_all(&cache_dir));
         }
 
-        let bin_root = self.out.join(self.build).join(destination);
+        let bin_root = self.out.join(self.host_target).join(destination);
         let tarball = cache_dir.join(&filename);
         let (base_url, url, should_verify) = match mode {
             DownloadSource::CI => {
@@ -759,7 +759,7 @@ download-rustc = false
             let now = std::time::SystemTime::now();
             let file_times = fs::FileTimes::new().set_accessed(now).set_modified(now);
 
-            let llvm_config = llvm_root.join("bin").join(exe("llvm-config", self.build));
+            let llvm_config = llvm_root.join("bin").join(exe("llvm-config", self.host_target));
             t!(crate::utils::helpers::set_file_times(llvm_config, file_times));
 
             if self.should_fix_bins_and_dylibs() {
@@ -814,7 +814,7 @@ download-rustc = false
             &self.stage0_metadata.config.artifacts_server
         };
         let version = self.artifact_version_part(llvm_sha);
-        let filename = format!("rust-dev-{}-{}.tar.xz", version, self.build.triple);
+        let filename = format!("rust-dev-{}-{}.tar.xz", version, self.host_target.triple);
         let tarball = rustc_cache.join(&filename);
         if !tarball.exists() {
             let help_on_error = "ERROR: failed to download llvm from ci
@@ -844,7 +844,7 @@ download-rustc = false
         }
         let base = &self.stage0_metadata.config.artifacts_server;
         let version = self.artifact_version_part(gcc_sha);
-        let filename = format!("gcc-{version}-{}.tar.xz", self.build.triple);
+        let filename = format!("gcc-{version}-{}.tar.xz", self.host_target.triple);
         let tarball = gcc_cache.join(&filename);
         if !tarball.exists() {
             let help_on_error = "ERROR: failed to download gcc from ci
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index b7bbd294f0e..ef776e21943 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -109,9 +109,9 @@ pub fn check(build: &mut Build) {
 
     // Ensure that a compatible version of libstdc++ is available on the system when using `llvm.download-ci-llvm`.
     #[cfg(not(test))]
-    if !build.config.dry_run() && !build.build.is_msvc() && build.config.llvm_from_ci {
+    if !build.config.dry_run() && !build.host_target.is_msvc() && build.config.llvm_from_ci {
         let builder = Builder::new(build);
-        let libcxx_version = builder.ensure(tool::LibcxxVersionTool { target: build.build });
+        let libcxx_version = builder.ensure(tool::LibcxxVersionTool { target: build.host_target });
 
         match libcxx_version {
             tool::LibcxxVersion::Gnu(version) => {
@@ -237,7 +237,7 @@ than building it.
         }
 
         // skip check for cross-targets
-        if skip_target_sanity && target != &build.build {
+        if skip_target_sanity && target != &build.host_target {
             continue;
         }
 
@@ -308,7 +308,7 @@ than building it.
 
             if build.config.llvm_enabled(*host) {
                 // Externally configured LLVM requires FileCheck to exist
-                let filecheck = build.llvm_filecheck(build.build);
+                let filecheck = build.llvm_filecheck(build.host_target);
                 if !filecheck.starts_with(&build.out)
                     && !filecheck.exists()
                     && build.config.codegen_tests
@@ -333,7 +333,7 @@ than building it.
         }
 
         // skip check for cross-targets
-        if skip_target_sanity && target != &build.build {
+        if skip_target_sanity && target != &build.host_target {
             continue;
         }
 
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 88d5d026820..25e59bfe3a8 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -175,7 +175,7 @@ pub struct Build {
     verbosity: usize,
 
     /// Build triple for the pre-compiled snapshot compiler.
-    build: TargetSelection,
+    host_target: TargetSelection,
     /// Which triples to produce a compiler toolchain for.
     hosts: Vec<TargetSelection>,
     /// Which triples to build libraries (core/alloc/std/test/proc_macro) for.
@@ -420,7 +420,7 @@ impl Build {
         if bootstrap_out.ends_with("deps") {
             bootstrap_out.pop();
         }
-        if !bootstrap_out.join(exe("rustc", config.build)).exists() && !cfg!(test) {
+        if !bootstrap_out.join(exe("rustc", config.host_target)).exists() && !cfg!(test) {
             // this restriction can be lifted whenever https://github.com/rust-lang/rfcs/pull/3028 is implemented
             panic!(
                 "`rustc` not found in {}, run `cargo build --bins` before `cargo run`",
@@ -436,7 +436,9 @@ impl Build {
             initial_lld,
             initial_relative_libdir,
             initial_rustc: config.initial_rustc.clone(),
-            initial_rustdoc: config.initial_rustc.with_file_name(exe("rustdoc", config.build)),
+            initial_rustdoc: config
+                .initial_rustc
+                .with_file_name(exe("rustdoc", config.host_target)),
             initial_cargo: config.initial_cargo.clone(),
             initial_sysroot: config.initial_sysroot.clone(),
             local_rebuild: config.local_rebuild,
@@ -444,7 +446,7 @@ impl Build {
             doc_tests: config.cmd.doc_tests(),
             verbosity: config.verbose,
 
-            build: config.build,
+            host_target: config.host_target,
             hosts: config.hosts.clone(),
             targets: config.targets.clone(),
 
@@ -521,7 +523,7 @@ impl Build {
         }
 
         // Create symbolic link to use host sysroot from a consistent path (e.g., in the rust-analyzer config file).
-        let build_triple = build.out.join(build.build);
+        let build_triple = build.out.join(build.host_target);
         t!(fs::create_dir_all(&build_triple));
         let host = build.out.join("host");
         if host.is_symlink() {
@@ -932,7 +934,7 @@ impl Build {
 
     /// Returns the libdir of the snapshot compiler.
     fn rustc_snapshot_libdir(&self) -> PathBuf {
-        self.rustc_snapshot_sysroot().join(libdir(self.config.build))
+        self.rustc_snapshot_sysroot().join(libdir(self.config.host_target))
     }
 
     /// Returns the sysroot of the snapshot compiler.
@@ -973,7 +975,7 @@ impl Build {
         what: impl Display,
         target: impl Into<Option<TargetSelection>>,
     ) -> Option<gha::Group> {
-        self.msg(Kind::Clippy, self.config.stage, what, self.config.build, target)
+        self.msg(Kind::Clippy, self.config.stage, what, self.config.host_target, target)
     }
 
     #[must_use = "Groups should not be dropped until the Step finishes running"]
@@ -988,7 +990,7 @@ impl Build {
             Kind::Check,
             custom_stage.unwrap_or(self.config.stage),
             what,
-            self.config.build,
+            self.config.host_target,
             target,
         )
     }
@@ -1246,7 +1248,7 @@ impl Build {
             Some(self.cc(target))
         } else if self.config.lld_mode.is_used()
             && self.is_lld_direct_linker(target)
-            && self.build == target
+            && self.host_target == target
         {
             match self.config.lld_mode {
                 LldMode::SelfContained => Some(self.initial_lld.clone()),
@@ -1400,7 +1402,7 @@ impl Build {
 
     /// Path to the python interpreter to use
     fn python(&self) -> &Path {
-        if self.config.build.ends_with("apple-darwin") {
+        if self.config.host_target.ends_with("apple-darwin") {
             // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
             // LLDB plugin's compiled module which only works with the system python
             // (namely not Homebrew-installed python)
@@ -1440,7 +1442,7 @@ impl Build {
         !self.config.full_bootstrap
             && !self.config.download_rustc()
             && stage >= 2
-            && (self.hosts.contains(&target) || target == self.build)
+            && (self.hosts.contains(&target) || target == self.host_target)
     }
 
     /// Checks whether the `compiler` compiling for `target` should be forced to
@@ -1877,7 +1879,7 @@ to download LLVM rather than building it.
         // In these cases we automatically enable Ninja if we find it in the
         // environment.
         if !self.config.ninja_in_file
-            && self.config.build.is_msvc()
+            && self.config.host_target.is_msvc()
             && cmd_finder.maybe_have("ninja").is_some()
         {
             return true;
@@ -1946,7 +1948,7 @@ impl Compiler {
 
     /// Returns `true` if this is a snapshot compiler for `build`'s configuration
     pub fn is_snapshot(&self, build: &Build) -> bool {
-        self.stage == 0 && self.host == build.build
+        self.stage == 0 && self.host == build.host_target
     }
 
     /// Indicates whether the compiler was forced to use a specific stage.
diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
index 5c9e30706ee..851bb38074e 100644
--- a/src/bootstrap/src/utils/cc_detect.rs
+++ b/src/bootstrap/src/utils/cc_detect.rs
@@ -39,7 +39,7 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
         // Compress debuginfo
         .flag_if_supported("-gz")
         .target(&target.triple)
-        .host(&build.build.triple);
+        .host(&build.host_target.triple);
     match build.crt_static(target) {
         Some(a) => {
             cfg.static_crt(a);
@@ -70,7 +70,7 @@ pub fn find(build: &Build) {
         | crate::Subcommand::Suggest { .. }
         | crate::Subcommand::Format { .. }
         | crate::Subcommand::Setup { .. } => {
-            build.hosts.iter().cloned().chain(iter::once(build.build)).collect()
+            build.hosts.iter().cloned().chain(iter::once(build.host_target)).collect()
         }
 
         _ => {
@@ -81,7 +81,7 @@ pub fn find(build: &Build) {
                 .iter()
                 .chain(&build.hosts)
                 .cloned()
-                .chain(iter::once(build.build))
+                .chain(iter::once(build.host_target))
                 .collect()
         }
     };
diff --git a/src/bootstrap/src/utils/cc_detect/tests.rs b/src/bootstrap/src/utils/cc_detect/tests.rs
index 225fb7619b5..1f50738959f 100644
--- a/src/bootstrap/src/utils/cc_detect/tests.rs
+++ b/src/bootstrap/src/utils/cc_detect/tests.rs
@@ -155,7 +155,7 @@ fn test_find() {
     build.targets.push(target1.clone());
     build.hosts.push(target2.clone());
     find(&build);
-    for t in build.hosts.iter().chain(build.targets.iter()).chain(iter::once(&build.build)) {
+    for t in build.hosts.iter().chain(build.targets.iter()).chain(iter::once(&build.host_target)) {
         assert!(build.cc.borrow().contains_key(t), "CC not set for target {}", t.triple);
     }
 }