about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-08-20 08:43:57 +0200
committerJakub Beránek <berykubik@gmail.com>2025-08-20 08:52:14 +0200
commitf254075e95a074b47307b7ffada62a907cb27c22 (patch)
tree6eb63a273c012911c04d6d194b9e24de87043e60
parent0079da4862cb02a99c5def36a79949de583a9aee (diff)
downloadrust-f254075e95a074b47307b7ffada62a907cb27c22.tar.gz
rust-f254075e95a074b47307b7ffada62a907cb27c22.zip
Disable rustc uplifting during cross-compilation
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs14
-rw-r--r--src/bootstrap/src/core/builder/tests.rs1
2 files changed, 6 insertions, 9 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 74a8cea1ebe..f22d40e021e 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1047,22 +1047,18 @@ impl Step for Rustc {
 
         // If we are building a stage3+ compiler, and full bootstrap is disabled, and we have a
         // previous rustc available, we will uplift a compiler from a previous stage.
+        // We do not allow cross-compilation uplifting here, because there it can be quite tricky
+        // to figure out which stage actually built the rustc that should be uplifted.
         if build_compiler.stage >= 2
             && !builder.config.full_bootstrap
-            && (target == builder.host_target || builder.hosts.contains(&target))
+            && target == builder.host_target
         {
             // Here we need to determine the **build compiler** that built the stage that we will
             // be uplifting. We cannot uplift stage 1, as it has a different ABI than stage 2+,
             // so we always uplift the stage2 compiler (compiled with stage 1).
             let uplift_build_compiler = builder.compiler(1, build_compiler.host);
-            let msg = if uplift_build_compiler.host == target {
-                format!("Uplifting rustc (stage2 -> stage{stage})")
-            } else {
-                format!(
-                    "Uplifting rustc (stage2:{} -> stage{stage}:{target})",
-                    uplift_build_compiler.host
-                )
-            };
+
+            let msg = format!("Uplifting rustc from stage2 to stage{stage})");
             builder.info(&msg);
 
             // Here the compiler that built the rlibs (`uplift_build_compiler`) can be different
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index 85c7f46099f..a7db96055e6 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -705,6 +705,7 @@ mod snapshot {
         [build] rustc 1 <host> -> rustc 2 <host>
         [build] rustc 1 <host> -> std 1 <target1>
         [build] rustc 2 <host> -> std 2 <target1>
+        [build] rustc 2 <host> -> std 2 <host>
         [build] rustc 2 <host> -> rustc 3 <target1>
         ");
     }