about summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
2025-06-07Only allow `bootstrap` cfg in rustc, related and tool-stdUrgau-8/+13
2025-06-07Auto merge of #141917 - petrochenkov:nobinroot, r=jieyouxubors-4/+2
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-06Auto merge of #141800 - workingjubilee:build-std-with-less-leaf-pointers, ↵bors-1/+2
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-06bootstrap: fix tracing importsJieyou Xu-4/+0
2025-06-06Auto merge of #141272 - Shourya742:2025-05-18-modularize-config-module, r=Kobzolbors-1986/+2228
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-06Add new Tier-3 targets: `loongarch32-unknown-none*`WANG Rui-0/+3
MCP: https://github.com/rust-lang/compiler-team/issues/865
2025-06-05Auto merge of #142081 - matthiaskrgr:rollup-secpezz, r=matthiaskrgrbors-1/+2
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-05Rollup merge of #142026 - smpdt:master, r=KobzolMatthias Krüger-1/+2
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-05correct the imports in flags, tests and downloadbit-aloo-5/+8
2025-06-05Rollup merge of #141970 - onur-ozkan:skip-stage1-std, r=KobzolMatthias Krüger-0/+23
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-05Rollup merge of #141938 - ZuseZ4:offload-updates, r=KobzolMatthias Krüger-6/+9
update rust offload bootstrap r? ``@ghost``
2025-06-04Auto merge of #142002 - onur-ozkan:follow-ups2, r=jieyouxubors-26/+26
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-04bootstrap: Fix file permissions when dereferencing symlinkssmpdt-1/+2
2025-06-04update `skip_std_check_if_no_download_rustc` doc-commentsonur-ozkan-2/+6
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04remove outdated RUSTC_SYSROOT handling for ci-rustconur-ozkan-10/+0
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04bootstrap: don't symlink source dir into stage0 sysrootAleksey Kliger-13/+17
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-04make it possible to request stage 0 std with `Builder::ensure`onur-ozkan-15/+19
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-04run `check::Std` as the final steponur-ozkan-1/+7
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03update gpu offload build commandManuel Drehwald-6/+9
2025-06-03Auto merge of #141961 - matthiaskrgr:rollup-r09j2sp, r=matthiaskrgrbors-18/+55
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-03add change-entryonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03bless tidyonur-ozkan-2/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03implement new `x` flag: `--skip-std-check-if-no-download-rustc`onur-ozkan-0/+14
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03Auto merge of #136942 - Kobzol:stage0-sccache, r=jieyouxubors-0/+22
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-03Rollup merge of #141914 - onur-ozkan:follow-ups, r=KobzolMatthias Krüger-18/+55
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-03use better default stage for `check::Std` when stage isn't explicitonur-ozkan-9/+29
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03Rollup merge of #141949 - onur-ozkan:move-test-float-parse, r=KobzolMatthias Krüger-7/+7
move `test-float-parse` tool into `src/tools` dir Obviously `test-float-parse` is a tool like any other in `src/tools`. cc `@tgross35`
2025-06-03handle stage0 on `Std::check`onur-ozkan-11/+24
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03add config.rs with new module structuringbit-aloo-1982/+122
2025-06-03Move all common types, macros and utility method to config/mod.rsbit-aloo-0/+411
2025-06-03move target selection to its separate modulebit-aloo-0/+147
2025-06-03This commit adds a `toml` module that represents various subsections of ↵bit-aloo-0/+1541
`bootstrap.toml`. The module primarily defines the TOML representations of these subsections and their corresponding configuration parsing implementations, which are ultimately integrated into the main configuration. - `mod.rs` – Serves as the entry point for the TOML configuration and defines the `TomlConfig` struct along with its parsing implementation. - `rust.rs` – Defines the `Rust` subsection struct and its configuration parsing implementation. - `target.rs` – Defines the `Target` subsection struct and its configuration parsing implementation. - `llvm.rs` – Defines the `Llvm` subsection struct and its configuration parsing implementation. - `install.rs` – Defines the `Install` subsection struct and its configuration parsing implementation. - `gcc.rs` – Defines the `Gcc` subsection struct and its configuration parsing implementation. - `dist.rs` – Defines the `Dist` subsection struct and its configuration parsing implementation. - `build.rs` – Defines the `Build` subsection struct and its configuration parsing implementation.
2025-06-03move `test-float-parse` tool into `src/tools` dironur-ozkan-7/+7
Obviously `test-float-parse` is a tool like any other in `src/tools`. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03make library profile to use stage 1 on `x check`onur-ozkan-1/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03make `x check` to use stage0 by defaultonur-ozkan-1/+4
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03Auto merge of #141210 - RalfJung:miri-std-doctests, r=saethlinbors-12/+11
tools-aux ci runner: also cross-test doctests in Miri Miri now supports running doctests across different targets. Let's use that to run the std doctests on aarch64-apple-darwin, i686-pc-windows-msvc. try-job: x86_64-gnu-aux
2025-06-02bootstrap: Remove `rustc_snapshot_libdir` from PATH in one more placeVadim Petrochenkov-4/+2
2025-06-02Use ccache for stage0 tool and rustc buildsJakub Beránek-0/+22
2025-06-02Auto merge of #119899 - onur-ozkan:redesign-stage0-std, ↵bors-355/+346
r=albertlarsan68,jieyouxu,mark-simulacrum,kobzol,jyn514,Noratrieb,WaffleLapkin,RalfJung,bjorn3 redesign stage 0 std ### Summary **Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/** This PR changes how bootstrap builds the stage 1 compiler by switching to precompiled stage 0 standard library instead of building the in-tree one. The goal was to update bootstrap to use the beta standard library at stage 0 rather than compiling it from source (see the motivation at https://github.com/rust-lang/compiler-team/issues/619). Previously, to build a stage 1 compiler bootstrap followed this path: ``` download stage0 compiler -> build in-tree std -> compile stage1 compiler with in-tree std ``` With this PR, the new path is: ``` download stage0 compiler -> compile stage1 compiler with precompiled stage0 std ``` This also means that `cfg(bootstrap)`/`cfg(not(bootstrap))` is no longer needed for library development. ### Building "library" Since stage0 `std` is no longer in-tree `x build/test/check library --stage 0` is now no-op. The minimum supported stage to build `std` is now 1. For the same reason, default stage values in the library profile is no longer 0. Because building the in-tree library now requires a stage1 compiler, I highly recommend library developers to enable `download-rustc` to speed up compilation time. <hr> **Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/** If you encounter a bug or unexpected results please open a topic in the [#t-infra/bootstrap](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap) Zulip channel or create a [bootstrap issue](https://github.com/rust-lang/rust/issues/new?template=bootstrap.md). (Review thread: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Review.20thread.3A.20stage.200.20redesign.20PR/with/508271433) ~~Blocked on https://github.com/rust-lang/rust/pull/122709~~ try-job: dist-x86_64-linux try-job: `x86_64-msvc*` try-job: `x86_64-apple-*` try-job: `aarch64-apple` try-job: x86_64-gnu try-job: `x86_64-gnu-llvm*`
2025-06-01Rollup merge of #141852 - onur-ozkan:resolve-if-let-fixme, r=jieyouxuGuillaume Gomez-3/+3
resolve if-let-chain FIXME on bootstrap self-explanatory
2025-06-01Rollup merge of #141846 - Berrysoft:cygwin-bootstrap-tls, r=mati865Guillaume Gomez-1/+6
Fix TLS model on bootstrap for cygwin There aren't other targets that both use emutls and enable `has_thread_local`, so cygwin triggers this bug first. r? mati865 See: https://github.com/rust-lang/rust/pull/141719#issuecomment-2925445263 ``@jeremyd2019`` Could you check if this PR fixes the issue? I just found my pre-built stage-0 rustc was too old to build the current rustc :(
2025-06-01Rollup merge of #141789 - ↵Guillaume Gomez-1/+2
ferrocene:hoverbear/exclude-cargo-home-from-in-tree-consideration, r=clubby789 Exclude `CARGO_HOME` from `generate-copyright` in-tree determination On Ferrocene, we noticed that in our releases the out-of-tree notices were not being included. When `x.py run generate-copyright` was ran on local development machines, it worked fine. After some investigations ``@tshepang`` and I determined that the problem was that the cargo registry (located in `CARGO_HOME`) started with the source directory on CI jobs, and was being excluded by this line: https://github.com/rust-lang/rust/blob/15825b7161f8bd6a3482211fbf6727a52aa1166b/src/tools/generate-copyright/src/cargo_metadata.rs#L85-L88 In Ferrocene's `run.sh` we set `CARGO_HOME` to be `build/cargo-home`: https://github.com/ferrocene/ferrocene/blob/96a45dd9a18c6e54d3cd81750a78fe459fa48af0/ferrocene/ci/run.sh#L34-L46 which caused this issue. This PR passes the `CARGO_HOME` variable to the `generate-copyright` tool and expands the consideration of in-tree-ness to be aware of `CARGO_HOME`. It is an upstreaming of https://github.com/ferrocene/ferrocene/pull/1491. ## Testing Run `CARGO_HOME=build/cargo-home ./x.py run generate-copyright` on `master`, then check `build/host/doc/COPYRIGHT` and look for out of tree dependencies (at the bottom). Then, try running the same command in this branch.
2025-06-01resolve if-let-chain FIXME on bootstraponur-ozkan-3/+3
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-01Fix TLS model on bootstrap for cygwin王宇逸-1/+6
2025-05-31Rollup merge of #141819 - mati865:windows-gnullvm-host-fixes, r=jieyouxuMatthias Krüger-3/+6
Fixes for building windows-gnullvm hosts Split out from: https://github.com/rust-lang/rust/pull/140772
2025-05-31Rollup merge of #141646 - jieyouxu:distcheck, r=Mark-SimulacrumMatthias Krüger-1/+8
Document what `distcheck` is intended to exercise Or at least attempt to. Closes rust-lang/rust#141387. cc `@marcoieni` (re. [#t-infra/bootstrap > Speed up distcheck](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Speed.20up.20distcheck/with/520208870)) r? `@Mark-Simulacrum` (as you may have some clues about if this is accurate)
2025-05-31bootstrap: remap compiler vs non-compiler sources differentlyJieyou Xu-10/+70
- Map compiler sources (corresponding to `rustc-dev` dist component) with `/rustc-dev/{hash}`. - Map non-compiler sources (corresponding to `rust-src` dist component or other non-compiler sources) with `/rustc/{hash}`. This allows the compiler to have the possibility of opportunistically reverse the mapping. This is because - `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` (Notice the `src` vs `rustc-src` difference.)
2025-05-31Shared libLLVM linking is officially supported with MinGW and ClangMateusz Mikuła-1/+2
2025-05-31Fix C++ standard library name for *-windows-gnullvm targetsMateusz Mikuła-1/+3
2025-05-31Fix incorrect commentMateusz Mikuła-1/+1