Skip to content

redesign stage 0 std #119899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 2, 2025
Merged

redesign stage 0 std #119899

merged 17 commits into from
Jun 2, 2025

Conversation

onur-ozkan
Copy link
Member

@onur-ozkan onur-ozkan commented Jan 12, 2024

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.


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 Zulip channel or create a bootstrap issue.

(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 and #137215

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*

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 12, 2024
@onur-ozkan onur-ozkan added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2024
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jan 13, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@onur-ozkan onur-ozkan force-pushed the redesign-stage0-std branch 2 times, most recently from ce81474 to b688ffa Compare January 13, 2024 15:51
@rust-log-analyzer

This comment has been minimized.

@onur-ozkan onur-ozkan force-pushed the redesign-stage0-std branch 6 times, most recently from 5f1747d to 00e59f0 Compare January 14, 2024 13:30
@onur-ozkan onur-ozkan marked this pull request as ready for review January 14, 2024 13:57
@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2024

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@onur-ozkan onur-ozkan changed the title [WIP] redesign stage 0 std redesign stage 0 std Jan 14, 2024
@onur-ozkan
Copy link
Member Author

@rustbot ready

r? bootstrap
cc @rust-lang/libs

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 14, 2024
@onur-ozkan
Copy link
Member Author

@rustbot author (currently stage 2 std is copied from stage 1 and this behaviour should change with the beta std change)

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 14, 2024
@bors
Copy link
Collaborator

bors commented Jun 2, 2025

⌛ Testing commit a577bcc with merge 52882f6...

@bors
Copy link
Collaborator

bors commented Jun 2, 2025

☀️ Test successful - checks-actions
Approved by: albertlarsan68,jieyouxu,mark-simulacrum,kobzol,jyn514,Noratrieb,WaffleLapkin,RalfJung,bjorn3
Pushing 52882f6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 2, 2025
@bors bors merged commit 52882f6 into rust-lang:master Jun 2, 2025
11 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 2, 2025
@onur-ozkan onur-ozkan deleted the redesign-stage0-std branch June 2, 2025 11:06
Copy link
Contributor

github-actions bot commented Jun 2, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 91fad92 (parent) -> 52882f6 (this PR)

Test differences

Show 3 test diffs

Stage 0

  • core::builder::tests::ci_rustc_if_unchanged_invalidate_on_library_changes_in_ci: pass -> [missing] (J0)

Additionally, 2 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 52882f6522ae9f34f1d574b2efabc4b18e691ae0 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-2: 7074.7s -> 4265.1s (-39.7%)
  2. dist-x86_64-apple: 11819.4s -> 9527.8s (-19.4%)
  3. aarch64-gnu-debug: 4413.6s -> 3872.1s (-12.3%)
  4. x86_64-gnu-llvm-19-1: 3945.8s -> 3707.9s (-6.0%)
  5. aarch64-apple: 5149.6s -> 5447.6s (5.8%)
  6. x86_64-gnu-llvm-19-3: 7233.4s -> 6817.9s (-5.7%)
  7. x86_64-gnu-llvm-20-3: 7297.2s -> 6895.9s (-5.5%)
  8. dist-apple-various: 6596.2s -> 6918.6s (4.9%)
  9. i686-gnu-nopt-2: 6796.9s -> 6487.0s (-4.6%)
  10. dist-x86_64-msvc-alt: 7741.1s -> 7396.8s (-4.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (52882f6): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -0.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.6% [0.6%, 2.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.4% [-9.0%, -0.4%] 12
All ❌✅ (primary) - - 0

Cycles

Results (secondary -0.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.7% [0.5%, 0.8%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-1.3%, -0.6%] 8
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 774.333s -> 743.462s (-3.99%)
Artifact size: 372.28 MiB -> 372.27 MiB (-0.01%)

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 3, 2025
…kingjubilee

Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that rust-lang#119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 3, 2025
…kingjubilee

Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that rust-lang#119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 3, 2025
redesign stage 0 std follow-ups

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

r? `@jieyouxu`

Fixes rust-lang#141902.
Fixes rust-lang#141905.

cc `@jyn514`
rust-timer added a commit that referenced this pull request Jun 3, 2025
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](#119899).

r? `@jieyouxu`

Fixes #141902.
Fixes #141905.

cc `@jyn514`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 3, 2025
…kingjubilee

Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that rust-lang#119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
rust-timer added a commit that referenced this pull request Jun 4, 2025
Rollup merge of #141925 - cuviper:vestigial-bootstrap, r=workingjubilee

Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that #119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 4, 2025
Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that rust-lang/rust#119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.