Skip to content

Commit f8a913b

Browse files
committed
Auto merge of #137476 - onur-ozkan:137469, r=jieyouxu
avoid `compiler_for` for dist tools 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 #137469
2 parents b522e7c + 1c7b60f commit f8a913b

File tree

3 files changed

+14
-47
lines changed

3 files changed

+14
-47
lines changed

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

+10-46
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,
@@ -775,11 +771,7 @@ impl Step for Analysis {
775771
// Find the actual compiler (handling the full bootstrap option) which
776772
// produced the save-analysis data because that data isn't copied
777773
// through the sysroot uplifting.
778-
compiler: run.builder.compiler_for(
779-
run.builder.top_stage,
780-
run.builder.config.build,
781-
run.target,
782-
),
774+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
783775
target: run.target,
784776
});
785777
}
@@ -1124,11 +1116,7 @@ impl Step for Cargo {
11241116

11251117
fn make_run(run: RunConfig<'_>) {
11261118
run.builder.ensure(Cargo {
1127-
compiler: run.builder.compiler_for(
1128-
run.builder.top_stage,
1129-
run.builder.config.build,
1130-
run.target,
1131-
),
1119+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
11321120
target: run.target,
11331121
});
11341122
}
@@ -1173,11 +1161,7 @@ impl Step for Rls {
11731161

11741162
fn make_run(run: RunConfig<'_>) {
11751163
run.builder.ensure(Rls {
1176-
compiler: run.builder.compiler_for(
1177-
run.builder.top_stage,
1178-
run.builder.config.build,
1179-
run.target,
1180-
),
1164+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
11811165
target: run.target,
11821166
});
11831167
}
@@ -1215,11 +1199,7 @@ impl Step for RustAnalyzer {
12151199

12161200
fn make_run(run: RunConfig<'_>) {
12171201
run.builder.ensure(RustAnalyzer {
1218-
compiler: run.builder.compiler_for(
1219-
run.builder.top_stage,
1220-
run.builder.config.build,
1221-
run.target,
1222-
),
1202+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
12231203
target: run.target,
12241204
});
12251205
}
@@ -1257,11 +1237,7 @@ impl Step for Clippy {
12571237

12581238
fn make_run(run: RunConfig<'_>) {
12591239
run.builder.ensure(Clippy {
1260-
compiler: run.builder.compiler_for(
1261-
run.builder.top_stage,
1262-
run.builder.config.build,
1263-
run.target,
1264-
),
1240+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
12651241
target: run.target,
12661242
});
12671243
}
@@ -1304,11 +1280,7 @@ impl Step for Miri {
13041280

13051281
fn make_run(run: RunConfig<'_>) {
13061282
run.builder.ensure(Miri {
1307-
compiler: run.builder.compiler_for(
1308-
run.builder.top_stage,
1309-
run.builder.config.build,
1310-
run.target,
1311-
),
1283+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
13121284
target: run.target,
13131285
});
13141286
}
@@ -1442,11 +1414,7 @@ impl Step for Rustfmt {
14421414

14431415
fn make_run(run: RunConfig<'_>) {
14441416
run.builder.ensure(Rustfmt {
1445-
compiler: run.builder.compiler_for(
1446-
run.builder.top_stage,
1447-
run.builder.config.build,
1448-
run.target,
1449-
),
1417+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
14501418
target: run.target,
14511419
});
14521420
}
@@ -1496,7 +1464,7 @@ impl Step for Extended {
14961464
fn run(self, builder: &Builder<'_>) {
14971465
let target = self.target;
14981466
let stage = self.stage;
1499-
let compiler = builder.compiler_for(self.stage, self.host, self.target);
1467+
let compiler = builder.compiler(self.stage, self.host);
15001468

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

@@ -2260,11 +2228,7 @@ impl Step for LlvmBitcodeLinker {
22602228

22612229
fn make_run(run: RunConfig<'_>) {
22622230
run.builder.ensure(LlvmBitcodeLinker {
2263-
compiler: run.builder.compiler_for(
2264-
run.builder.top_stage,
2265-
run.builder.config.build,
2266-
run.target,
2267-
),
2231+
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
22682232
target: run.target,
22692233
});
22702234
}

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,

src/bootstrap/src/core/builder/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ mod dist {
525525
first(cache.all::<compile::Rustc>()),
526526
&[
527527
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 0),
528-
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 0),
528+
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_1, stage = 1),
529529
rustc!(TEST_TRIPLE_1 => TEST_TRIPLE_2, stage = 1),
530530
]
531531
);

0 commit comments

Comments
 (0)