Skip to content

Commit 56eae72

Browse files
authored
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](#131744).
2 parents 83085b9 + 774201e commit 56eae72

File tree

1 file changed

+9
-7
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+9
-7
lines changed

src/bootstrap/src/core/build_steps/test.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -1734,13 +1734,15 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
17341734
} else {
17351735
// We need to properly build cargo using the suitable stage compiler.
17361736

1737-
// HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if
1738-
// you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built
1739-
// and produce a cargo built with stage 2 rustc. To fix this, we need to chop off
1740-
// the compiler stage by 1 to align with expected `./x test run-make --stage N`
1741-
// behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri
1742-
// which does a similar hack.
1743-
let compiler = builder.compiler(builder.top_stage - 1, compiler.host);
1737+
let compiler = builder.download_rustc().then_some(compiler).unwrap_or_else(||
1738+
// HACK: currently tool stages are off-by-one compared to compiler stages, i.e. if
1739+
// you give `tool::Cargo` a stage 1 rustc, it will cause stage 2 rustc to be built
1740+
// and produce a cargo built with stage 2 rustc. To fix this, we need to chop off
1741+
// the compiler stage by 1 to align with expected `./x test run-make --stage N`
1742+
// behavior, i.e. we need to pass `N - 1` compiler stage to cargo. See also Miri
1743+
// which does a similar hack.
1744+
builder.compiler(builder.top_stage - 1, compiler.host));
1745+
17441746
builder.ensure(tool::Cargo { compiler, target: compiler.host })
17451747
};
17461748

0 commit comments

Comments
 (0)