about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index fa848c492b4..fddf09f3e1d 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -1,5 +1,6 @@
 //! Implementation of compiling the compiler and standard library, in "check"-based modes.
 
+use crate::core::build_steps::compile;
 use crate::core::build_steps::compile::{
     add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make,
 };
@@ -45,10 +46,12 @@ impl Step for Std {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+        let stage = run.builder.top_stage;
         run.crate_or_deps("sysroot")
             .crate_or_deps("coretests")
             .crate_or_deps("alloctests")
             .path("library")
+            .default_condition(stage != 0)
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -62,6 +65,12 @@ impl Step for Std {
         let target = self.target;
         let compiler = builder.compiler(builder.top_stage, builder.config.build);
 
+        if builder.top_stage == 0 {
+            // Reuse the beta compiler's libstd
+            builder.ensure(compile::Std::new(compiler, target));
+            return;
+        }
+
         let mut cargo = builder::Cargo::new(
             builder,
             compiler,