Skip to content

Commit d97c661

Browse files
authored
Rollup merge of rust-lang#131060 - jieyouxu:rmake-rebuild, r=onur-ozkan
Drop conditionally applied cargo `-Zon-broken-pipe=kill` flags to fix stage 1 cargo rebuilds The conditionally applied `-Zon-broken-pipe=kill` flag trigger rebuilds because they can invalidate previous tool build cache due to differing flags. This PR removes those flags to stop tool build cache invalidation. > The build cache for clippy will be broken because bootstrap sets `-Zon-broken-pipe=kill` for every invocation except for cargo. Which means building cargo will invalidate any tool build cache which was built previously. > > *From <https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Modifying.20run-make.20tests.20unnecessarily.20rebuild.20stage.201.20cargo/near/473486972>* Fixes rust-lang#130980. But introduces rust-lang#131059 (breaks 2 cargo tests that relied upon some behavior related to `-Zon-broken-pipe=kill` being set). r? `@onur-ozkan` (or bootstrap)
2 parents 90fdb11 + 5a7058c commit d97c661

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/bootstrap/src/core/build_steps/compile.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1053,10 +1053,6 @@ pub fn rustc_cargo(
10531053

10541054
cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)");
10551055

1056-
// If the rustc output is piped to e.g. `head -n1` we want the process to be
1057-
// killed, rather than having an error bubble up and cause a panic.
1058-
cargo.rustflag("-Zon-broken-pipe=kill");
1059-
10601056
if builder.config.llvm_enzyme {
10611057
cargo.rustflag("-l").rustflag("Enzyme-19");
10621058
}

src/bootstrap/src/core/build_steps/tool.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ pub fn prepare_tool_cargo(
200200
cargo.arg("--features").arg(features.join(", "));
201201
}
202202

203+
// Warning: be very careful with RUSTFLAGS or command-line options, as conditionally applied
204+
// RUSTFLAGS or cli flags can lead to hard-to-diagnose rebuilds due to flag differences, causing
205+
// previous tool build artifacts to get invalidated.
206+
203207
// Enable internal lints for clippy and rustdoc
204208
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
205209
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
@@ -209,13 +213,6 @@ pub fn prepare_tool_cargo(
209213
// See https://github.com/rust-lang/rust/issues/116538
210214
cargo.rustflag("-Zunstable-options");
211215

212-
// `-Zon-broken-pipe=kill` breaks cargo tests
213-
if !path.ends_with("cargo") {
214-
// If the output is piped to e.g. `head -n1` we want the process to be killed,
215-
// rather than having an error bubble up and cause a panic.
216-
cargo.rustflag("-Zon-broken-pipe=kill");
217-
}
218-
219216
cargo
220217
}
221218

0 commit comments

Comments
 (0)