Rollup merge of #143707 - Kobzol:bootstrap-std-check, r=jieyouxu

Fix `--skip-std-check-if-no-download-rustc`

Since https://github.com/rust-lang/rust/pull/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: https://github.com/rust-lang/rust/issues/143705

r? ```@RalfJung```
This commit is contained in:
Trevor Gross
2025-07-10 20:20:39 -04:00
committed by GitHub
2 changed files with 31 additions and 7 deletions
+7 -7
View File
@@ -47,6 +47,13 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
}
fn make_run(run: RunConfig<'_>) {
if !run.builder.download_rustc() && run.builder.config.skip_std_check_if_no_download_rustc {
eprintln!(
"WARNING: `--skip-std-check-if-no-download-rustc` flag was passed and `rust.download-rustc` is not available. Skipping."
);
return;
}
let crates = std_crates_for_run_make(&run);
run.builder.ensure(Std {
build_compiler: prepare_compiler_for_check(run.builder, run.target, Mode::Std),
@@ -56,13 +63,6 @@ fn make_run(run: RunConfig<'_>) {
}
fn run(self, builder: &Builder<'_>) {
if !builder.download_rustc() && builder.config.skip_std_check_if_no_download_rustc {
eprintln!(
"WARNING: `--skip-std-check-if-no-download-rustc` flag was passed and `rust.download-rustc` is not available. Skipping."
);
return;
}
let build_compiler = self.build_compiler;
let stage = build_compiler.stage;
let target = self.target;
+24
View File
@@ -1439,6 +1439,30 @@ fn check_library_cross_compile() {
");
}
/// Make sure that we don't check library when download-rustc is disabled
/// when `--skip-std-check-if-no-download-rustc` was passed.
#[test]
fn check_library_skip_without_download_rustc() {
let ctx = TestCtx::new();
let args = ["--set", "rust.download-rustc=false", "--skip-std-check-if-no-download-rustc"];
insta::assert_snapshot!(
ctx.config("check")
.paths(&["library"])
.args(&args)
.render_steps(), @"");
insta::assert_snapshot!(
ctx.config("check")
.paths(&["library", "compiler"])
.args(&args)
.render_steps(), @r"
[build] llvm <host>
[check] rustc 0 <host> -> rustc 1 <host>
[check] rustc 0 <host> -> cranelift 1 <host>
[check] rustc 0 <host> -> gcc 1 <host>
");
}
#[test]
fn check_miri_no_explicit_stage() {
let ctx = TestCtx::new();