diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-10 22:00:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-10 22:00:49 +0200 |
| commit | 28bc5a2f7fec125faa7a366f4dfbf2d349fbb8fe (patch) | |
| tree | 33d42846ab93a308ec2823b98728df78d91df90e | |
| parent | 4f2af123ebf687888e2003676f6d7ae79f811640 (diff) | |
| parent | becf664e4930ce59fb01905e4c6af38c2df5382e (diff) | |
| download | rust-28bc5a2f7fec125faa7a366f4dfbf2d349fbb8fe.tar.gz rust-28bc5a2f7fec125faa7a366f4dfbf2d349fbb8fe.zip | |
Rollup merge of #131442 - jieyouxu:mir-opt-rebuild, r=onur-ozkan
Match std `RUSTFLAGS` for host and target for `mir-opt` test suite to fix double std build/rebuilds
Previously the bootstrap compiletest `Step::run` flow had:
```rs
// ensure that `libproc_macro` is available on the host.
builder.ensure(compile::Std::new(compiler, compiler.host));
// ...
if suite == "mir-opt" {
builder.ensure(compile::Std::new_for_mir_opt_tests(compiler, target));
} else {
builder.ensure(compile::Std::new(compiler, target));
}
```
This can cause unnecessary std rebuilds (even on the same invocation) because if host == target then `builder.ensure(compile::Std::new_for_mir_opt_tests(compiler, target))` will have different `RUSTFLAGS` than `builder.ensure(compile::Std::new(compiler, compiler.host))`.
This PR fixes that by matching up std `RUSTFLAGS` if the test suite is `mir-opt`:
```rs
if suite == "mir-opt" {
builder.ensure(compile::Std::new_for_mir_opt_tests(compiler, compiler.host));
} else {
builder.ensure(compile::Std::new(compiler, compiler.host));
}
```
This is a short-term fix, the better fix is to enforce how `RUSTFLAGS` are handled as described in https://github.com/rust-lang/rust/issues/131437#issuecomment-2401710727.
Fixes #131437.
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 0dd3d0b3bd1..e25b571acba 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1697,7 +1697,11 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the builder.ensure(TestHelpers { target: compiler.host }); // ensure that `libproc_macro` is available on the host. - builder.ensure(compile::Std::new(compiler, compiler.host)); + if suite == "mir-opt" { + builder.ensure(compile::Std::new_for_mir_opt_tests(compiler, compiler.host)); + } else { + builder.ensure(compile::Std::new(compiler, compiler.host)); + } // As well as the target if suite != "mir-opt" { |
