Skip to content

Commit 191f594

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 <[email protected]>
1 parent 164e129 commit 191f594

File tree

1 file changed

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

1 file changed

+7
-6
lines changed

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

+7-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,9 @@ impl Step for Rustdoc {
575579
features.push("jemalloc".to_string());
576580
}
577581

578-
let mut cargo = prepare_tool_cargo(
582+
583+
// NOTE: Never modify the rustflags here, it breaks the build cache for other tools!
584+
let cargo = prepare_tool_cargo(
579585
builder,
580586
build_compiler,
581587
Mode::ToolRustc,
@@ -586,11 +592,6 @@ impl Step for Rustdoc {
586592
features.as_slice(),
587593
);
588594

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-
594595
let _guard = builder.msg_tool(
595596
Kind::Build,
596597
Mode::ToolRustc,

0 commit comments

Comments
 (0)