Skip to content

Fix rustc uplifting (take two)#145645

Merged
bors merged 2 commits intorust-lang:masterfrom
Kobzol:uplift-fix
Aug 20, 2025
Merged

Fix rustc uplifting (take two)#145645
bors merged 2 commits intorust-lang:masterfrom
Kobzol:uplift-fix

Conversation

@Kobzol
Copy link
Copy Markdown
Member

@Kobzol Kobzol commented Aug 20, 2025

The rustc uplifting logic is really annoying.. #145557 was not enough to fix it.

Consider #145534 (comment): in this situation, we do a stage3 build of a cross-compiled rustc (it happens because we run x test --stage 2, which mistakenly builds a stage3 rustc, but it doesn't matter what casuses it, what matters is that the stage3 build isn't working).

Currently, a stage3 cross-compiled build of rustc works like this:

  1. stage0 (host) -> stage1 (host)
  2. stage1 (host) -> stage2 (host)
  3. stage2 (host) -> stage3 (target)

The problem is that in the uplifting logic, I assumed that we will have a stage2 (target) rustc available, which we can uplift. And that would indeed be an ideal solution. But currently, we will actually build a stage2 (host) rustc, and only then start the cross-compilation. So the uplifting is broken.

I spend a couple of hours trying to fix this, and do the uplifting "from the other direction", so that already when we assemble a stage3 rustc, we notice that an uplift should happen, and we only build stage1 (host) rustc, which also helps avoid one needless rustc build. However, this was relatively complicated and would require larger changes that I was not confident landing at this time.

So instead I decided to do a much simpler fix, and just disable rustc uplifting when cross-compiling. Since we currently do the stage2 (host) -> stage3 (target) step, it should not actually affect stage3 cross-compiled builds in any way (I hope..), and should only affect stage4+ builds, about which I don't really care (the only change there should be more rustc builds). For normal builds, the stage2 host rustc should (hopefully) always be present, so we shouldn't run into this issue.

Eventually, I would like to remove rustc uplifting completely. However, x test --stage 2 on CI still currently builds a stage3 rustc for some reason, and if we removed uplifting completely, even for non-cross-compiled builds, that would cause an additional rustc build, and that's not great. So for now let's just allow uplifting for non-cross-compiled builds.

Fixes #145534.

r? @jieyouxu

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nightly cross build started failing 2025-08-16

5 participants