handle stage0 on Std::check
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
8a65d9febb
commit
ecc7dde80a
2 changed files with 24 additions and 11 deletions
|
|
@ -31,6 +31,8 @@ pub struct Std {
|
|||
}
|
||||
|
||||
impl Std {
|
||||
const CRATE_OR_DEPS: &[&str] = &["sysroot", "coretests", "alloctests"];
|
||||
|
||||
pub fn new(target: TargetSelection) -> Self {
|
||||
Self { target, crates: vec![], override_build_kind: None }
|
||||
}
|
||||
|
|
@ -47,11 +49,13 @@ impl Step for Std {
|
|||
|
||||
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)
|
||||
|
||||
let mut run = run;
|
||||
for c in Std::CRATE_OR_DEPS {
|
||||
run = run.crate_or_deps(c);
|
||||
}
|
||||
|
||||
run.path("library").default_condition(stage != 0)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
|
|
@ -66,6 +70,19 @@ impl Step for Std {
|
|||
let compiler = builder.compiler(builder.top_stage, builder.config.build);
|
||||
|
||||
if builder.top_stage == 0 {
|
||||
let mut is_explicitly_called =
|
||||
builder.paths.iter().any(|p| p.starts_with("library") || p.starts_with("std"));
|
||||
|
||||
if !is_explicitly_called {
|
||||
for c in Std::CRATE_OR_DEPS {
|
||||
is_explicitly_called = builder.paths.iter().any(|p| p.starts_with(c));
|
||||
}
|
||||
}
|
||||
|
||||
if is_explicitly_called {
|
||||
eprintln!("WARNING: stage 0 std is precompiled and does nothing during `x check`.");
|
||||
}
|
||||
|
||||
// Reuse the stage0 libstd
|
||||
builder.ensure(compile::Std::new(compiler, target));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2531,12 +2531,8 @@ impl Config {
|
|||
|| bench_stage.is_some();
|
||||
// See https://github.com/rust-lang/compiler-team/issues/326
|
||||
config.stage = match config.cmd {
|
||||
Subcommand::Check { .. } => {
|
||||
flags.stage.or(check_stage).unwrap_or(0)
|
||||
}
|
||||
Subcommand::Clippy { .. } | Subcommand::Fix => {
|
||||
flags.stage.or(check_stage).unwrap_or(1)
|
||||
}
|
||||
Subcommand::Check { .. } => flags.stage.or(check_stage).unwrap_or(0),
|
||||
Subcommand::Clippy { .. } | Subcommand::Fix => flags.stage.or(check_stage).unwrap_or(1),
|
||||
// `download-rustc` only has a speed-up for stage2 builds. Default to stage2 unless explicitly overridden.
|
||||
Subcommand::Doc { .. } => {
|
||||
flags.stage.or(doc_stage).unwrap_or(if download_rustc { 2 } else { 1 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue