Skip to content

Commit 4781d28

Browse files
authored
Unrolled build for rust-lang#129651
Rollup merge of rust-lang#129651 - onur-ozkan:stage0-target-sanity-check, r=Kobzol skip stage 0 target check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set When adding a new target to `rustc` and extending `STAGE0_MISSING_TARGETS`, there is a chance that in the merge CI bootstrap target sanity check might fail [here](https://github.com/rust-lang/rust/blob/26d27b7c8729fb61fe8321fcd2ce734a79aa695d/src/bootstrap/src/core/sanity.rs#L243-L256) because the stage 0 compiler will assume to already support the new target since `opt-dist` uses the previously compiled compiler as the stage 0 compiler. This PR skips this check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set, and makes `opt-dist` to set `BOOTSTRAP_SKIP_TARGET_SANITY` so bootstrap doesn't run this logic for opt-dist tests. Fixes rust-lang#127021 (comment). Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/.60STAGE0_MISSING_TARGETS.60.20seems.20to.20check.20stage1 Blocker for rust-lang#127021
2 parents d571ae8 + 1a74371 commit 4781d28

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/bootstrap/src/core/sanity.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
//! In theory if we get past this phase it's a bug if a build fails, but in
99
//! practice that's likely not true!
1010
11-
use std::collections::HashMap;
12-
#[cfg(not(feature = "bootstrap-self-test"))]
13-
use std::collections::HashSet;
11+
use std::collections::{HashMap, HashSet};
1412
use std::ffi::{OsStr, OsString};
1513
use std::path::PathBuf;
1614
use std::{env, fs};
@@ -34,7 +32,6 @@ pub struct Finder {
3432
// it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list.
3533
//
3634
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
37-
#[cfg(not(feature = "bootstrap-self-test"))]
3835
const STAGE0_MISSING_TARGETS: &[&str] = &[
3936
// just a dummy comment so the list doesn't get onelined
4037
];
@@ -205,7 +202,6 @@ than building it.
205202
.map(|p| cmd_finder.must_have(p))
206203
.or_else(|| cmd_finder.maybe_have("reuse"));
207204

208-
#[cfg(not(feature = "bootstrap-self-test"))]
209205
let stage0_supported_target_list: HashSet<String> = crate::utils::helpers::output(
210206
command(&build.config.initial_rustc).args(["--print", "target-list"]).as_command_mut(),
211207
)
@@ -234,8 +230,7 @@ than building it.
234230
}
235231

236232
// Ignore fake targets that are only used for unit tests in bootstrap.
237-
#[cfg(not(feature = "bootstrap-self-test"))]
238-
{
233+
if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity {
239234
let mut has_target = false;
240235
let target_str = target.to_string();
241236

src/tools/opt-dist/src/tests.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ llvm-config = "{llvm_config}"
102102
for test_path in env.skipped_tests() {
103103
args.extend(["--skip", test_path]);
104104
}
105-
cmd(&args).env("COMPILETEST_FORCE_STAGE0", "1").run().context("Cannot execute tests")
105+
cmd(&args)
106+
.env("COMPILETEST_FORCE_STAGE0", "1")
107+
// Above we override the stage 0 compiler with previously compiled compiler,
108+
// which can cause confusion in bootstrap's target sanity checks.
109+
.env("BOOTSTRAP_SKIP_TARGET_SANITY", "1")
110+
.run()
111+
.context("Cannot execute tests")
106112
}
107113

108114
/// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z).

0 commit comments

Comments
 (0)