Commit graph

7537 commits

Author SHA1 Message Date
Guillaume Gomez
2abca9c43f
Rollup merge of #144125 - GuillaumeGomez:new-annotations, r=Kobzol
Add new `ignore-backends` and `needs-backends` tests annotations

Part of https://github.com/rust-lang/compiler-team/issues/891.

Next step will be to add these annotations in the files where either the output is different based on the codegen (like `asm` tests) or that are known to fail in the GCC backend.

cc `@oli-obk` `@antoyo`
r? `@Kobzol`
2025-07-20 15:34:07 +02:00
Guillaume Gomez
cb6542e7e3
Rollup merge of #144112 - Enselic:no-debuginfo-in-codegen, r=Mark-Simulacrum
bootstrap: Ignore `rust.debuginfo-level-tests` for codegen tests

As dicussed in https://github.com/rust-lang/rust/issues/61117#issuecomment-495587364, codegen tests typically depend on the raw LLVM IR output and are sensitive to debuginfo level. So do not apply `rust.debuginfo-level-tests` for codegen tests.

Before this commit:

    $ ./x test --set rust.debuginfo-level-tests=2 tests/codegen --force-rerun
    test result: FAILED. 654 passed; 136 failed; 75 ignored; 0 measured; 0 filtered out; finished in 3.22s

After this commit:

    $ ./x test --set rust.debuginfo-level-tests=2 tests/codegen --force-rerun
    NOTE: ignoring `rust.debuginfo-level-tests=2` for codegen tests
    test result: ok. 790 passed; 0 failed; 75 ignored; 0 measured; 0 filtered out; finished in 3.21s

### Run this in CI?

Maybe it will make sense to add this to CI later but I think it is too early to do now before more non-codegen tests work with `rust.debuginfo-level-tests=2`.
2025-07-20 15:34:06 +02:00
Guillaume Gomez
2a4a4112b3
Rollup merge of #144011 - Zalathar:check-compiler-no-llvm, r=Kobzol
bootstrap: Don't trigger an unnecessary LLVM build from check builds

Coming back to r-l/r development after a few weeks away, I found a major regression in my dev workflows: running `x check compiler` (either manually or via rust-analyzer) would have the side-effect of building LLVM, even though that shouldn't be necessary.

For my main build directory this would be a minor annoyance, but for my separate rust-analyzer build directory it's a huge problem because it causes a completely separate build of LLVM, which takes a long time and should be completely unnecessary.

---

After some investigation, I tracked down the problem to the `can_skip_build` check in this code:

3014e79f9c/src/bootstrap/src/core/build_steps/compile.rs (L1382-L1396)

