Skip to content

Commit

Permalink
Unrolled build for rust-lang#132006
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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](rust-lang#131744).
  • Loading branch information
rust-timer authored Oct 22, 2024
2 parents bca5fde + 774201e commit 729014e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
};

Expand Down

0 comments on commit 729014e

Please sign in to comment.