Rollup merge of #106387 - jyn514:clippy, r=Mark-Simulacrum

Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`"

This reverts commit 9dfe50440e. (Note: that merged as part of https://github.com/rust-lang/rust/pull/106305, but https://github.com/rust-lang/rust/pull/106305/ contains more commits than just 9dfe50440e6d48bd2fd40a4b7b3992998e55eace.)

Fixes `x clippy`. It turns out `clippy` was the only one using `tail_args` 🤦 sorry for not testing this earlier.

r? `@Mark-Simulacrum`
This commit is contained in:
Yuki Okushi 2023-01-10 08:05:35 +09:00 committed by GitHub
commit b102673698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 14 deletions

View File

@ -99,13 +99,20 @@ fn run(self, builder: &Builder<'_>) {
cargo_subcommand(builder.kind), cargo_subcommand(builder.kind),
); );
std_cargo(builder, target, compiler.stage, &mut cargo); std_cargo(builder, target, compiler.stage, &mut cargo);
cargo.args(args(builder));
builder.info(&format!( builder.info(&format!(
"Checking stage{} library artifacts ({} -> {})", "Checking stage{} library artifacts ({} -> {})",
builder.top_stage, &compiler.host, target builder.top_stage, &compiler.host, target
)); ));
run_cargo(builder, cargo, &libstd_stamp(builder, compiler, target), vec![], true, false); run_cargo(
builder,
cargo,
args(builder),
&libstd_stamp(builder, compiler, target),
vec![],
true,
false,
);
// We skip populating the sysroot in non-zero stage because that'll lead // We skip populating the sysroot in non-zero stage because that'll lead
// to rlib/rmeta conflicts if std gets built during this session. // to rlib/rmeta conflicts if std gets built during this session.
@ -149,7 +156,6 @@ fn run(self, builder: &Builder<'_>) {
for krate in builder.in_tree_crates("test", Some(target)) { for krate in builder.in_tree_crates("test", Some(target)) {
cargo.arg("-p").arg(krate.name); cargo.arg("-p").arg(krate.name);
} }
cargo.args(args(builder));
builder.info(&format!( builder.info(&format!(
"Checking stage{} library test/bench/example targets ({} -> {})", "Checking stage{} library test/bench/example targets ({} -> {})",
@ -158,6 +164,7 @@ fn run(self, builder: &Builder<'_>) {
run_cargo( run_cargo(
builder, builder,
cargo, cargo,
args(builder),
&libstd_test_stamp(builder, compiler, target), &libstd_test_stamp(builder, compiler, target),
vec![], vec![],
true, true,
@ -226,13 +233,20 @@ fn run(self, builder: &Builder<'_>) {
for krate in builder.in_tree_crates("rustc-main", Some(target)) { for krate in builder.in_tree_crates("rustc-main", Some(target)) {
cargo.arg("-p").arg(krate.name); cargo.arg("-p").arg(krate.name);
} }
cargo.args(args(builder));
builder.info(&format!( builder.info(&format!(
"Checking stage{} compiler artifacts ({} -> {})", "Checking stage{} compiler artifacts ({} -> {})",
builder.top_stage, &compiler.host, target builder.top_stage, &compiler.host, target
)); ));
run_cargo(builder, cargo, &librustc_stamp(builder, compiler, target), vec![], true, false); run_cargo(
builder,
cargo,
args(builder),
&librustc_stamp(builder, compiler, target),
vec![],
true,
false,
);
let libdir = builder.sysroot_libdir(compiler, target); let libdir = builder.sysroot_libdir(compiler, target);
let hostdir = builder.sysroot_libdir(compiler, compiler.host); let hostdir = builder.sysroot_libdir(compiler, compiler.host);
@ -279,7 +293,6 @@ fn run(self, builder: &Builder<'_>) {
.arg("--manifest-path") .arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend))); .arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
rustc_cargo_env(builder, &mut cargo, target); rustc_cargo_env(builder, &mut cargo, target);
cargo.args(args(builder));
builder.info(&format!( builder.info(&format!(
"Checking stage{} {} artifacts ({} -> {})", "Checking stage{} {} artifacts ({} -> {})",
@ -289,6 +302,7 @@ fn run(self, builder: &Builder<'_>) {
run_cargo( run_cargo(
builder, builder,
cargo, cargo,
args(builder),
&codegen_backend_stamp(builder, compiler, target, backend), &codegen_backend_stamp(builder, compiler, target, backend),
vec![], vec![],
true, true,
@ -345,13 +359,19 @@ fn run(self, builder: &Builder<'_>) {
cargo.arg("--benches"); cargo.arg("--benches");
} }
cargo.args(args(builder));
builder.info(&format!( builder.info(&format!(
"Checking stage{} {} artifacts ({} -> {})", "Checking stage{} {} artifacts ({} -> {})",
compiler.stage, "rust-analyzer", &compiler.host.triple, target.triple compiler.stage, "rust-analyzer", &compiler.host.triple, target.triple
)); ));
run_cargo(builder, cargo, &stamp(builder, compiler, target), vec![], true, false); run_cargo(
builder,
cargo,
args(builder),
&stamp(builder, compiler, target),
vec![],
true,
false,
);
/// Cargo's output path in a given stage, compiled by a particular /// Cargo's output path in a given stage, compiled by a particular
/// compiler for the specified target. /// compiler for the specified target.
@ -405,8 +425,6 @@ fn run(self, builder: &Builder<'_>) {
cargo.arg("--all-targets"); cargo.arg("--all-targets");
} }
cargo.args(args(builder));
// 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)]`
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776 // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
@ -422,6 +440,7 @@ fn run(self, builder: &Builder<'_>) {
run_cargo( run_cargo(
builder, builder,
cargo, cargo,
args(builder),
&stamp(builder, compiler, target), &stamp(builder, compiler, target),
vec![], vec![],
true, true,

View File

@ -144,6 +144,7 @@ fn run(self, builder: &Builder<'_>) {
run_cargo( run_cargo(
builder, builder,
cargo, cargo,
vec![],
&libstd_stamp(builder, compiler, target), &libstd_stamp(builder, compiler, target),
target_deps, target_deps,
false, false,
@ -738,6 +739,7 @@ fn run(self, builder: &Builder<'_>) {
run_cargo( run_cargo(
builder, builder,
cargo, cargo,
vec![],
&librustc_stamp(builder, compiler, target), &librustc_stamp(builder, compiler, target),
vec![], vec![],
false, false,
@ -998,7 +1000,7 @@ fn run(self, builder: &Builder<'_>) {
"Building stage{} codegen backend {} ({} -> {})", "Building stage{} codegen backend {} ({} -> {})",
compiler.stage, backend, &compiler.host, target compiler.stage, backend, &compiler.host, target
)); ));
let files = run_cargo(builder, cargo, &tmp_stamp, vec![], false, false); let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false);
if builder.config.dry_run() { if builder.config.dry_run() {
return; return;
} }
@ -1422,6 +1424,7 @@ pub fn add_to_sysroot(
pub fn run_cargo( pub fn run_cargo(
builder: &Builder<'_>, builder: &Builder<'_>,
cargo: Cargo, cargo: Cargo,
tail_args: Vec<String>,
stamp: &Path, stamp: &Path,
additional_target_deps: Vec<(PathBuf, DependencyType)>, additional_target_deps: Vec<(PathBuf, DependencyType)>,
is_check: bool, is_check: bool,
@ -1448,7 +1451,7 @@ pub fn run_cargo(
// files we need to probe for later. // files we need to probe for later.
let mut deps = Vec::new(); let mut deps = Vec::new();
let mut toplevel = Vec::new(); let mut toplevel = Vec::new();
let ok = stream_cargo(builder, cargo, &mut |msg| { let ok = stream_cargo(builder, cargo, tail_args, &mut |msg| {
let (filenames, crate_types) = match msg { let (filenames, crate_types) = match msg {
CargoMessage::CompilerArtifact { CargoMessage::CompilerArtifact {
filenames, filenames,
@ -1585,6 +1588,7 @@ pub fn run_cargo(
pub fn stream_cargo( pub fn stream_cargo(
builder: &Builder<'_>, builder: &Builder<'_>,
cargo: Cargo, cargo: Cargo,
tail_args: Vec<String>,
cb: &mut dyn FnMut(CargoMessage<'_>), cb: &mut dyn FnMut(CargoMessage<'_>),
) -> bool { ) -> bool {
let mut cargo = Command::from(cargo); let mut cargo = Command::from(cargo);
@ -1604,6 +1608,10 @@ pub fn stream_cargo(
} }
cargo.arg("--message-format").arg(message_format).stdout(Stdio::piped()); cargo.arg("--message-format").arg(message_format).stdout(Stdio::piped());
for arg in tail_args {
cargo.arg(arg);
}
builder.verbose(&format!("running: {:?}", cargo)); builder.verbose(&format!("running: {:?}", cargo));
let mut child = match cargo.spawn() { let mut child = match cargo.spawn() {
Ok(child) => child, Ok(child) => child,

View File

@ -72,7 +72,7 @@ fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
let mut duplicates = Vec::new(); let mut duplicates = Vec::new();
let is_expected = compile::stream_cargo(builder, cargo, &mut |msg| { let is_expected = compile::stream_cargo(builder, cargo, vec![], &mut |msg| {
// Only care about big things like the RLS/Cargo for now // Only care about big things like the RLS/Cargo for now
match tool { match tool {
"rls" | "cargo" | "clippy-driver" | "miri" | "rustfmt" => {} "rls" | "cargo" | "clippy-driver" | "miri" | "rustfmt" => {}