Auto merge of #126934 - onur-ozkan:broken-build-cache, r=Kobzol
fix broken build cache caused by rustdoc builds Currently rustdoc breaks the build cache (due to having different rustflags) when building rustdoc before building another tool (e.g., `x test miri && x test rustdoc && x test miri`). This change fixes that by moving `on-broken-pipe` into `prepare_cargo_tool` so it is set for all tools. cc `@RalfJung` Fixes #123177
This commit is contained in:
commit
bae813a265
@ -211,6 +211,13 @@ pub fn prepare_tool_cargo(
|
||||
// See https://github.com/rust-lang/rust/issues/116538
|
||||
cargo.rustflag("-Zunstable-options");
|
||||
|
||||
// `-Zon-broken-pipe=kill` breaks cargo tests
|
||||
if !path.ends_with("cargo") {
|
||||
// If the output is piped to e.g. `head -n1` we want the process to be killed,
|
||||
// rather than having an error bubble up and cause a panic.
|
||||
cargo.rustflag("-Zon-broken-pipe=kill");
|
||||
}
|
||||
|
||||
cargo
|
||||
}
|
||||
|
||||
@ -575,7 +582,8 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
features.push("jemalloc".to_string());
|
||||
}
|
||||
|
||||
let mut cargo = prepare_tool_cargo(
|
||||
// NOTE: Never modify the rustflags here, it breaks the build cache for other tools!
|
||||
let cargo = prepare_tool_cargo(
|
||||
builder,
|
||||
build_compiler,
|
||||
Mode::ToolRustc,
|
||||
@ -586,11 +594,6 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
features.as_slice(),
|
||||
);
|
||||
|
||||
// If the rustdoc output is piped to e.g. `head -n1` we want the process
|
||||
// to be killed, rather than having an error bubble up and cause a
|
||||
// panic.
|
||||
cargo.rustflag("-Zon-broken-pipe=kill");
|
||||
|
||||
let _guard = builder.msg_tool(
|
||||
Kind::Build,
|
||||
Mode::ToolRustc,
|
||||
|
Loading…
Reference in New Issue
Block a user