Skip to content

Reduce usage of compiler_for in bootstrap #145310

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Aug 12, 2025

While working on refactoring/fixing dist steps, I realized that build.full-bootstrap does much more than it should, and that it its documentation is wrong. It seems that the main purpose of this option should be to enable/disable stdlib/compiler uplifting (https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Purpose.20of.20.60build.2Efull-bootstrap.60/with/533985624), but currently it also affects staging, or more precisely which compiler will be used to build selected steps, because this option is used in the cursed compiler_for function.

I would like to change the option it so that it only affects uplifting, and doesn't affect stage selection, which I (partially) did in this PR. I removed the usage of compiler_for from the Std and Rustc steps, and explicitly implemented uplifting, without going through compiler_for.

The only remaining usages of compiler_for are in dist steps (which I'm currently refactoring, will send a PR later) and test steps (which I will take a look at after dist). After that we can finally remove the function.

I tried to document the case when uplifting was happening during cross-compilation, which was very implicit before. I also did a slight change in the uplifting logic for rustc when cross-compiling. Before, we would attempt to uplift a stage1 rustc, but that is not really a thing when cross-compiling.

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

rustbot commented Aug 12, 2025

This PR modifies bootstrap.example.toml.

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

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the compiler-for-revamp branch from b4c6c8e to 39ff9a3 Compare August 12, 2025 18:15
@bors
Copy link
Collaborator

bors commented Aug 13, 2025

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

@Kobzol Kobzol force-pushed the compiler-for-revamp branch from 39ff9a3 to 4d9cbfd Compare August 13, 2025 06:06
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.

Thanks. The staging reasoning looks right to me. You can r=me once the tracing PR merges then rebase, as I think there might be a merge conflict there.

@@ -143,7 +144,7 @@ impl Step for Std {
skip_all,
fields(
target = ?self.target,
compiler = ?self.compiler,
build_compiler = ?self.build_compiler,
Copy link
Member

Choose a reason for hiding this comment

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

Remark: I think this will merge-conflict with #145340

@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 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants