Skip to content

Commit b1bcdac

Browse files
committed
Auto merge of #119899 - onur-ozkan:redesign-stage0-std, 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 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 rust-lang/rust#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 e9985c7 + 1b5b88a commit b1bcdac

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/concurrency/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ pub mod thread;
88
mod vector_clock;
99
pub mod weak_memory;
1010

11+
// cfg(bootstrap)
12+
macro_rules! cfg_select_dispatch {
13+
($($tokens:tt)*) => {
14+
#[cfg(bootstrap)]
15+
cfg_match! { $($tokens)* }
16+
17+
#[cfg(not(bootstrap))]
18+
cfg_select! { $($tokens)* }
19+
};
20+
}
21+
1122
// Import either the real genmc adapter or a dummy module.
12-
cfg_select! {
23+
cfg_select_dispatch! {
1324
feature = "genmc" => {
1425
mod genmc;
1526
pub use self::genmc::{GenmcCtx, GenmcConfig};

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#![cfg_attr(bootstrap, feature(cfg_match))]
2+
#![cfg_attr(not(bootstrap), feature(cfg_select))]
13
#![feature(rustc_private)]
2-
#![feature(cfg_select)]
34
#![feature(float_gamma)]
45
#![feature(float_erf)]
56
#![feature(map_try_insert)]

src/shims/unix/fs.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,19 @@ impl UnixFileDescription for FileHandle {
8989
communicate_allowed: bool,
9090
op: FlockOp,
9191
) -> InterpResult<'tcx, io::Result<()>> {
92+
// cfg(bootstrap)
93+
macro_rules! cfg_select_dispatch {
94+
($($tokens:tt)*) => {
95+
#[cfg(bootstrap)]
96+
cfg_match! { $($tokens)* }
97+
98+
#[cfg(not(bootstrap))]
99+
cfg_select! { $($tokens)* }
100+
};
101+
}
102+
92103
assert!(communicate_allowed, "isolation should have prevented even opening a file");
93-
cfg_select! {
104+
cfg_select_dispatch! {
94105
all(target_family = "unix", not(target_os = "solaris")) => {
95106
use std::os::fd::AsRawFd;
96107

0 commit comments

Comments
 (0)