Skip to content

Commit b0ec353

Browse files
authored
Rollup merge of #108866 - Kohei316:master, r=ozkanonur
Force to use the stage 2 compiler when config.download_rustc is set Fixes #108768
2 parents 85c475a + 740d476 commit b0ec353

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/bootstrap/builder.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -910,14 +910,16 @@ impl<'a> Builder<'a> {
910910
/// new artifacts, it can't be used to rely on the presence of a particular
911911
/// sysroot.
912912
///
913-
/// See `force_use_stage1` for documentation on what each argument is.
913+
/// See `force_use_stage1` and `force_use_stage2` for documentation on what each argument is.
914914
pub fn compiler_for(
915915
&self,
916916
stage: u32,
917917
host: TargetSelection,
918918
target: TargetSelection,
919919
) -> Compiler {
920-
if self.build.force_use_stage1(Compiler { stage, host }, target) {
920+
if self.build.force_use_stage2() {
921+
self.compiler(2, self.config.build)
922+
} else if self.build.force_use_stage1(Compiler { stage, host }, target) {
921923
self.compiler(1, self.config.build)
922924
} else {
923925
self.compiler(stage, host)

src/bootstrap/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,15 @@ impl Build {
12091209
&& (self.hosts.iter().any(|h| *h == target) || target == self.build)
12101210
}
12111211

1212+
/// Checks whether the `compiler` compiling for `target` should be forced to
1213+
/// use a stage2 compiler instead.
1214+
///
1215+
/// When we download the pre-compiled version of rustc it should be forced to
1216+
/// use a stage2 compiler.
1217+
fn force_use_stage2(&self) -> bool {
1218+
self.config.download_rustc()
1219+
}
1220+
12121221
/// Given `num` in the form "a.b.c" return a "release string" which
12131222
/// describes the release version number.
12141223
///

0 commit comments

Comments
 (0)