Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a925d4d

Browse files
committedMay 31, 2025·
Auto merge of #119899 - onur-ozkan:redesign-stage0-std, r=<try>
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 rust-lang/compiler-team#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 #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*`
2 parents 0b00e68 + a577bcc commit a925d4d

File tree

44 files changed

+526
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+526
-499
lines changed
 

‎compiler/rustc_data_structures/src/flock.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
//! green/native threading. This is just a bare-bones enough solution for
55
//! librustdoc, it is not production quality at all.
66
7-
cfg_select! {
7+
// cfg(bootstrap)
8+
macro_rules! cfg_select_dispatch {
9+
($($tokens:tt)*) => {
10+
#[cfg(bootstrap)]
11+
cfg_match! { $($tokens)* }
12+
13+
#[cfg(not(bootstrap))]
14+
cfg_select! { $($tokens)* }
15+
};
16+
}
17+
18+
cfg_select_dispatch! {
819
target_os = "linux" => {
920
mod linux;
1021
use linux as imp;

‎compiler/rustc_data_structures/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#![allow(internal_features)]
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
13+
#![cfg_attr(bootstrap, feature(cfg_match))]
14+
#![cfg_attr(not(bootstrap), feature(cfg_select))]
1315
#![deny(unsafe_op_in_unsafe_fn)]
1416
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1517
#![doc(rust_logo)]
@@ -19,7 +21,6 @@
1921
#![feature(ascii_char_variants)]
2022
#![feature(assert_matches)]
2123
#![feature(auto_traits)]
22-
#![feature(cfg_select)]
2324
#![feature(core_intrinsics)]
2425
#![feature(dropck_eyepatch)]
2526
#![feature(extend_one)]

0 commit comments

Comments
 (0)
Please sign in to comment.