Historically, this would skip the LLVM build for stage 0 check builds. But after the recent stage 0 std redesign and some associated check stage renumbering (e.g. rust-lang/rust#143048), the condition `builder.top_stage == build_stage` is now false, because `top_stage` is 1 (due to the renumbering) but `build_stage` is 0 (because a “stage 1” non-library check build still uses the stage 0 compiler).

---

Because this is a critical contributor roadblock for me, I have tried to fix this in a relatively narrow way. It's possible that all of this surrounding logic could be greatly simplified (especially in light of the stage redesign changes), but I didn't want this fix to be held back by scope creep.

---

(Zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Bootstrap.20incorrectly.20building.20LLVM.20for.20check.20builds/near/528991035)
2025-07-20 15:34:06 +02:00
Guillaume Gomez
9944139f70 Add new ignore-backends tests annotations 2025-07-20 14:43:59 +02:00
bors
f63685ddf3 Auto merge of #143641 - Kobzol:tool-target, r=jieyouxu
Add `ToolTarget` to bootstrap

Oh, you thought I'm done with refactoring bootstrap tools? Na-ah, think again! After the failure of https://github.com/rust-lang/rust/pull/143581, `ToolTarget` is back with a vengeance. This time, I implemented the test changes and tool cleanups without forcing these tools to be built with the stage0 compiler.

There are still some small wins though, `LlvmBitcodeLinker` now starts at stage 1, and not stage 2. Cargo should also be ported to this new mode, but I'm leaving that for a follow-up PR.

Hopefully X-th time's the charm 🤞

r? `@jieyouxu`
2025-07-19 14:09:56 +00:00
Jakub Beránek
f16016ad25
Fix compiler for dist LLVM bitcode linker 2025-07-19 10:27:46 +02:00
Matthias Krüger
870d429e25
Rollup merge of #144092 - Gelbpunkt:musl-stage0, r=Kobzol
bootstrap: Detect musl hosts

Currently, all non-Android Linux hosts are assumed to be using glibc. This obviously isn't very portable and will currently result in downloading a stage0 toolchain for glibc even on musl hosts.

There are multiple ways to detect musl somewhat reliably, but the easiest option is to check for the python target, which is exposed in `sys.implementation._multiarch` and has values like "x86_64-linux-gnu" or "powerpc64le-linux-musl".
2025-07-19 08:55:36 +02:00
Jens Reidel
9e4f777602 bootstrap: Detect musl hosts
Currently, all non-Android Linux hosts are assumed to be using glibc.
This obviously isn't very portable and will currently result in
downloading a stage0 toolchain for glibc even on musl hosts.

There are multiple ways to detect musl somewhat reliably, but the
easiest option is to check for the python SOABI config variable, which
has values like "cpython-313-x86_64-linux-gnu" or
"cpython-313-powerpc64-linux-musl".

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-18 09:39:13 +02:00
Martin Nordholts
cadcc1ce71 bootstrap: Ignore rust.debuginfo-level-tests for codegen tests
codegen tests typically depend on the raw LLVM IR output and are
sensitive to debuginfo level. So do not apply
`rust.debuginfo-level-tests` for codegen tests.

Before this commit:

    $ ./x test --set rust.debuginfo-level-tests=2 tests/codegen --force-rerun
    test result: FAILED. 654 passed; 136 failed; 75 ignored; 0 measured; 0 filtered out; finished in 3.22s

After this commit:

    $ ./x test --set rust.debuginfo-level-tests=2 tests/codegen --force-rerun
    NOTE: ignoring `rust.debuginfo-level-tests=2` for codegen tests
    test result: ok. 790 passed; 0 failed; 75 ignored; 0 measured; 0 filtered out; finished in 3.21s
2025-07-18 07:37:26 +02:00
Zalathar
a028ca5f9b Clean up an unused compiler-stage parameter 2025-07-18 14:22:04 +10:00
Zalathar
7a217e1ba5 Don't trigger an LLVM build from check builds using the stage 0 compiler 2025-07-18 14:22:04 +10:00
Zalathar
8388b31c5b Split some multi-snapshot tests to make blessing easier
When a snapshot test fails, it only emits a `.pending-snap` file for the first
snapshot assertion that actually failed, because subsequent assertions aren't
executed. That makes it cumbersome to re-bless tests that contain multiple
snapshot assertions.
2025-07-18 14:07:30 +10:00
Matthias Krüger
c22e2ead96
Rollup merge of #144056 - Kobzol:gcc-build-src, r=nikic
Copy GCC sources into the build directory even outside CI

It takes ~3.5s on my Linux notebook to perform the copy, but it should only be executed when we actually go build GCC, and that will almost certainly take much longer :) So I think it should be fine. At least we won't be polluting the source directory for local builds.

Fixes: https://github.com/rust-lang/rust/issues/143986

r? `````@nikic`````
2025-07-18 04:27:55 +02:00
Matthias Krüger
3023a287fa
Rollup merge of #144010 - xdoardo:bootstrap-warning-optimize-false, r=clubby789
Boostrap: add warning on `optimize = false`

I recently came across a bug that can be traced back to the use of `optimize = false` in `bootstrap.toml` in combination with other settings. Following [this](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Missing.20box-related.20symbols.20with.20panic.20.3D.20'abort'/with/528992909) conversation, this PR adds a warning from `bootstrap` when `optimize = false` is used.

I notice that in the same file I edited there are two different styles for warnings (`WARN`, `Warning`). I used `WARNING` because, by happenstance, when testing I got a `WARNING` that I didn't set a change id: let me know if I can unify the styles in the file I edited.
2025-07-18 04:27:54 +02:00
Jakub Beránek
6645bf54c1
Copy GCC sources into the build directory even outside CI 2025-07-17 10:12:55 +02:00
Edoardo Marangoni
0e423f441a
Boostrap: add warning on optimize = false 2025-07-16 09:24:30 +02:00
Jakub Beránek
4f1b3e3afc Clarify comments 2025-07-15 19:47:57 +02:00
bit-aloo
306928fc11
update change tracking with warning on removal of fields. 2025-07-15 22:05:00 +05:30
bit-aloo
76967afd3b
remove ccache from llvm 2025-07-15 21:59:59 +05:30
bit-aloo
e7f5bbe743
remove description from rust toml struct 2025-07-15 21:59:59 +05:30
Samuel Tardieu
6b6c8be19d
Rollup merge of #143752 - pmur:murp/no-panic-detect-wasi-cc, r=Kobzol
Don't panic if WASI_SDK_PATH not set when detecting compiler

The fedora packaging builds the wasm sysroot outside of the rust build system. Fedora applies a couple of patches related to wasm which I think make this possible. Not panicking seems consistent with the detection logic of other targets when they cannot find cc.
2025-07-15 12:52:38 +02:00
Samuel Tardieu
f03a56f706
Rollup merge of #143630 - jieyouxu:drop-suggest, r=Mark-Simulacrum
Drop `./x suggest`

