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.
- Clippy gets rebuilt twice on every change, and rustdoc also gets rebuilt #131636
- Running
./x test mir-opt
rebuilds std every time #131437 - Bootstrap re-builds everything after "x.py check" #130108
- Remark: this is
RUSTFLAGS
too viacargo.configure_linker
.
- Remark: this is
- Running run-make tests performs unnecessary rebuilds #126464
- Running
./x.py test miri --stage 0
twice rebuilds miri, cargo-miri, and rustdoc #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 (#131636 (comment)):
- Centralize
RUSTFLAGS
handling to forbid naive "conditional"RUSTFLAGS
. - Conditional
RUSTFLAGS
should 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.