about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2025-02-13 09:57:05 -0500
committerjyn <github@jyn.dev>2025-02-13 10:03:56 -0500
commitf7a03d075fa203eceaee81d730a78913c9ece2d4 (patch)
tree94b3b6c9538e44304fab53a7868eb9986a8747bf
parent4a43094662727040d8522163f295b19d1aed0e49 (diff)
downloadrust-f7a03d075fa203eceaee81d730a78913c9ece2d4.tar.gz
rust-f7a03d075fa203eceaee81d730a78913c9ece2d4.zip
Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump)
"stage 1" for fulldeps means "compile with stage 0, link against stage 1".
But this code wanted to switch on the compiler that's building, not the
compiler that's being tested. Fix the check.

Previously, it would fail with a warning about linker-messages:
```
--- stderr -------------------------------
warning[E0602]: unknown lint: `linker_messages`
   |
   = note: requested on the command line with `-A linker_messages`
   = note: `#[warn(unknown_lints)]` on by default
```
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 825e5452f0e..f645b0e8386 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -1840,6 +1840,14 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
             }
         }
 
+        // FIXME(136096): on macOS, we get linker warnings about duplicate `-lm` flags.
+        // NOTE: `stage > 1` here because `test --stage 1 ui-fulldeps` is a hack that compiles
+        // with stage 0, but links the tests against stage 1.
+        // cfg(bootstrap) - remove only the `stage > 1` check, leave everything else.
+        if suite == "ui-fulldeps" && compiler.stage > 1 && target.ends_with("darwin") {
+            flags.push("-Alinker_messages".into());
+        }
+
         let mut hostflags = flags.clone();
         hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
         hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No));
@@ -1847,12 +1855,6 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
         let mut targetflags = flags;
         targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));
 
-        // FIXME: on macOS, we get linker warnings about duplicate `-lm` flags. We should investigate why this happens.
-        if suite == "ui-fulldeps" && target.ends_with("darwin") {
-            hostflags.push("-Alinker_messages".into());
-            targetflags.push("-Alinker_messages".into());
-        }
-
         for flag in hostflags {
             cmd.arg("--host-rustcflags").arg(flag);
         }