Commit graph

7270 commits

Author SHA1 Message Date
Jakub Beránek
87b068ccb7
Fix missing newline trim in bootstrap 2025-06-11 19:05:10 +02:00
León Orell Valerian Liehr
b9a578ea27
Rollup merge of #141909 - Shourya742:2025-06-01-add-execution-context, r=Kobzol
Add central execution context to bootstrap

This PR continues the effort toward command centralization as outlined in https://github.com/rust-lang/rust/issues/126819. It introduces a centralized execution context through which all commands will be executed. Previously, centralization was limited to build methods; this PR extends it to the `config` module and updates the remaining methods accordingly.

Best reviewed commit by commit.

r? ``@Kobzol``
2025-06-10 16:54:48 +02:00
Mateusz Mikuła
4f0b60aa71 Don't create .msi installer for gnullvm hosts
WIX toolset works only on Windows hosts and we need to boostrap this
host.
2025-06-09 23:54:04 +02:00
bit-aloo
51fbd145f9
Initialize the execution context in parse_inner, start using dry run from the execution context, add getters and setters in the config, and update the tests and other relevant areas accordingly. 2025-06-09 21:11:45 +05:30
bit-aloo
e9ced508f4
remove execution context from flag module and correct the command invocation according to suggestions 2025-06-09 20:39:48 +05:30
bit-aloo
f3e1eb1dca
update dry_run value in exec_ctx and start forwarding exec_ctx verbose methods via config 2025-06-09 20:39:45 +05:30
bit-aloo
50725f325b
move all commands to new execution context 2025-06-09 20:39:15 +05:30
bit-aloo
98be2a0498
move all config command invocation to new execution context invocation 2025-06-09 20:38:13 +05:30
bit-aloo
746276cfb2
moved git command to new exec context 2025-06-09 20:38:13 +05:30
bit-aloo
bae39b8f10
move all download.rs method to new execution context command invocation 2025-06-09 20:38:12 +05:30
bit-aloo
d544c2b8d0
covert uname to new extext method 2025-06-09 20:38:12 +05:30
bit-aloo
2d1ca83ab5
moved curl to use new execution_context 2025-06-09 20:38:12 +05:30
bit-aloo
81abbe1f12
moved sanity command to exec context 2025-06-09 20:38:12 +05:30
bors
14863ea077 Auto merge of #142242 - matthiaskrgr:rollup-1sgx0ji, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#129121 (Stabilize `tcp_quickack`)
 - rust-lang/rust#142192 (De-duplicate f16 & f128 doctest attributes)
 - rust-lang/rust#142193 (add tests for pattern binding drop order edge cases)
 - rust-lang/rust#142222 (Dont make `ObligationCtxt`s with diagnostics unnecessarily)
 - rust-lang/rust#142228 (rustc-dev-guide subtree update)
 - rust-lang/rust#142231 (Run `calculate_matrix` job on `master` to cache citool builds)
 - rust-lang/rust#142232 (add `Cargo.lock` to CI-rustc allowed list for non-CI env)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-09 12:21:14 +00:00
Matthias Krüger
8daa8ef75c
Rollup merge of #142232 - onur-ozkan:141986, r=Kobzol
add `Cargo.lock` to CI-rustc allowed list for non-CI env

Changes to dependencies usually require modifying `Cargo.toml`, which would already invalidate the CI-rustc cache if done in non-allowed paths. On non-CI environment, it should be safe to add `Cargo.lock` to the list of allowed paths as there is no real risk aside from a very rare false positive in cases like minor bumps to non-allowed path dependencies without modifying the `Cargo.toml` files.

Fixes rust-lang/rust#141986
2025-06-09 13:55:36 +02:00
onur-ozkan
c3de813944 add Cargo.lock to CI-rustc allowed list for non-CI env
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-09 12:47:05 +03:00
Matthias Krüger
ad378be221
Rollup merge of #142160 - Urgau:check-cfg-bootstrap-only-rustc, r=Kobzol
Only allow `bootstrap` cfg in rustc & related

Fixes https://github.com/rust-lang/rust/issues/142150
r? bootstrap
2025-06-09 10:20:52 +02:00
Matthias Krüger
45cf4fb8d7
Rollup merge of #141751 - jieyouxu:remap, r=Kobzol
Remap compiler vs non-compiler sources differently (bootstrap side)