This PR removes the current `./x suggest` implementation (rust-lang/rust#109933, rust-lang/rust#106249) and associated docs for several reasons:

1. Primarily, `./x suggest` is another "flow" in bootstrap that incurs extra complexity and more invariants that bootstrap has to maintain. This causes more friction when trying to investigate and fix staging problems. As far as I know, this flow has not been actively maintained in quite a while, and I'm not aware of interest in maintaining it. Bootstrap really could use less implementation complexity with a very limited maintenance bandwidth.
2. The current `./x suggest` implementation "bypasses" the usual stage defaults for the various check/build/test/etc. flows, and it's not really possible to have a stage default because `./x suggest --run` produces a *sequence* of suggestions like [`./x check`, `./x test library/std`, ..] and then tries to run all of them in sequence, based on which files are modified.
3. We've not seen a lot of interest both in using it or extending static/dynamic test suggestions. Last extensions were rust-lang/rust#117961 and rust-lang/rust#120763. I'm not convinced the extra implementation complexity is worth it. This was discussed in:
    - [#t-infra/bootstrap > Dropping the current &#96;./x suggest&#96; flow implementation](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Dropping.20the.20current.20.60.2E.2Fx.20suggest.60.20flow.20implementation/with/527456699)
    - [#t-compiler > Dropping current &#96;./x suggest&#96; implementation](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Dropping.20current.20.60.2E.2Fx.20suggest.60.20implementation/with/527528696)

Closes rust-lang/rust#109933 (the current implementation is being removed).
Closes rust-lang/rust#143569 (by removing `./x suggest` altogether).
2025-07-15 12:52:37 +02:00
Paul Murphy
9bdd3b0ee6 Don't always panic if WASI_SDK_PATH is not set when detecting compilers
They are not always needed when building std, as is the case when
packaging on Fedora. Panic if building from CI, but warn otherwise.
2025-07-14 15:05:59 -05:00
Jieyou Xu
91d064b442
Remove current implementation of ./x suggest
This is quite a bit of implementation complexity, yet it is quite
broken, and we don't have the maintenance bandwidth to address.

Remove the current implementation if only to reduce bootstrap's
implementation complexity; the `suggest` flow comes with its own set of
hacks.
2025-07-15 00:46:33 +08:00
Jieyou Xu
904273c58e
Register change tracker warning for removal of ./x suggest 2025-07-15 00:46:31 +08:00
Samuel Tardieu
c59bc44ca9
Rollup merge of #143848 - makai410:smir-rename, r=oli-obk
Rename `stable_mir` and `rustc_smir`

This PR only renames the two crate names.

There is no doubt that we want to rename `stable_mir` to `rustc_public`, while it hasn't been discussed yet that what the new name for `rustc_smir` should be.

This PR proposes a new name for `rustc_smir`, that is `rustc_public_shim`, since `rustc_smir` now is mostly a proxy to do calls to rustc queries and the public API of rustc that is invoked by the `rustc_public` crate.

However, I don't think that name is good enough. I hope there would be a way better name.

r? `@oli-obk`
2025-07-14 18:05:44 +02:00
Makai
6598c61725 rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
Jakub Beránek
37b5d79108
Rollup merge of #143887 - Kobzol:reroder-bootstrap-tests, r=jieyouxu
Run bootstrap tests sooner in the `x test` pipeline

With the recently added bootstrap snapshot tests, and in general with our plans to test more things in bootstrap, I feel like the original comment isn't accurate anymore. Recently, on several occasions I had to wait for 40+ minutes of CI just to find out that the bootstrap snapshot tests have failed. I think we should run bootstrap tests towards the beginning instead now.

r? ```@jieyouxu```
2025-07-14 11:04:56 +02:00
Jakub Beránek
197ba7e4f1
Rollup merge of #143733 - Stypox:bootstrap-tool-config-any, r=Kobzol
Change bootstrap's `tool.TOOL_NAME.features` to work on any subcommand

This is a followup to rust-lang/rust#142379 to make the bootstrap option `tool.TOOL_NAME.features` work on any subcommand instead of just build (so also run/test/...). I also made the `TOOL_NAME` comparisons look at the tool path instead of the tool name to determine to which tool a `TOOL_NAME` refers to, so you can specify tools by path like in other places of the bootstrap (e.g. `tool."tools/miri".features`).
2025-07-14 11:04:54 +02:00
Jakub Beránek
33d477fe31
Rollup merge of #143681 - RalfJung:bootstrap-miri-rebuilds, r=Kobzol
bootstrap/miri: avoid rebuilds for test builds

When building Miri in its own repo, we always build with `--all-targets`:
a009612691/src/tools/miri/miri-script/src/util.rs (L167-L174)
This saves a bunch of time since some of Miri's dependencies get more features enabled by some of Miri's dev-dependencies, and they all get built twice otherwise if you do `cargo build && cargo test` (which is typically what you end up doing inside `./miri test` and also inside `./x test miri`).

This applies the same approach to bootstrap, drastically reducing the edit-compile cycle for Miri work here. :)
2025-07-14 11:04:52 +02:00
Stypox
b3ed03529f
Only compare tool name to apply features to 2025-07-14 09:37:24 +02:00
Stypox
937ef9381c
Bootstrap's tool.TOOL_NAME.features now works on any subcommand 2025-07-14 09:37:23 +02:00
Matthias Krüger
3ff549f6d3
Rollup merge of #143826 - Shourya742:2025-07-12-fix-command-trace, r=Kobzol
Fix command trace

With the recent developments in centralization of command execution, we somehow broke the traces for command execution. This PR fixes that and add trace to stream command execution as well.

r? ````@Kobzol````
2025-07-13 15:16:02 +02:00
Matthias Krüger
5284c84725
Rollup merge of #143825 - RalfJung:clippy-test-filter, r=llogiq
clippy: fix test filtering when TESTNAME is empty

Fixes https://github.com/rust-lang/rust/issues/143824. Turns out bootstrap was just fine, the TESTNAME logic in clippy was wrong... I still made this a rustc PR as that's where I did all the debugging.

The bootstrap change is not really related, but it's comment-only so not worth a separate PR... adding the `test_args` is also part of what `prepare_cargo_test` would usually do so let's group the code properly.
2025-07-13 15:16:02 +02:00
Matthias Krüger
b4b00c7d10
Rollup merge of #143785 - bjorn3:faster_ra_build_script_build, r=Kobzol
Add --compile-time-deps argument for x check

Together with skipping building C++ code in rustc_llvm for check, this reduces the amount of time it takes to do the x check for rust-analyzer analysis from 12m16s to 3m06s when the bootstrap compiler is already downloaded.
2025-07-13 15:16:00 +02:00
Jakub Beránek
a3c90b69af
Run bootstrap tests sooner in the x test pipeline 2025-07-13 14:38:33 +02:00
León Orell Valerian Liehr
2cbd0bc27c
Rollup merge of #143822 - RalfJung:miri-ui-clean, r=jieyouxu
./x test miri: fix cleaning the miri_ui directory

Fixes https://github.com/rust-lang/rust/issues/143680
2025-07-13 07:21:24 +02:00
León Orell Valerian Liehr
886ad3a947
Rollup merge of #143817 - Kobzol:wasi-sdk-path, r=jieyouxu
Access `wasi_sdk_path` instead of reading environment variable in bootstrap

Small cleanup to remove an environment variable read that we have performed earlier in bootstrap already.
2025-07-13 07:21:24 +02:00
León Orell Valerian Liehr
d607b944e4
Rollup merge of #143798 - Shourya742:2025-07-11-remove-format-short-command-trait, r=Kobzol
Remove format short command trait

Since we no longer have traces of the vanilla command, and we're already implementing format_short_command for CommandFingerprint, we can use it directly from the fingerprint. This PR removes the standalone format_short_command trait and moves its implementation under CommandFingerprint.
2025-07-13 07:21:22 +02:00
bit-aloo
a9a238ba5b
explicitly drop span_guard in wait_for_output 2025-07-12 19:23:58 +05:30
bjorn3
10bec8f7de Add change_tracker.rs entry 2025-07-12 12:37:03 +00:00
bjorn3
ccc302baa0 Move --compile-time-deps 2025-07-12 12:34:37 +00:00
Ralf Jung
b703451b34
refine comment
Co-authored-by: Jakub Beránek <berykubik@gmail.com>
2025-07-12 12:11:54 +02:00
bit-aloo
57ee3f206c
add span to streaming command execution flow 2025-07-12 14:55:30 +05:30
bit-aloo
acbbc18599
fix span for deferred command execution 2025-07-12 14:52:34 +05:30
Ralf Jung
73edfe7b73 clippy: fix test filtering when TESTNAME is empty 2025-07-12 11:11:29 +02:00
Ralf Jung
b0e4c3594f ./x test miri: fix cleaning the miri_ui directory 2025-07-12 09:40:35 +02:00
Jakub Beránek
0528cc9638
Access wasi_sdk_path instead of reading environment variable in bootstrap 2025-07-11 22:43:02 +02:00
bit-aloo
d004abb4d3
remove format short command and push format short command method inside fingerprint impl 2025-07-11 21:37:38 +05:30
bit-aloo
cdbe44d806
Use short command method directly from fingerprint 2025-07-11 20:33:36 +05:30