summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-09 05:33:22 +0100
committerGitHub <noreply@github.com>2024-01-09 05:33:22 +0100
commit985b2ce70dda2aa73a0efd15fd38d2f2eb50b3ff (patch)
tree80184b7ab70fea8a5c0b4cb6f622f404230b5a23 /src/bootstrap
parentb0c492cd6e5237ab64adcdc229293ab127ecc3ab (diff)
parentb888e2f82b9dbe81875f50d13adbc0271a9401ff (diff)
downloadrust-985b2ce70dda2aa73a0efd15fd38d2f2eb50b3ff.tar.gz
rust-985b2ce70dda2aa73a0efd15fd38d2f2eb50b3ff.zip
Rollup merge of #119619 - onur-ozkan:panic-abort-mir-opt, r=oli-obk
mir-opt and custom target fixes

From https://github.com/rust-lang/rust/issues/115642#issuecomment-1879589022

> > Could you please test the last two commits from https://github.com/onur-ozkan/rust/commits/panic-abort-mir-opt when you have the time? The first commit should resolve the error of using the nightly flag with a stable compiler, and the second one should resolve the custom target issue.

> I tested with the two commits and the errors of using nightly flag and custom target specs were not seen.
Testing was completed for the test suites like ui, run-pass-valgrind, coverage, mir-opt, codegen, assembly, incremental.

Fixes #115642
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/synthetic_targets.rs5
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/synthetic_targets.rs b/src/bootstrap/src/core/build_steps/synthetic_targets.rs
index d2c65b740da..9acdcaeb517 100644
--- a/src/bootstrap/src/core/build_steps/synthetic_targets.rs
+++ b/src/bootstrap/src/core/build_steps/synthetic_targets.rs
@@ -59,6 +59,11 @@ fn create_synthetic_target(
     let mut cmd = Command::new(builder.rustc(compiler));
     cmd.arg("--target").arg(base.rustc_target_arg());
     cmd.args(["-Zunstable-options", "--print", "target-spec-json"]);
+
+    // If `rust.channel` is set to either beta or stable, rustc will complain that
+    // we cannot use nightly features. So `RUSTC_BOOTSTRAP` is needed here.
+    cmd.env("RUSTC_BOOTSTRAP", "1");
+
     cmd.stdout(Stdio::piped());
 
     let output = cmd.spawn().unwrap().wait_with_output().unwrap();
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 331336b21ff..04728e2e00d 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -1596,8 +1596,13 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
         // NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
         // running compiler in stage 2 when plugins run.
         let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 {
-            compiler = builder.compiler(compiler.stage - 1, target);
-            format!("stage{}-{}", compiler.stage + 1, target)
+            // At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead finding
+            // an incorrect compiler path on cross-targets, as the stage 0 beta compiler is always equal
+            // to `build.build` in the configuration.
+            let build = builder.build.build;
+
+            compiler = builder.compiler(compiler.stage - 1, build);
+            format!("stage{}-{}", compiler.stage + 1, build)
         } else {
             format!("stage{}-{}", compiler.stage, target)
         };