Skip to content

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Aug 26, 2025

After the stage0 redesign, building a stage0 library no longer is a thing, because the stage0 compiler normally cannot build libstd anymore. However, there are valid use-cases for having the ability to quickly cross-compile libstd for different targets, when the stage0 compiler is e.g. a stable released version, and you want to cross-compile libstd from the same sources of that compiler.

This PR allows that, as long as you set build.local-rebuild = true, which promises bootstrap that the stage0 compiler actually comes from in-tree sources, and can thus compile libstd.

The change needed to enable this is very minimal, so I think that it is worth it to allow this use-case to work.

Fixes: #145587
Fixes: #145859
Related issue: #94781

r? @jieyouxu

@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 Aug 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 26, 2025

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

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

@jieyouxu
Copy link
Member

jieyouxu commented Aug 26, 2025

This unfortunately has a merge conflict. I'll review this tmrw.

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

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually just kidding, the changes look good to me. Please r=me after fixing the change tracker conflict.

View changes since this review

@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot 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 Aug 26, 2025
@bors
Copy link
Collaborator

bors commented Aug 26, 2025

☔ The latest upstream changes (presumably #145871) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Aug 26, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Kobzol
Copy link
Member Author

Kobzol commented Aug 26, 2025

@bors r=jieyouxu

@bors
Copy link
Collaborator

bors commented Aug 26, 2025

📌 Commit 5cf9c13 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 26, 2025
bors added a commit that referenced this pull request Aug 26, 2025
Rollup of 9 pull requests

Successful merges:

 - #144499 (ci: Begin running ui tests with `rust.debuginfo-level-tests=1`)
 - #145790 (Improve dist for gnullvm hosts)
 - #145792 (Use attribute name in message for "outer attr used as inner attr" errors)
 - #145840 (rustc_codegen_ssa: More comprehensive RISC-V ELF flags)
 - #145876 (Enable building/disting standard library in stage 0)
 - #145887 (bootstrap: Don't panic if codegen-backends is set to empty)
 - #145888 (platform-support: Fix LoongArch32 host column)
 - #145892 (add a flag to codegen fn attrs for foreign items)
 - #145901 (Fix typo in comment of library/alloc/src/raw_vec/mod.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5ba3bfc into rust-lang:master Aug 27, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 27, 2025
rust-timer added a commit that referenced this pull request Aug 27, 2025
Rollup merge of #145876 - Kobzol:dist-std-build, r=jieyouxu

Enable building/disting standard library in stage 0

After the stage0 redesign, building a stage0 library no longer is a thing, because the stage0 compiler normally cannot build libstd anymore. However, there are valid use-cases for having the ability to quickly cross-compile libstd for different targets, when the stage0 compiler is e.g. a stable released version, and you want to cross-compile libstd from the same sources of that compiler.

This PR allows that, as long as you set `build.local-rebuild = true`, which promises bootstrap that the stage0 compiler actually comes from in-tree sources, and can thus compile libstd.

The change needed to enable this is very minimal, so I think that it is worth it to allow this use-case to work.

Fixes: #145587
Fixes: #145859
Related issue: #94781

r? `@jieyouxu`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 27, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#144499 (ci: Begin running ui tests with `rust.debuginfo-level-tests=1`)
 - rust-lang/rust#145790 (Improve dist for gnullvm hosts)
 - rust-lang/rust#145792 (Use attribute name in message for "outer attr used as inner attr" errors)
 - rust-lang/rust#145840 (rustc_codegen_ssa: More comprehensive RISC-V ELF flags)
 - rust-lang/rust#145876 (Enable building/disting standard library in stage 0)
 - rust-lang/rust#145887 (bootstrap: Don't panic if codegen-backends is set to empty)
 - rust-lang/rust#145888 (platform-support: Fix LoongArch32 host column)
 - rust-lang/rust#145892 (add a flag to codegen fn attrs for foreign items)
 - rust-lang/rust#145901 (Fix typo in comment of library/alloc/src/raw_vec/mod.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@Kobzol Kobzol deleted the dist-std-build branch August 27, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build stage 0 rust-std from rust-src with local rust Unable to build cross target's libstd on Rust 1.89
5 participants