diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-22 15:28:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-22 15:28:47 +0200 |
| commit | 56eae720bdffe2b81df69835b0934a819e87d143 (patch) | |
| tree | c67595ef19c4f536d6b89386a0f32da94a363a2f | |
| parent | 83085b99c2647cba54229b942978e4b0d79bf14f (diff) | |
| parent | 774201e3b631c488c8dff4ddb20f3988c2c7d21a (diff) | |
| download | rust-56eae720bdffe2b81df69835b0934a819e87d143.tar.gz rust-56eae720bdffe2b81df69835b0934a819e87d143.zip | |
Rollup merge of #132006 - onur-ozkan:131947, r=jieyouxu
don't stage-off to previous compiler when CI rustc is available Resolves the 4th item in [Tracking Issue for download-rustc improvements](https://github.com/rust-lang/rust/issues/131744).
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 0a160ce4182..27acaff8255 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1734,13 +1734,15 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the } else { // We need to properly build cargo using the suitable stage compiler. - // HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if - // you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built - // and produce a cargo built with stage 2 rustc. To fix this, we need to chop off - // the compiler stage by 1 to align with expected `./x test run-make --stage N` - // behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri - // which does a similar hack. - let compiler = builder.compiler(builder.top_stage - 1, compiler.host); + let compiler = builder.download_rustc().then_some(compiler).unwrap_or_else(|| + // HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if + // you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built + // and produce a cargo built with stage 2 rustc. To fix this, we need to chop off + // the compiler stage by 1 to align with expected `./x test run-make --stage N` + // behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri + // which does a similar hack. + builder.compiler(builder.top_stage - 1, compiler.host)); + builder.ensure(tool::Cargo { compiler, target: compiler.host }) }; |
