rust/src
Samuel Tardieu 202d1f5bf4
Rollup merge of #144675 - jieyouxu:compiletest-staging, r=Kobzol
Reject running `compiletest` self-tests against stage 0 rustc unless explicitly allowed

Currently, in `pr-check-1`, we run `python3 ../x.py test --stage 0 src/tools/compiletest`, which is `compiletest` self-tests against stage 0 rustc. This makes it very annoying for PRs wanting to change target spec JSON format, which `compiletest` depends on for target information, as otherwise `compiletest` would have to know how to handle 2 different target spec JSON formats and know when to pick which.

Instead of doing that, we change `compiletest` self-tests to reject running against stage 0 `rustc` *unless* explicitly allowed with `build.compiletest-allow-stage0=true`. `build.compiletest-allow-stage0` is a proper bootstrap config option in favor of the ad-hoc `COMPILETEST_FORCE_STAGE0` env var. This means that:

- `./x test src/tools/compiletest --stage=0` is not allowed, unless `build.compiletest-allow-stage0=true` is set. In this scenario, `compiletest` self-tests should be expected to fail unless the stage 0 `rustc` as provided is like codegen_cranelift where it's *actually* built from in-tree `rustc` sources.
- In CI, we change `./x test src/tools/compiletest --stage=0` to `./x test src/tools/compiletest --stage=1`, and move it to `pr-check-2`. Yes, this involves building the stage 1 compiler, but `pr-check-2` already has to build stage 1 compiler to test stage 1 library crates.
- Crucially, this means that **`compiletest` is only intended to support one target spec JSON format**, namely the one corresponding to the in-tree `rustc`.
- This should preserve the `compiletest-use-stage0-libtest` UX optimization where changing `compiler/` tree should still not require rebuilding `compiletest` as long as `build.compiletest-use-stage0-libtest=true`, as that should remain orthogonal. This is completely unlike my previous attempt at https://github.com/rust-lang/rust/pull/144563 that tries to do a way more invasive change which would cause the rebuild problem.

Best reviewed commit-by-commit.

---

r? `@Kobzol`
2025-07-30 19:49:03 +02:00
..
bootstrap Add change tracker entry 2025-07-30 19:55:17 +08:00
build_helper integrate build_helper::npm into js checks and package.json usage 2025-07-19 14:56:42 -05:00
ci Rollup merge of #144675 - jieyouxu:compiletest-staging, r=Kobzol 2025-07-30 19:49:03 +02:00
doc Rollup merge of #143465 - kornelski:extern-name, r=petrochenkov 2025-07-30 19:49:01 +02:00
etc update completions 2025-07-19 14:52:31 -05:00
gcc@04ce66d8c9 Update src/gcc submodule to 04ce66d8c918de9273bd7101638ad8724edf5e21 2025-05-14 18:02:02 +02:00
librustdoc Rollup merge of #144308 - GuillaumeGomez:merged-doctest-times, r=lolbinarycat 2025-07-30 19:49:02 +02:00
llvm-project@e8a2ffcf32 Update LLVM submodule 2025-07-17 19:53:13 +08:00
rustc-std-workspace
rustdoc-json-types rustdoc-json: Structured attributes 2025-07-15 16:52:41 +00:00
tools Rollup merge of #144675 - jieyouxu:compiletest-staging, r=Kobzol 2025-07-30 19:49:03 +02:00
README.md
stage0 Update stage0 to 1.89.0-beta.1 2025-07-01 10:54:33 -07:00
version Bump the version number to 1.90.0 2025-06-20 10:08:52 -07:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.