about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-30 13:33:35 +0000
committerbors <bors@rust-lang.org>2024-09-30 13:33:35 +0000
commitc3ce4e66a5732a5b89c9f495b44357bf6b29d424 (patch)
tree77e54d4034ab2dba3738a4fee99f64c3ab408f40 /src
parentb529e278bbbeb706e70ee6138939b6361ad53bd3 (diff)
parent5ba81d723ae1bd13d496b52d2f02e53b583de752 (diff)
Auto merge of #131063 - matthiaskrgr:rollup-hfs3fo1, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #130895 (make type-check-4 asm tests about non-const expressions)
 - #131057 (Reject leading unsafe in `cfg!(...)` and `--check-cfg`)
 - #131060 (Drop conditionally applied cargo `-Zon-broken-pipe=kill` flags to fix stage 1 cargo rebuilds)
 - #131061 (replace manual verbose checks with `Config::is_verbose`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs4
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs11
-rw-r--r--src/bootstrap/src/core/builder.rs4
-rw-r--r--src/bootstrap/src/core/config/config.rs6
4 files changed, 9 insertions, 16 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
 }
 
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 6ba669f3b10..77cfd404744 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -1564,8 +1564,8 @@ impl<'a> Builder<'a> {
         let libdir = self.rustc_libdir(compiler);
 
         let sysroot_str = sysroot.as_os_str().to_str().expect("sysroot should be UTF-8");
-        if !matches!(self.config.dry_run, DryRun::SelfCheck) {
-            self.verbose_than(0, || println!("using sysroot {sysroot_str}"));
+        if self.is_verbose() && !matches!(self.config.dry_run, DryRun::SelfCheck) {
+            println!("using sysroot {sysroot_str}");
         }
 
         let mut rustflags = Rustflags::new(target);
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 3c0afb858f8..07460b81412 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -2450,7 +2450,7 @@ impl Config {
 
     /// Runs a function if verbosity is greater than 0
     pub fn verbose(&self, f: impl Fn()) {
-        if self.verbose > 0 {
+        if self.is_verbose() {
             f()
         }
     }
@@ -2735,7 +2735,7 @@ impl Config {
         .success();
         if has_changes {
             if if_unchanged {
-                if self.verbose > 0 {
+                if self.is_verbose() {
                     println!(
                         "WARNING: saw changes to compiler/ or library/ since {commit}; \
                             ignoring `download-rustc`"
@@ -2832,7 +2832,7 @@ impl Config {
         let has_changes = !t!(git.as_command_mut().status()).success();
         if has_changes {
             if if_unchanged {
-                if self.verbose > 0 {
+                if self.is_verbose() {
                     println!(
                         "warning: saw changes to one of {modified_paths:?} since {commit}; \
                             ignoring `{option_name}`"