Skip to content

Commit 8b49e5c

Browse files
authored
Unrolled build for #143707
Rollup merge of #143707 - Kobzol:bootstrap-std-check, r=jieyouxu Fix `--skip-std-check-if-no-download-rustc` Since #143048, we now explicitly set the build compiler for `check::Std`, which caused it to be built before we checked `--skip-std-check-if-no-download-rustc`. So I moved the check earlier to `make_run`, which resolves it. I also added a regression test for this. Sadly we can't really test for the positive case easily (when download-ci-rustc is enabled), but we can test the negative cases, where it is disabled. Fixes: #143705 r? ```@RalfJung```
2 parents 2a023bf + 3e675f4 commit 8b49e5c

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ impl Step for Std {
4747
}
4848

4949
fn make_run(run: RunConfig<'_>) {
50+
if !run.builder.download_rustc() && run.builder.config.skip_std_check_if_no_download_rustc {
51+
eprintln!(
52+
"WARNING: `--skip-std-check-if-no-download-rustc` flag was passed and `rust.download-rustc` is not available. Skipping."
53+
);
54+
return;
55+
}
56+
5057
let crates = std_crates_for_run_make(&run);
5158
run.builder.ensure(Std {
5259
build_compiler: prepare_compiler_for_check(run.builder, run.target, Mode::Std),
@@ -56,13 +63,6 @@ impl Step for Std {
5663
}
5764

5865
fn run(self, builder: &Builder<'_>) {
59-
if !builder.download_rustc() && builder.config.skip_std_check_if_no_download_rustc {
60-
eprintln!(
61-
"WARNING: `--skip-std-check-if-no-download-rustc` flag was passed and `rust.download-rustc` is not available. Skipping."
62-
);
63-
return;
64-
}
65-
6666
let build_compiler = self.build_compiler;
6767
let stage = build_compiler.stage;
6868
let target = self.target;

src/bootstrap/src/core/builder/tests.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,30 @@ mod snapshot {
14391439
");
14401440
}
14411441

1442+
/// Make sure that we don't check library when download-rustc is disabled
1443+
/// when `--skip-std-check-if-no-download-rustc` was passed.
1444+
#[test]
1445+
fn check_library_skip_without_download_rustc() {
1446+
let ctx = TestCtx::new();
1447+
let args = ["--set", "rust.download-rustc=false", "--skip-std-check-if-no-download-rustc"];
1448+
insta::assert_snapshot!(
1449+
ctx.config("check")
1450+
.paths(&["library"])
1451+
.args(&args)
1452+
.render_steps(), @"");
1453+
1454+
insta::assert_snapshot!(
1455+
ctx.config("check")
1456+
.paths(&["library", "compiler"])
1457+
.args(&args)
1458+
.render_steps(), @r"
1459+
[build] llvm <host>
1460+
[check] rustc 0 <host> -> rustc 1 <host>
1461+
[check] rustc 0 <host> -> cranelift 1 <host>
1462+
[check] rustc 0 <host> -> gcc 1 <host>
1463+
");
1464+
}
1465+
14421466
#[test]
14431467
fn check_miri_no_explicit_stage() {
14441468
let ctx = TestCtx::new();

0 commit comments

Comments
 (0)