Skip to content

Do not copy .rmeta files into the sysroot of the build compiler during check #144252

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Jul 21, 2025

Before, when bootstrap did a check build of rustc stage N (with a build compiler that was stage N-1), it automatically copied the resulting .rmeta artifacts into the sysroot of the stage N-1 build compiler, so that stage N rustc_private tools such as miri could be compiled using the stage N-1 build compiler. This has a number of issues:

  • It was done unconditionally, even if no rustc_private tools were actually built.
  • If we did a check and a build of the same stage compiler in the same bootstrap invocation, the generated rmeta and rlib files could clash. This is also why you can see that check::Std actually doesn't copy the artifacts anymore (which forces us to build std instead of just checking it in a bunch of Check steps).
  • It was polluting the sysroot of the build compiler. This is especially annoying for the stage 0 compiler, because we are forced to create an artificial sysroot for it, so that we can copy new stuff into it.
  • It was very implicit in bootstrap.

Based on suggestions by @cuviper and @bjorn3, I tried to change how this behaves. Instead of copying the rmeta artifacts into the sysroot of the build compiler (from where they would be loaded implicitly), they are now stored in a separate transient bootstrap build directory, and they are then explicitly passed only when checking rustc_private tools using the -L flag. The flags are passed out-of-band through our rustc wrapper, to avoid invalidating the build cache.

Based on my local tests, this seemed to be working fine. If it works on CI, and we don't run into other issues after merging it, I'd like to do the same also for rlib artifacts generated during x build.

Based on #143816 (only the last commit is new).

r? @jieyouxu

@rustbot
Copy link
Collaborator

rustbot commented Jul 21, 2025

jieyouxu is currently at their maximum review capacity.
They may take a while to respond.

@rustbot rustbot added 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) labels Jul 21, 2025
@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented Jul 21, 2025

nit: s/hcekc/check in the PR title

@Kobzol Kobzol changed the title Do not copy .rmeta files into the sysroot of the build compiler during hcekc Do not copy .rmeta files into the sysroot of the build compiler during check Jul 21, 2025
@Kobzol
Copy link
Member Author

Kobzol commented Jul 21, 2025

I will also need to do this for the Clippy steps.

@Kobzol
Copy link
Member Author

Kobzol commented Jul 21, 2025

Uhh, x clippy ci ran clippy using in-tree clippy, not stage 0 clippy. I will have to go through the clippy steps first and make that more compatible with what x check does first.

This helps to avoid polluting the sysroot of the build compiler.
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