See [#t-compiler/help > Span pointing to wrong file location (&#96;rustc-dev&#96; component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083).

The path remapping and unremapping for compiler sources (distributed via `rustc-dev` dist component) is broken because bootstrap currently remaps all sources unconditionally (if remapping is enabled) to the `/rustc/{hash}` form. However, the `rustc-dev` dist component (compiler sources) and `rust-src` dist component (library sources) unpacks differently:

- `rust-src` unpacks sources to a path like `$sysroot/lib/rustlib/src/rust`, whereas
- `rustc-dev` unpacks sources to a path like `$sysroot/lib/rustlib/rustc-src/rust`[^note],

meaning that the compiler need to unremap them differently. But the same remapping means that the compiler has no way to distinguish between compiler and non-compiler (esp. standard library) sources. To remedy this, this PR adopts the approach of:

- remapping compiler sources (corresponding to `rustc-dev` dist component) with `/rustc-dev/{hash}` (this is `RemapScheme::Compiler`), and
- remapping non-compiler sources (corresponding to `rust-src` dist component or other non-compiler sources) with `/rustc/{hash}` (this is `RemapScheme::NonCompiler`).

A different remapping allows the compiler to reverse the remapping differently.

This PR implements the bootstrap side. A follow-up compiler-side change is needed to implement the unremapping change to address the reported issue completely.

This PR introduces another env var `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` that is made available to the compiler when building compiler sources to know what the remap scheme for `rustc-dev` (`RemapScheme::Compiler`) is. Compiler sources are built with the compiler remapping scheme.

As far as I know, this change should not introduce new regressions, because the compiler source unremapping (through `rustc-dev`) is already broken.

[^note]: (Notice the `src` vs `rustc-src` difference.)
2025-06-09 10:20:51 +02:00
Jubilee
840baa46ff
Rollup merge of #142053 - heiher:loong32-none, r=wesleywiser
Add new Tier-3 targets: `loongarch32-unknown-none*`

MCP: https://github.com/rust-lang/compiler-team/issues/865

NOTE: LoongArch32 ELF object support is available starting with object v0.37.0.
2025-06-08 17:17:53 -07:00
bit-aloo
8bd81699d9
moved render_tests in utils to new execution context 2025-06-08 12:19:09 +05:30
bit-aloo
def44885ee
move git command to new execution context 2025-06-08 12:19:08 +05:30
bit-aloo
81ee86b23b
add execution context to bootstrap workflow 2025-06-08 12:19:08 +05:30
bit-aloo
3ab5e60d18
Add execution context 2025-06-08 12:19:07 +05:30
Guillaume Gomez
215dc8c499
Rollup merge of #142116 - jieyouxu:fix-tracing, r=Mark-Simulacrum
Fix bootstrap tracing imports
2025-06-07 22:22:58 +02:00
Urgau
b283394db1 Only allow bootstrap cfg in rustc, related and tool-std 2025-06-07 18:11:53 +02:00
bors
321dde1252 Auto merge of #141917 - petrochenkov:nobinroot, r=jieyouxu
bootstrap: Remove `rustc_snapshot_libdir` from PATH in one more place

Same as https://github.com/rust-lang/rust/pull/141657 but in a different part of the build system, with the same goal of addressing [#t-infra/bootstrap > Build broken in MSYS2 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Build.20broken.20in.20MSYS2/near/520709527).

It seems to work on windows-{gnu,msvc} and linux-gnu at least.

r? jieyouxu
2025-06-07 09:21:38 +00:00
bors
868bf2da31 Auto merge of #141800 - workingjubilee:build-std-with-less-leaf-pointers, r=saethlin
bootstrap: build std sans leaf frame pointers

Sometimes leaf frame-pointers can impact LLVM inlining choices, and that can be a real problem for things like `mul_add`.
2025-06-06 21:21:59 +00:00
Jieyou Xu
46a936a353
bootstrap: fix tracing imports 2025-06-06 20:49:55 +08:00
bors
d00435f223 Auto merge of #141272 - Shourya742:2025-05-18-modularize-config-module, r=Kobzol
modularize the config module bootstrap

Currently, our `config` module is quite large over 3,000 lines, and handles a wide range of responsibilities. This PR aims to break it down into smaller, more focused submodules to improve readability and maintainability:

* **`toml`**: Introduces a dedicated `toml` submodule within the `config` module. Its sole purpose is to define configuration-related structs along with their corresponding deserialization logic. It also contains the `parse_inner` method, which serves as the central function for extracting relevant information from the TOML structs and constructing the final configuration.

* **`rust`, `dist`, `install`, `llvm`, `build`, `gcc`, and others**: Each of these modules contains TOML subsections specific to their domain, along with the logic necessary to convert them into parts of the final configuration struct.

* **`config/mod.rs`**: Contains shared types and enums used across multiple TOML subsections.

* **`config/config.rs`**: Houses the logic that integrates all the TOML subsections into the complete configuration struct.

r? `@kobzol`
2025-06-06 04:32:56 +00:00
WANG Rui
38d69c3f57 Add new Tier-3 targets: loongarch32-unknown-none*
MCP: https://github.com/rust-lang/compiler-team/issues/865
2025-06-06 08:19:38 +08:00
bors
076ec59ff1 Auto merge of #142081 - matthiaskrgr:rollup-secpezz, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#141709 (jsondocck: Refactor directive handling)
 - rust-lang/rust#141974 (`tests/ui`: A New Order [4/N])
 - rust-lang/rust#141989 (rustdoc-json-type: Depend on `serde` and `serde_derive` seperately)
 - rust-lang/rust#142015 (Report the actual item that evaluation failed for)
 - rust-lang/rust#142026 (bootstrap: Fix file permissions when dereferencing symlinks)
 - rust-lang/rust#142032 (Fix parsing of frontmatters with inner hyphens)
 - rust-lang/rust#142036 (Update the `compiler-builtins` subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-05 16:46:32 +00:00
Matthias Krüger
19798d62dc
Rollup merge of #142026 - smpdt:master, r=Kobzol
bootstrap: Fix file permissions when dereferencing symlinks

## Problem
When copying files in the bootstrap process with `dereference_symlinks = true`, we're incorrectly using the symlink's metadata to set permissions on the copied regular file, which results in the following error:
```
Warning: Failed to set file times for "/build/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-strip" (permissions: Permissions(FilePermissions { mode: 0o100000 (----------) })) error: Permission denied (os error 13)
```

Verbose Logs confirming the error:
```
TRACE: Found llvm-strip copy operation
  Source: /n/nix/tech/store/n34yzv2n50p6lbjmx089vjym121wbl4j-llvm-19.1.7/bin/llvm-strip
  Destination: /build/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-strip
  Source is_symlink (via symlink_metadata): true
  Source symlink_metadata permissions: 120000
  Source symlink_metadata file_type: FileType { is_file: false, is_dir: false, is_symlink: true, .. }

  Source is symlink pointing to: llvm-objcopy
  Source raw mode: 120000
  Source filetype: 120000

  Setting permissions: Permissions(FilePermissions { mode: 0o120000 (l---------) })
  Permission mode to set: 120000
  Raw permission bits: 120000
  File type bits being set: 120000
  Permission bits being set: 0

  WARNING: Attempting to set symlink file type (120000) on regular file!
  WARNING: Setting zero permission bits will make file inaccessible!
  Destination permissions after set_permissions: 100000
```

## Solution
After canonicalizing a symlink path, fetch the metadata of the target file instead of continuing to use the symlink's metadata. This ensures:
- Correct file type detection
- Proper permission bits for the target file
- Maintains existing behavior for non-symlink cases

## Testing
Verified fix resolves permission errors:
```
rustc> llvm-strip: Original metadata mode: 120000, is_symlink: true
rustc> llvm-strip: Target metadata mode after fix: 100555
rustc> llvm-strip: Final permissions mode: 100555
```
2025-06-05 16:02:04 +02:00
bit-aloo
3667dbd5f9
correct the imports in flags, tests and download 2025-06-05 16:27:20 +05:30
Matthias Krüger
cfe78d99ae
Rollup merge of #141970 - onur-ozkan:skip-stage1-std, r=Kobzol
implement new `x` flag: `--skip-std-check-if-no-download-rustc`

One of our developers (``@RalfJung)`` [reported](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606)[#t-infra/bootstrap > Surprising stages for check build after stage reorg](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Surprising.20stages.20for.20check.20build.20after.20stage.20reorg/with/521925606) that working on both the compiler and the library simultaneously with RA enabled is extremely difficult because checking library creates a heavy load on machines (by building stage1 compiler) on each modification. `--skip-std-check-if-no-download-rustc` flag is intended to reduce this heavy load on their IDE integration as much as possible.

Fixes: rust-lang/rust#141955
2025-06-05 12:21:34 +02:00
Matthias Krüger
7852d99768
Rollup merge of #141938 - ZuseZ4:offload-updates, r=Kobzol
update rust offload bootstrap

r? ``@ghost``
2025-06-05 12:21:31 +02:00
bors
df8102fe5f Auto merge of #142002 - onur-ozkan:follow-ups2, r=jieyouxu
redesign stage 0 std follow-ups part2

Fixes three bugs:

1. `x check` fails when run on rustdoc without `download-rustc` enabled. (1st commit)
2. `x check` fails when run on the compiler with `download-rustc` enabled. (2nd commit)
3. `x test library` fails with `download-rustc` enabled. (3rd commit)

Fixes rust-lang/rust#142018 (case 1)
Fixes https://github.com/rust-lang/rust/issues/141983 (case 3)
2025-06-04 14:15:44 +00:00
smpdt
9091a94ff0 bootstrap: Fix file permissions when dereferencing symlinks 2025-06-04 10:00:20 -04:00
onur-ozkan
c843bec230 update skip_std_check_if_no_download_rustc doc-comments
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04 15:29:00 +03:00
onur-ozkan
7af12a19a8 remove outdated RUSTC_SYSROOT handling for ci-rustc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04 07:16:25 +03:00
Aleksey Kliger
556c0962ed bootstrap: don't symlink source dir into stage0 sysroot
In StdLink::run we subsequently recursively copy the initial sysroot
lib directory into the stage0-sysroot lib directory.  If the initial
sysroot is a toolchain that includes the `rust-src` component (in
lib/rustlib/src/rust), if we add this symlink, that recursive copy
will overwrite the repo sources with the toolchain's sources.
2025-06-04 00:06:01 -04:00
onur-ozkan
e66948c4fe make it possible to request stage 0 std with Builder::ensure
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04 06:58:28 +03:00
onur-ozkan
bded7010e8 run check::Std as the final step
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04 06:57:12 +03:00
Manuel Drehwald
674a4358e8 update gpu offload build command 2025-06-03 13:10:58 -07:00
bors
a124fb3cb7 Auto merge of #141961 - matthiaskrgr:rollup-r09j2sp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#141724 (fix(rust-lang/rust#141141): When expanding `PartialEq`, check equality of scalar types first.)
 - rust-lang/rust#141833 (`tests/ui`: A New Order [2/N])
 - rust-lang/rust#141861 (Switch `x86_64-msvc-{1,2}` back to Windows Server 2025 images)
 - rust-lang/rust#141914 (redesign stage 0 std follow-ups)
 - rust-lang/rust#141918 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141923 (Update books)
 - rust-lang/rust#141931 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141956 (Remove two trait methods from cg_ssa)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 16:31:44 +00:00
onur-ozkan
9e162fe0ab add change-entry
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 19:22:33 +03:00
onur-ozkan
f1e6afdc4c bless tidy
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 19:22:28 +03:00
onur-ozkan
143d81362b implement new x flag: --skip-std-check-if-no-download-rustc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 19:12:51 +03:00
bors
aae43c4532 Auto merge of #136942 - Kobzol:stage0-sccache, r=jieyouxu
Use ccache for stage0 tool builds

Now after the stage0 redesign, we can actually start ccaching the build of the compiler itself. We can also cache the bootstrap tools, since these are also built with the stage0 compiler.

Stage0 compiler builds are now being cached: https://github.com/rust-lang/rust/actions/runs/15397246267#summary-43321151192 (`..bootstrap::core::build_steps::compile::Rustc	483.10s	40.41s	-91.6%`). It's not a gigantic win everywhere, but it should help. It seems to make the Linux jobs ~10 minute faster. It should be especially useful on PR builds after https://github.com/rust-lang/rust/pull/141948.

r? `@jieyouxu`

try-job: `x86_64-gnu-llvm-19*`
try-job: `x86_64-msvc*`
try-job: `x86_64-apple*`
try-job: `dist-x86_64-linux`
2025-06-03 13:09:57 +00:00
Matthias Krüger
72f60fb700
Rollup merge of #141914 - onur-ozkan:follow-ups, r=Kobzol
redesign stage 0 std follow-ups

Various follow-ups pointed out on Zulip during post-merge discussions of [redesign stage 0 std #119899](https://github.com/rust-lang/rust/pull/119899).

r? `@jieyouxu`

Fixes https://github.com/rust-lang/rust/issues/141902.
Fixes https://github.com/rust-lang/rust/issues/141905.

cc `@jyn514`
2025-06-03 15:00:34 +02:00
onur-ozkan
59d993b6c7 use better default stage for check::Std when stage isn't explicit
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 12:59:33 +03:00