mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-09 05:38:32 +00:00
Auto merge of #142002 - onur-ozkan:follow-ups2, r=jieyouxu
redesign stage 0 std follow-ups part2 Fixes three bugs: 1. `x check` fails when run on rustdoc without `download-rustc` enabled. (1st commit) 2. `x check` fails when run on the compiler with `download-rustc` enabled. (2nd commit) 3. `x test library` fails with `download-rustc` enabled. (3rd commit) Fixes rust-lang/rust#142018 (case 1) Fixes https://github.com/rust-lang/rust/issues/141983 (case 3)
This commit is contained in:
commit
df8102fe5f
@ -28,13 +28,16 @@ pub struct Std {
|
|||||||
/// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
|
/// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
|
||||||
/// which is not useful if we only want to lint a few crates with specific rules.
|
/// which is not useful if we only want to lint a few crates with specific rules.
|
||||||
override_build_kind: Option<Kind>,
|
override_build_kind: Option<Kind>,
|
||||||
|
/// Never use this from outside calls. It is intended for internal use only within `check::Std::make_run`
|
||||||
|
/// and `check::Std::run`.
|
||||||
|
custom_stage: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Std {
|
impl Std {
|
||||||
const CRATE_OR_DEPS: &[&str] = &["sysroot", "coretests", "alloctests"];
|
const CRATE_OR_DEPS: &[&str] = &["sysroot", "coretests", "alloctests"];
|
||||||
|
|
||||||
pub fn new(target: TargetSelection) -> Self {
|
pub fn new(target: TargetSelection) -> Self {
|
||||||
Self { target, crates: vec![], override_build_kind: None }
|
Self { target, crates: vec![], override_build_kind: None, custom_stage: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_kind(mut self, kind: Option<Kind>) -> Self {
|
pub fn build_kind(mut self, kind: Option<Kind>) -> Self {
|
||||||
@ -48,34 +51,35 @@ impl Step for Std {
|
|||||||
const DEFAULT: bool = true;
|
const DEFAULT: bool = true;
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
let builder = run.builder;
|
|
||||||
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
|
|
||||||
builder.top_stage
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut run = run;
|
let mut run = run;
|
||||||
for c in Std::CRATE_OR_DEPS {
|
for c in Std::CRATE_OR_DEPS {
|
||||||
run = run.crate_or_deps(c);
|
run = run.crate_or_deps(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
run.path("library").default_condition(stage != 0)
|
run.path("library")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
let crates = std_crates_for_run_make(&run);
|
let crates = std_crates_for_run_make(&run);
|
||||||
run.builder.ensure(Std { target: run.target, crates, override_build_kind: None });
|
|
||||||
|
let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 1 {
|
||||||
|
run.builder.top_stage
|
||||||
|
} else {
|
||||||
|
1
|
||||||
|
};
|
||||||
|
|
||||||
|
run.builder.ensure(Std {
|
||||||
|
target: run.target,
|
||||||
|
crates,
|
||||||
|
override_build_kind: None,
|
||||||
|
custom_stage: Some(stage),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
builder.require_submodule("library/stdarch", None);
|
builder.require_submodule("library/stdarch", None);
|
||||||
|
|
||||||
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
|
let stage = self.custom_stage.unwrap_or(builder.top_stage);
|
||||||
builder.top_stage
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
};
|
|
||||||
|
|
||||||
let target = self.target;
|
let target = self.target;
|
||||||
let compiler = builder.compiler(stage, builder.config.build);
|
let compiler = builder.compiler(stage, builder.config.build);
|
||||||
|
@ -2707,16 +2707,6 @@ impl Step for Crate {
|
|||||||
.arg(builder.src.join("library/sysroot/Cargo.toml"));
|
.arg(builder.src.join("library/sysroot/Cargo.toml"));
|
||||||
} else {
|
} else {
|
||||||
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
|
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||||
// `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
|
|
||||||
// but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
|
|
||||||
// Override it.
|
|
||||||
if builder.download_rustc() && compiler.stage > 0 {
|
|
||||||
let sysroot = builder
|
|
||||||
.out
|
|
||||||
.join(compiler.host)
|
|
||||||
.join(format!("stage{}-test-sysroot", compiler.stage));
|
|
||||||
cargo.env("RUSTC_SYSROOT", sysroot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mode::Rustc => {
|
Mode::Rustc => {
|
||||||
|
@ -945,7 +945,6 @@ impl<'a> Builder<'a> {
|
|||||||
clippy::CI,
|
clippy::CI,
|
||||||
),
|
),
|
||||||
Kind::Check | Kind::Fix => describe!(
|
Kind::Check | Kind::Fix => describe!(
|
||||||
check::Std,
|
|
||||||
check::Rustc,
|
check::Rustc,
|
||||||
check::Rustdoc,
|
check::Rustdoc,
|
||||||
check::CodegenBackend,
|
check::CodegenBackend,
|
||||||
@ -961,6 +960,13 @@ impl<'a> Builder<'a> {
|
|||||||
check::Compiletest,
|
check::Compiletest,
|
||||||
check::FeaturesStatusDump,
|
check::FeaturesStatusDump,
|
||||||
check::CoverageDump,
|
check::CoverageDump,
|
||||||
|
// This has special staging logic, it may run on stage 1 while others run on stage 0.
|
||||||
|
// It takes quite some time to build stage 1, so put this at the end.
|
||||||
|
//
|
||||||
|
// FIXME: This also helps bootstrap to not interfere with stage 0 builds. We should probably fix
|
||||||
|
// that issue somewhere else, but we still want to keep `check::Std` at the end so that the
|
||||||
|
// quicker steps run before this.
|
||||||
|
check::Std,
|
||||||
),
|
),
|
||||||
Kind::Test => describe!(
|
Kind::Test => describe!(
|
||||||
crate::core::build_steps::toolstate::ToolStateCheck,
|
crate::core::build_steps::toolstate::ToolStateCheck,
|
||||||
|
Loading…
Reference in New Issue
Block a user