Rollup merge of #88011 - jyn514:check-all-targets, r=Mark-Simulacrum
Enable `--all-targets` for `x.py check` unconditionally Now that Cargo deduplicates diagnostics from different targets, this doesn't flood the console with duplicate errors. Note that this doesn't add `--all-targets` in `Builder::cargo` directly because `impl Step for Std` actually wants to omit `--all-targets` the first time while it's still building libtest. When passed `--all-targets`, this warns that the option isn't needed, but still continues to compile. Fixes https://github.com/rust-lang/rust/issues/87846. r? ``@Mark-Simulacrum``
This commit is contained in:
commit
fe71be7f34
3 changed files with 36 additions and 42 deletions
|
@ -578,7 +578,7 @@ impl<'a> Builder<'a> {
|
||||||
pub fn new(build: &Build) -> Builder<'_> {
|
pub fn new(build: &Build) -> Builder<'_> {
|
||||||
let (kind, paths) = match build.config.cmd {
|
let (kind, paths) = match build.config.cmd {
|
||||||
Subcommand::Build { ref paths } => (Kind::Build, &paths[..]),
|
Subcommand::Build { ref paths } => (Kind::Build, &paths[..]),
|
||||||
Subcommand::Check { ref paths, all_targets: _ } => (Kind::Check, &paths[..]),
|
Subcommand::Check { ref paths } => (Kind::Check, &paths[..]),
|
||||||
Subcommand::Clippy { ref paths, .. } => (Kind::Clippy, &paths[..]),
|
Subcommand::Clippy { ref paths, .. } => (Kind::Clippy, &paths[..]),
|
||||||
Subcommand::Fix { ref paths } => (Kind::Fix, &paths[..]),
|
Subcommand::Fix { ref paths } => (Kind::Fix, &paths[..]),
|
||||||
Subcommand::Doc { ref paths, .. } => (Kind::Doc, &paths[..]),
|
Subcommand::Doc { ref paths, .. } => (Kind::Doc, &paths[..]),
|
||||||
|
|
|
@ -113,8 +113,6 @@ impl Step for Std {
|
||||||
// since we initialize with an empty sysroot.
|
// since we initialize with an empty sysroot.
|
||||||
//
|
//
|
||||||
// Currently only the "libtest" tree of crates does this.
|
// Currently only the "libtest" tree of crates does this.
|
||||||
|
|
||||||
if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd {
|
|
||||||
let mut cargo = builder.cargo(
|
let mut cargo = builder.cargo(
|
||||||
compiler,
|
compiler,
|
||||||
Mode::Std,
|
Mode::Std,
|
||||||
|
@ -122,8 +120,8 @@ impl Step for Std {
|
||||||
target,
|
target,
|
||||||
cargo_subcommand(builder.kind),
|
cargo_subcommand(builder.kind),
|
||||||
);
|
);
|
||||||
std_cargo(builder, target, compiler.stage, &mut cargo);
|
|
||||||
cargo.arg("--all-targets");
|
cargo.arg("--all-targets");
|
||||||
|
std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||||
|
|
||||||
// Explicitly pass -p for all dependencies krates -- this will force cargo
|
// Explicitly pass -p for all dependencies krates -- this will force cargo
|
||||||
// to also check the tests/benches/examples for these crates, rather
|
// to also check the tests/benches/examples for these crates, rather
|
||||||
|
@ -146,7 +144,6 @@ impl Step for Std {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Rustc {
|
pub struct Rustc {
|
||||||
|
@ -195,9 +192,7 @@ impl Step for Rustc {
|
||||||
cargo_subcommand(builder.kind),
|
cargo_subcommand(builder.kind),
|
||||||
);
|
);
|
||||||
rustc_cargo(builder, &mut cargo, target);
|
rustc_cargo(builder, &mut cargo, target);
|
||||||
if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd {
|
|
||||||
cargo.arg("--all-targets");
|
cargo.arg("--all-targets");
|
||||||
}
|
|
||||||
|
|
||||||
// Explicitly pass -p for all compiler krates -- this will force cargo
|
// Explicitly pass -p for all compiler krates -- this will force cargo
|
||||||
// to also check the tests/benches/examples for these crates, rather
|
// to also check the tests/benches/examples for these crates, rather
|
||||||
|
@ -318,10 +313,7 @@ macro_rules! tool_check_step {
|
||||||
$source_type,
|
$source_type,
|
||||||
&[],
|
&[],
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd {
|
|
||||||
cargo.arg("--all-targets");
|
cargo.arg("--all-targets");
|
||||||
}
|
|
||||||
|
|
||||||
// Enable internal lints for clippy and rustdoc
|
// Enable internal lints for clippy and rustdoc
|
||||||
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
|
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
|
||||||
|
|
|
@ -78,9 +78,6 @@ pub enum Subcommand {
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
},
|
},
|
||||||
Check {
|
Check {
|
||||||
// Whether to run checking over all targets (e.g., unit / integration
|
|
||||||
// tests).
|
|
||||||
all_targets: bool,
|
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
},
|
},
|
||||||
Clippy {
|
Clippy {
|
||||||
|
@ -553,7 +550,12 @@ Arguments:
|
||||||
let cmd = match subcommand.as_str() {
|
let cmd = match subcommand.as_str() {
|
||||||
"build" | "b" => Subcommand::Build { paths },
|
"build" | "b" => Subcommand::Build { paths },
|
||||||
"check" | "c" => {
|
"check" | "c" => {
|
||||||
Subcommand::Check { paths, all_targets: matches.opt_present("all-targets") }
|
if matches.opt_present("all-targets") {
|
||||||
|
eprintln!(
|
||||||
|
"Warning: --all-targets is now on by default and does not need to be passed explicitly."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Subcommand::Check { paths }
|
||||||
}
|
}
|
||||||
"clippy" => Subcommand::Clippy { paths, fix: matches.opt_present("fix") },
|
"clippy" => Subcommand::Clippy { paths, fix: matches.opt_present("fix") },
|
||||||
"fix" => Subcommand::Fix { paths },
|
"fix" => Subcommand::Fix { paths },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue