Skip to content

Commit 39ca7bb

Browse files
committed
Auto merge of rust-lang#137476 - onur-ozkan:137469, r=<try>
avoid `compiler_for` for dist steps and force the current compiler Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler. Fixes rust-lang#137469
2 parents 1805b33 + 4a1f7a1 commit 39ca7bb

File tree

2 files changed

+17
-58
lines changed

2 files changed

+17
-58
lines changed

src/bootstrap/src/core/build_steps/dist.rs

+14-58
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,7 @@ impl Step for Rustc {
421421

422422
if let Some(ra_proc_macro_srv) = builder.ensure_if_default(
423423
tool::RustAnalyzerProcMacroSrv {
424-
compiler: builder.compiler_for(
425-
compiler.stage,
426-
builder.config.build,
427-
compiler.host,
428-
),
424+
compiler: builder.compiler(compiler.stage, builder.config.build),
429425
target: compiler.host,
430426
},
431427
builder.kind,
@@ -661,11 +657,7 @@ impl Step for Std {
661657

662658
fn make_run(run: RunConfig<'_>) {
663659
run.builder.ensure(Std {
664-
compiler: run.builder.compiler_for(
665-
run.builder.top_stage,
666-
run.builder.config.build,
667-
run.target,
668-
),
660+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
669661
target: run.target,
670662
});
671663
}
@@ -683,7 +675,7 @@ impl Step for Std {
683675
let mut tarball = Tarball::new(builder, "rust-std", &target.triple);
684676
tarball.include_target_in_component_name(true);
685677

686-
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
678+
let compiler_to_use = builder.compiler(compiler.stage, compiler.host);
687679
let stamp = build_stamp::libstd_stamp(builder, compiler_to_use, target);
688680
verify_uefi_rlib_format(builder, target, &stamp);
689681
copy_target_libs(builder, target, tarball.image_dir(), &stamp);
@@ -713,11 +705,7 @@ impl Step for RustcDev {
713705

714706
fn make_run(run: RunConfig<'_>) {
715707
run.builder.ensure(RustcDev {
716-
compiler: run.builder.compiler_for(
717-
run.builder.top_stage,
718-
run.builder.config.build,
719-
run.target,
720-
),
708+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
721709
target: run.target,
722710
});
723711
}
@@ -733,7 +721,7 @@ impl Step for RustcDev {
733721

734722
let tarball = Tarball::new(builder, "rustc-dev", &target.triple);
735723

736-
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
724+
let compiler_to_use = builder.compiler(compiler.stage, compiler.host);
737725
let stamp = build_stamp::librustc_stamp(builder, compiler_to_use, target);
738726
copy_target_libs(builder, target, tarball.image_dir(), &stamp);
739727

@@ -775,11 +763,7 @@ impl Step for Analysis {
775763
// Find the actual compiler (handling the full bootstrap option) which
776764
// produced the save-analysis data because that data isn't copied
777765
// through the sysroot uplifting.
778-
compiler: run.builder.compiler_for(
779-
run.builder.top_stage,
780-
run.builder.config.build,
781-
run.target,
782-
),
766+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
783767
target: run.target,
784768
});
785769
}
@@ -1124,11 +1108,7 @@ impl Step for Cargo {
11241108

11251109
fn make_run(run: RunConfig<'_>) {
11261110
run.builder.ensure(Cargo {
1127-
compiler: run.builder.compiler_for(
1128-
run.builder.top_stage,
1129-
run.builder.config.build,
1130-
run.target,
1131-
),
1111+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
11321112
target: run.target,
11331113
});
11341114
}
@@ -1173,11 +1153,7 @@ impl Step for Rls {
11731153

11741154
fn make_run(run: RunConfig<'_>) {
11751155
run.builder.ensure(Rls {
1176-
compiler: run.builder.compiler_for(
1177-
run.builder.top_stage,
1178-
run.builder.config.build,
1179-
run.target,
1180-
),
1156+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
11811157
target: run.target,
11821158
});
11831159
}
@@ -1215,11 +1191,7 @@ impl Step for RustAnalyzer {
12151191

12161192
fn make_run(run: RunConfig<'_>) {
12171193
run.builder.ensure(RustAnalyzer {
1218-
compiler: run.builder.compiler_for(
1219-
run.builder.top_stage,
1220-
run.builder.config.build,
1221-
run.target,
1222-
),
1194+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
12231195
target: run.target,
12241196
});
12251197
}
@@ -1257,11 +1229,7 @@ impl Step for Clippy {
12571229

12581230
fn make_run(run: RunConfig<'_>) {
12591231
run.builder.ensure(Clippy {
1260-
compiler: run.builder.compiler_for(
1261-
run.builder.top_stage,
1262-
run.builder.config.build,
1263-
run.target,
1264-
),
1232+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
12651233
target: run.target,
12661234
});
12671235
}
@@ -1304,11 +1272,7 @@ impl Step for Miri {
13041272

13051273
fn make_run(run: RunConfig<'_>) {
13061274
run.builder.ensure(Miri {
1307-
compiler: run.builder.compiler_for(
1308-
run.builder.top_stage,
1309-
run.builder.config.build,
1310-
run.target,
1311-
),
1275+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
13121276
target: run.target,
13131277
});
13141278
}
@@ -1442,11 +1406,7 @@ impl Step for Rustfmt {
14421406

14431407
fn make_run(run: RunConfig<'_>) {
14441408
run.builder.ensure(Rustfmt {
1445-
compiler: run.builder.compiler_for(
1446-
run.builder.top_stage,
1447-
run.builder.config.build,
1448-
run.target,
1449-
),
1409+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
14501410
target: run.target,
14511411
});
14521412
}
@@ -1496,7 +1456,7 @@ impl Step for Extended {
14961456
fn run(self, builder: &Builder<'_>) {
14971457
let target = self.target;
14981458
let stage = self.stage;
1499-
let compiler = builder.compiler_for(self.stage, self.host, self.target);
1459+
let compiler = builder.compiler(self.stage, self.host);
15001460

15011461
builder.info(&format!("Dist extended stage{} ({})", compiler.stage, target));
15021462

@@ -2260,11 +2220,7 @@ impl Step for LlvmBitcodeLinker {
22602220

22612221
fn make_run(run: RunConfig<'_>) {
22622222
run.builder.ensure(LlvmBitcodeLinker {
2263-
compiler: run.builder.compiler_for(
2264-
run.builder.top_stage,
2265-
run.builder.config.build,
2266-
run.target,
2267-
),
2223+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
22682224
target: run.target,
22692225
});
22702226
}

src/bootstrap/src/core/builder/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,9 @@ impl<'a> Builder<'a> {
12621262
),
12631263
),
12641264
)]
1265+
1266+
/// FIXME: This function is unnecessary (and dangerous, see https://github.com/rust-lang/rust/issues/137469).
1267+
/// We already have uplifting logic for the compiler, so remove this.
12651268
pub fn compiler_for(
12661269
&self,
12671270
stage: u32,

0 commit comments

Comments
 (0)