Skip to content

Commit 1d23cec

Browse files
committed
improve check::Std handling
Signed-off-by: onur-ozkan <[email protected]>
1 parent e05a509 commit 1d23cec

File tree

1 file changed

+9
-1
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::path::PathBuf;
44

5+
use crate::core::build_steps::compile;
56
use crate::core::build_steps::compile::{
67
add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make,
78
};
@@ -41,7 +42,8 @@ impl Step for Std {
4142
const DEFAULT: bool = true;
4243

4344
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
44-
run.crate_or_deps("sysroot").path("library")
45+
let stage = run.builder.top_stage;
46+
run.crate_or_deps("sysroot").path("library").default_condition(stage != 0)
4547
}
4648

4749
fn make_run(run: RunConfig<'_>) {
@@ -60,6 +62,12 @@ impl Step for Std {
6062
let target = self.target;
6163
let compiler = builder.compiler(builder.top_stage, builder.config.build);
6264

65+
if builder.top_stage == 0 {
66+
// Reuse the beta compiler's libstd
67+
builder.ensure(compile::Std::new(compiler, target));
68+
return;
69+
}
70+
6371
let mut cargo = builder::Cargo::new(
6472
builder,
6573
compiler,

0 commit comments

Comments
 (0)