Tracking Issue for bootstrap spurious rebuilds
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for collecting spurious rebuild issues in bootstrap. Spurious rebuilds refer to rebuilds that seem unnecessary, e.g. if running ./x test run-make twice in a row without modifying any sources rebuilds cargo. Note that is this not always the case, e.g. at the time when this issue was created, mir-opt tests build a special std with mir-opt RUSTFLAGS, which will need to be rebuilt if trying to go to stage2 because a stage2 rustc will expect a stage1 "standard" std build without mir-opt RUSTFLAGS (there are other solutions to that, not in the scope of this issue).
Categories
NOTE: There is only currently one category of spurious rebuilds that I am acutely aware of, it's entirely possible to have other classes of causes for spurious rebuilds.
Differing RUSTFLAGS
While some of these issues are closed, the fixes are usually stopgap solutions.
- #131636
- #131437
- #130108
- Remark: this is
RUSTFLAGStoo viacargo.configure_linker.
- Remark: this is
- #126464
- #123177
Preventing spurious rebuilds due to differing RUSTFLAGS
To solve the class of spurious rebuilds due to differing RUSTFLAGS, we will need to properly handle them. Specifically, we need to (https://github.com/rust-lang/rust/issues/131636#issuecomment-2412844566):
- Centralize
RUSTFLAGShandling to forbid naive "conditional"RUSTFLAGS. - Conditional
RUSTFLAGSshould be propagated to bootstrap shims using environment variable (something likeIMPLICIT_RUSTFLAGS) so they can't invalidate the build cache. - Ensure bootstrap should never set any conditional rustflag explicitly on cargo.
Discussion
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the bootstrap behavior with ./x test run-make twice, then read the linked issues #131636, #131437, #130108, #126464, and #123177 and the referenced Zulip discussion. Done means conditional RUSTFLAGS are centralized, propagated to bootstrap shims without invalidating the build cache, and are not set explicitly on cargo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100