Skip to content

Commit

Permalink
Rollup merge of rust-lang#126934 - onur-ozkan:broken-build-cache, r=K…
Browse files Browse the repository at this point in the history
…obzol

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 rust-lang#123177
  • Loading branch information
compiler-errors committed Jun 25, 2024
2 parents a9a4777 + 2e017f4 commit f0339ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ pub fn prepare_tool_cargo(
// See https://github.com/rust-lang/rust/issues/116538
cargo.rustflag("-Zunstable-options");

// 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
}

Expand Down Expand Up @@ -575,7 +579,8 @@ impl Step for Rustdoc {
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,
Expand All @@ -586,11 +591,6 @@ impl Step for Rustdoc {
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,
Expand Down

0 comments on commit f0339ac

Please sign in to comment.