Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn main() {
eprintln!("{prefix} libdir: {libdir:?}");
}

maybe_dump(format!("stage{stage}-rustc"), &cmd);
maybe_dump(format!("stage{}-rustc", stage + 1), &cmd);

let start = Instant::now();
let (child, status) = {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ fn main() {
// Thus, if we are on stage 0, we explicitly set `--cfg=bootstrap`.
// We also declare that the flag is expected, which we need to do to not
// get warnings about it being unexpected.
if stage == "0" {
if stage == 0 {
cmd.arg("--cfg=bootstrap");
}

maybe_dump(format!("stage{stage}-rustdoc"), &cmd);
maybe_dump(format!("stage{}-rustdoc", stage + 1), &cmd);

if verbose > 1 {
eprintln!(
Expand Down
38 changes: 23 additions & 15 deletions src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl Step for Std {

fn run(self, builder: &Builder<'_>) {
let build_compiler = self.build_compiler;
let stage = build_compiler.stage;
let target = self.target;

let mut cargo = builder::Cargo::new(
Expand All @@ -94,10 +93,12 @@ impl Step for Std {
cargo.arg("-p").arg(krate);
}

let _guard = builder.msg_check(
let _guard = builder.msg(
Kind::Check,
format_args!("library artifacts{}", crate_description(&self.crates)),
Mode::Std,
self.build_compiler,
target,
Some(stage),
);

let stamp = build_stamp::libstd_stamp(builder, build_compiler, target).with_prefix("check");
Expand Down Expand Up @@ -136,7 +137,13 @@ impl Step for Std {

let stamp =
build_stamp::libstd_stamp(builder, build_compiler, target).with_prefix("check-test");
let _guard = builder.msg_check("library test/bench/example targets", target, Some(stage));
let _guard = builder.msg(
Kind::Check,
"library test/bench/example targets",
Mode::Std,
self.build_compiler,
target,
);
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
}

Expand Down Expand Up @@ -227,10 +234,12 @@ impl Step for Rustc {
cargo.arg("-p").arg(krate);
}

let _guard = builder.msg_check(
let _guard = builder.msg(
Kind::Check,
format_args!("compiler artifacts{}", crate_description(&self.crates)),
Mode::Rustc,
self.build_compiler,
target,
None,
);

let stamp =
Expand Down Expand Up @@ -357,7 +366,13 @@ impl Step for CodegenBackend {
.arg(builder.src.join(format!("compiler/{}/Cargo.toml", backend.crate_name())));
rustc_cargo_env(builder, &mut cargo, target);

let _guard = builder.msg_check(backend.crate_name(), target, None);
let _guard = builder.msg(
Kind::Check,
backend.crate_name(),
Mode::Codegen,
self.build_compiler,
target,
);

let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend)
.with_prefix("check");
Expand Down Expand Up @@ -482,14 +497,7 @@ fn run_tool_check_step(
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, mode, target))
.with_prefix(&format!("{display_name}-check"));

let stage = match mode {
// Mode::ToolRustc is included here because of how msg_sysroot_tool prints stages
Mode::Std | Mode::ToolRustc => build_compiler.stage,
_ => build_compiler.stage + 1,
};

let _guard =
builder.msg_tool(builder.kind, mode, display_name, stage, &build_compiler.host, &target);
let _guard = builder.msg(builder.kind, display_name, mode, build_compiler, target);
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn clean_specific_stage(build: &Build, stage: u32) {

for entry in entries {
let entry = t!(entry);
let stage_prefix = format!("stage{stage}");
let stage_prefix = format!("stage{}", stage + 1);

// if current entry is not related with the target stage, continue
if !entry.file_name().to_str().unwrap_or("").contains(&stage_prefix) {
Expand Down
57 changes: 33 additions & 24 deletions src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ impl Step for Std {

fn run(self, builder: &Builder<'_>) {
let target = self.target;
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);

let mut cargo = builder::Cargo::new(
builder,
compiler,
build_compiler,
Mode::Std,
SourceType::InTree,
target,
Expand All @@ -160,14 +160,19 @@ impl Step for Std {
cargo.arg("-p").arg(krate);
}

let _guard =
builder.msg_clippy(format_args!("library{}", crate_description(&self.crates)), target);
let _guard = builder.msg(
Kind::Clippy,
format_args!("library{}", crate_description(&self.crates)),
Mode::Std,
build_compiler,
target,
);

run_cargo(
builder,
cargo,
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
&build_stamp::libstd_stamp(builder, compiler, target),
&build_stamp::libstd_stamp(builder, build_compiler, target),
vec![],
true,
false,
Expand Down Expand Up @@ -203,33 +208,33 @@ impl Step for Rustc {
/// This will lint the compiler for a particular stage of the build using
/// the `compiler` targeting the `target` architecture.
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
let target = self.target;

if !builder.download_rustc() {
if compiler.stage != 0 {
if build_compiler.stage != 0 {
// If we're not in stage 0, then we won't have a std from the beta
// compiler around. That means we need to make sure there's one in
// the sysroot for the compiler to find. Otherwise, we're going to
// fail when building crates that need to generate code (e.g., build
// scripts and their dependencies).
builder.std(compiler, compiler.host);
builder.std(compiler, target);
builder.std(build_compiler, build_compiler.host);
builder.std(build_compiler, target);
} else {
builder.ensure(check::Std::new(compiler, target));
builder.ensure(check::Std::new(build_compiler, target));
}
}

let mut cargo = builder::Cargo::new(
builder,
compiler,
build_compiler,
Mode::Rustc,
SourceType::InTree,
target,
Kind::Clippy,
);

rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates);

// Explicitly pass -p for all compiler crates -- this will force cargo
// to also lint the tests/benches/examples for these crates, rather
Expand All @@ -238,14 +243,19 @@ impl Step for Rustc {
cargo.arg("-p").arg(krate);
}

let _guard =
builder.msg_clippy(format_args!("compiler{}", crate_description(&self.crates)), target);
let _guard = builder.msg(
Kind::Clippy,
format_args!("compiler{}", crate_description(&self.crates)),
Mode::Rustc,
build_compiler,
target,
);

run_cargo(
builder,
cargo,
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
&build_stamp::librustc_stamp(builder, compiler, target),
&build_stamp::librustc_stamp(builder, build_compiler, target),
vec![],
true,
false,
Expand Down Expand Up @@ -284,16 +294,16 @@ macro_rules! lint_any {
}

fn run(self, builder: &Builder<'_>) -> Self::Output {
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
let target = self.target;

if !builder.download_rustc() {
builder.ensure(check::Rustc::new(builder, compiler, target));
builder.ensure(check::Rustc::new(builder, build_compiler, target));
};

let cargo = prepare_tool_cargo(
builder,
compiler,
build_compiler,
Mode::ToolRustc,
target,
Kind::Clippy,
Expand All @@ -302,17 +312,16 @@ macro_rules! lint_any {
&[],
);

let _guard = builder.msg_tool(
let _guard = builder.msg(
Kind::Clippy,
Mode::ToolRustc,
$readable_name,
compiler.stage,
&compiler.host,
&target,
Mode::ToolRustc,
build_compiler,
target,
);

let stringified_name = stringify!($name).to_lowercase();
let stamp = BuildStamp::new(&builder.cargo_out(compiler, Mode::ToolRustc, target))
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::ToolRustc, target))
.with_prefix(&format!("{}-check", stringified_name));

run_cargo(
Expand Down
Loading
Loading