Skip to content

Commit 2e017f4

Browse files
committed
set on-broken-pipe in prepare_cargo_tool
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. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 164e129 commit 2e017f4

File tree

1 file changed

+6
-6
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+6
-6
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ pub fn prepare_tool_cargo(
211211
// See https://github.com/rust-lang/rust/issues/116538
212212
cargo.rustflag("-Zunstable-options");
213213

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+
214218
cargo
215219
}
216220

@@ -575,7 +579,8 @@ impl Step for Rustdoc {
575579
features.push("jemalloc".to_string());
576580
}
577581

578-
let mut cargo = prepare_tool_cargo(
582+
// NOTE: Never modify the rustflags here, it breaks the build cache for other tools!
583+
let cargo = prepare_tool_cargo(
579584
builder,
580585
build_compiler,
581586
Mode::ToolRustc,
@@ -586,11 +591,6 @@ impl Step for Rustdoc {
586591
features.as_slice(),
587592
);
588593

589-
// If the rustdoc output is piped to e.g. `head -n1` we want the process
590-
// to be killed, rather than having an error bubble up and cause a
591-
// panic.
592-
cargo.rustflag("-Zon-broken-pipe=kill");
593-
594594
let _guard = builder.msg_tool(
595595
Kind::Build,
596596
Mode::ToolRustc,

0 commit comments

Comments
 (0)