Skip to content

Commit

Permalink
Rollup merge of rust-lang#108866 - Kohei316:master, r=ozkanonur
Browse files Browse the repository at this point in the history
Force to use the stage 2 compiler  when config.download_rustc is set

Fixes rust-lang#108768
  • Loading branch information
matthiaskrgr authored Mar 7, 2023
2 parents 85c475a + 740d476 commit b0ec353
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,16 @@ impl<'a> Builder<'a> {
/// new artifacts, it can't be used to rely on the presence of a particular
/// sysroot.
///
/// See `force_use_stage1` for documentation on what each argument is.
/// See `force_use_stage1` and `force_use_stage2` for documentation on what each argument is.
pub fn compiler_for(
&self,
stage: u32,
host: TargetSelection,
target: TargetSelection,
) -> Compiler {
if self.build.force_use_stage1(Compiler { stage, host }, target) {
if self.build.force_use_stage2() {
self.compiler(2, self.config.build)
} else if self.build.force_use_stage1(Compiler { stage, host }, target) {
self.compiler(1, self.config.build)
} else {
self.compiler(stage, host)
Expand Down
9 changes: 9 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,15 @@ impl Build {
&& (self.hosts.iter().any(|h| *h == target) || target == self.build)
}

/// Checks whether the `compiler` compiling for `target` should be forced to
/// use a stage2 compiler instead.
///
/// When we download the pre-compiled version of rustc it should be forced to
/// use a stage2 compiler.
fn force_use_stage2(&self) -> bool {
self.config.download_rustc()
}

/// Given `num` in the form "a.b.c" return a "release string" which
/// describes the release version number.
///
Expand Down

0 comments on commit b0ec353

Please sign in to comment.