about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2025-02-18 12:59:20 +0300
committeronur-ozkan <work@onurozkan.dev>2025-02-18 15:34:43 +0300
commit164f2408a215a33f3b9d638dde2944a4dbeae6ea (patch)
tree8535547da37124f15a785861e2d7a7b7ce7d5f0b /src/bootstrap
parentf012427aa6abeb4013971108211d1bd6819b46f3 (diff)
downloadrust-164f2408a215a33f3b9d638dde2944a4dbeae6ea.tar.gz
rust-164f2408a215a33f3b9d638dde2944a4dbeae6ea.zip
pass target_compiler from Rustdoc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index b8ce92ac8af..05c9ab29e05 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -650,16 +650,7 @@ impl Step for Rustdoc {
             }
         }
 
-        let build_compiler = if builder.download_rustc() && target_compiler.stage == 1 {
-            // We already have the stage 1 compiler, we don't need to cut the stage.
-            builder.compiler(target_compiler.stage, builder.config.build)
-        } else {
-            // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
-            // we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
-            // compilers, which isn't what we want. Rustdoc should be linked in the same way as the
-            // rustc compiler it's paired with, so it must be built with the previous stage compiler.
-            builder.compiler(target_compiler.stage - 1, builder.config.build)
-        };
+        let build_compiler = get_tool_rustc_compiler(builder, target_compiler);
 
         // When using `download-rustc` and a stage0 build_compiler, copying rustc doesn't actually
         // build stage0 libstd (because the libstd in sysroot has the wrong ABI). Explicitly build
@@ -682,7 +673,7 @@ impl Step for Rustdoc {
         // NOTE: Never modify the rustflags here, it breaks the build cache for other tools!
         let mut cargo = prepare_tool_cargo(
             builder,
-            build_compiler,
+            target_compiler,
             Mode::ToolRustc,
             target,
             Kind::Build,