about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-09-30 17:07:24 +0800
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-09-30 19:09:29 +0800
commit5a7058c5a542ec42d1fa9b524f7b4f7d6845d1e9 (patch)
tree7d932a503ac758ee85b9e8078887a67a2f850d26
parente9df22f51d2f0f062d0beb83a28c8c76883d2ceb (diff)
downloadrust-5a7058c5a542ec42d1fa9b524f7b4f7d6845d1e9.tar.gz
rust-5a7058c5a542ec42d1fa9b524f7b4f7d6845d1e9.zip
Drop conditionally applied cargo `-Zon-broken-pipe=kill` flags
These conditionally applied flags trigger rebuilds because they can
invalidate previous cargo build cache.
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs4
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs11
2 files changed, 4 insertions, 11 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index eaa982d4e2b..bb1d8d27928 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1053,10 +1053,6 @@ pub fn rustc_cargo(
 
     cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)");
 
-    // If the rustc 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");
-
     if builder.config.llvm_enzyme {
         cargo.rustflag("-l").rustflag("Enzyme-19");
     }
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 64dfe054d9c..fa2c1b8360f 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -200,6 +200,10 @@ pub fn prepare_tool_cargo(
         cargo.arg("--features").arg(features.join(", "));
     }
 
+    // Warning: be very careful with RUSTFLAGS or command-line options, as conditionally applied
+    // RUSTFLAGS or cli flags can lead to hard-to-diagnose rebuilds due to flag differences, causing
+    // previous tool build artifacts to get invalidated.
+
     // Enable internal lints for clippy and rustdoc
     // NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
     // See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
@@ -209,13 +213,6 @@ 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
 }