diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-07-10 20:20:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-10 20:20:39 -0400 |
| commit | d1a57676efa2fe8d901ff03b4ff726f728fdff23 (patch) | |
| tree | e05a2e81f9011e005fa6a2f02143d1b06e1ced77 /src | |
| parent | a5aff96d4dc75ee41316a232919d2ec8e4349bae (diff) | |
| parent | 3e675f4c5085df8ae19392e6de2caef7cb336f27 (diff) | |
| download | rust-d1a57676efa2fe8d901ff03b4ff726f728fdff23.tar.gz rust-d1a57676efa2fe8d901ff03b4ff726f728fdff23.zip | |
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```
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/check.rs | 14 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 24 |
2 files changed, 31 insertions, 7 deletions
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index 0497bae86a1..0cc4628310a 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -47,6 +47,13 @@ impl Step for Std { } 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 @@ impl Step for Std { } 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; diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 68d1885b0a7..51a90649692 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1439,6 +1439,30 @@ mod snapshot { "); } + /// 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(); |
