Rollup merge of #136973 - jyn514:fulldeps-stage1, r=jieyouxu

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
```

cc https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/unknown.20lint.3A.20.60linker_messages.60.20when.20blessing.20tests.20on.20.2E.2E.2E, https://github.com/rust-lang/rust/pull/136960
This commit is contained in:
Jubilee 2025-02-13 17:46:13 -08:00 committed by GitHub
commit 6eb39294d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1846,6 +1846,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(); let mut hostflags = flags.clone();
hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No)); hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No));
@ -1853,12 +1861,6 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
let mut targetflags = flags; let mut targetflags = flags;
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); 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 { for flag in hostflags {
cmd.arg("--host-rustcflags").arg(flag); cmd.arg("--host-rustcflags").arg(flag);
} }