summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/check.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/check.rs')
-rw-r--r--src/bootstrap/check.rs100
1 files changed, 15 insertions, 85 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index fcaa69831..b11be96ce 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -20,15 +20,7 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
arr.iter().copied().map(String::from)
}
- if let Subcommand::Clippy {
- fix,
- clippy_lint_allow,
- clippy_lint_deny,
- clippy_lint_warn,
- clippy_lint_forbid,
- ..
- } = &builder.config.cmd
- {
+ if let Subcommand::Clippy { fix, allow, deny, warn, forbid, .. } = &builder.config.cmd {
// disable the most spammy clippy lints
let ignored_lints = vec![
"many_single_char_names", // there are a lot in stdarch
@@ -53,10 +45,10 @@ fn args(builder: &Builder<'_>) -> Vec<String> {
args.extend(strings(&["--", "--cap-lints", "warn"]));
args.extend(ignored_lints.iter().map(|lint| format!("-Aclippy::{}", lint)));
let mut clippy_lint_levels: Vec<String> = Vec::new();
- clippy_lint_allow.iter().for_each(|v| clippy_lint_levels.push(format!("-A{}", v)));
- clippy_lint_deny.iter().for_each(|v| clippy_lint_levels.push(format!("-D{}", v)));
- clippy_lint_warn.iter().for_each(|v| clippy_lint_levels.push(format!("-W{}", v)));
- clippy_lint_forbid.iter().for_each(|v| clippy_lint_levels.push(format!("-F{}", v)));
+ allow.iter().for_each(|v| clippy_lint_levels.push(format!("-A{}", v)));
+ deny.iter().for_each(|v| clippy_lint_levels.push(format!("-D{}", v)));
+ warn.iter().for_each(|v| clippy_lint_levels.push(format!("-W{}", v)));
+ forbid.iter().for_each(|v| clippy_lint_levels.push(format!("-F{}", v)));
args.extend(clippy_lint_levels);
args.extend(builder.config.free_args.clone());
args
@@ -79,7 +71,7 @@ impl Step for Std {
const DEFAULT: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- run.all_krates("test").path("library")
+ run.all_krates("sysroot").path("library")
}
fn make_run(run: RunConfig<'_>) {
@@ -105,15 +97,7 @@ impl Step for Std {
cargo.arg("--lib");
}
- let msg = if compiler.host == target {
- format!("Checking stage{} library artifacts ({target})", builder.top_stage)
- } else {
- format!(
- "Checking stage{} library artifacts ({} -> {})",
- builder.top_stage, &compiler.host, target
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check("library artifacts", target);
run_cargo(
builder,
cargo,
@@ -167,18 +151,7 @@ impl Step for Std {
cargo.arg("-p").arg(krate.name);
}
- let msg = if compiler.host == target {
- format!(
- "Checking stage{} library test/bench/example targets ({target})",
- builder.top_stage
- )
- } else {
- format!(
- "Checking stage{} library test/bench/example targets ({} -> {})",
- builder.top_stage, &compiler.host, target
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check("library test/bench/example targets", target);
run_cargo(
builder,
cargo,
@@ -252,15 +225,7 @@ impl Step for Rustc {
cargo.arg("-p").arg(krate.name);
}
- let msg = if compiler.host == target {
- format!("Checking stage{} compiler artifacts ({target})", builder.top_stage)
- } else {
- format!(
- "Checking stage{} compiler artifacts ({} -> {})",
- builder.top_stage, &compiler.host, target
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check("compiler artifacts", target);
run_cargo(
builder,
cargo,
@@ -271,17 +236,9 @@ impl Step for Rustc {
false,
);
- // HACK: This avoids putting the newly built artifacts in the sysroot if we're using
- // `download-rustc`, to avoid "multiple candidates for `rmeta`" errors. Technically, that's
- // not quite right: people can set `download-rustc = true` to download even if there are
- // changes to the compiler, and in that case ideally we would put the *new* artifacts in the
- // sysroot, in case there are API changes that should be used by tools. In practice,
- // though, that should be very uncommon, and people can still disable download-rustc.
- if !builder.download_rustc() {
- let libdir = builder.sysroot_libdir(compiler, target);
- let hostdir = builder.sysroot_libdir(compiler, compiler.host);
- add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
- }
+ let libdir = builder.sysroot_libdir(compiler, target);
+ let hostdir = builder.sysroot_libdir(compiler, compiler.host);
+ add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
}
}
@@ -325,15 +282,7 @@ impl Step for CodegenBackend {
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
rustc_cargo_env(builder, &mut cargo, target, compiler.stage);
- let msg = if compiler.host == target {
- format!("Checking stage{} {} artifacts ({target})", builder.top_stage, backend)
- } else {
- format!(
- "Checking stage{} {} library ({} -> {})",
- builder.top_stage, backend, &compiler.host.triple, target.triple
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check(&backend, target);
run_cargo(
builder,
@@ -393,15 +342,7 @@ impl Step for RustAnalyzer {
cargo.arg("--benches");
}
- let msg = if compiler.host == target {
- format!("Checking stage{} {} artifacts ({target})", compiler.stage, "rust-analyzer")
- } else {
- format!(
- "Checking stage{} {} artifacts ({} -> {})",
- compiler.stage, "rust-analyzer", &compiler.host.triple, target.triple
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check("rust-analyzer artifacts", target);
run_cargo(
builder,
cargo,
@@ -468,18 +409,7 @@ macro_rules! tool_check_step {
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
cargo.rustflag("-Zunstable-options");
- let msg = if compiler.host == target {
- format!("Checking stage{} {} artifacts ({target})", builder.top_stage, stringify!($name).to_lowercase())
- } else {
- format!(
- "Checking stage{} {} artifacts ({} -> {})",
- builder.top_stage,
- stringify!($name).to_lowercase(),
- &compiler.host.triple,
- target.triple
- )
- };
- builder.info(&msg);
+ let _guard = builder.msg_check(&concat!(stringify!($name), " artifacts").to_lowercase(), target);
run_cargo(
builder,
cargo,