Skip to content

Commit b48bcb2

Browse files
committed
Do not explicitly build Rustc when bootstrap is invoked with the compiler path
It was confusing that the `Rustc` step was invoked twice, once with all crates and once with no crates (even though both of these mean the same thing).
1 parent 2e423d2 commit b48bcb2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,12 @@ impl Step for Rustc {
10131013
}
10141014

10151015
fn make_run(run: RunConfig<'_>) {
1016+
// If only `compiler` was passed, do not run this step.
1017+
// Instead the `Assemble` step will take care of compiling Rustc.
1018+
if run.builder.paths == vec![PathBuf::from("compiler")] {
1019+
return;
1020+
}
1021+
10161022
let crates = run.cargo_crates_in_set();
10171023
run.builder.ensure(Rustc {
10181024
build_compiler: run

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,24 +1244,19 @@ mod staging {
12441244
insta::assert_snapshot!(get_steps("compiler", "build", None), @r"
12451245
[build] llvm <target1>
12461246
[build] rustc 0 <target1> -> rustc 1 <target1>
1247-
[build] rustc 0 <target1> -> rustc 1 <target1>
12481247
");
12491248
}
12501249

12511250
#[test]
12521251
fn build_compiler_stage_0() {
1253-
insta::assert_snapshot!(get_steps("compiler", "build", Some(0)), @r"
1254-
[build] llvm <target1>
1255-
[build] rustc 0 <target1> -> rustc 1 <target1>
1256-
");
1252+
insta::assert_snapshot!(get_steps("compiler", "build", Some(0)), @"");
12571253
}
12581254

12591255
#[test]
12601256
fn build_compiler_stage_1() {
12611257
insta::assert_snapshot!(get_steps("compiler", "build", Some(1)), @r"
12621258
[build] llvm <target1>
12631259
[build] rustc 0 <target1> -> rustc 1 <target1>
1264-
[build] rustc 0 <target1> -> rustc 1 <target1>
12651260
");
12661261
}
12671262

@@ -1272,12 +1267,11 @@ mod staging {
12721267
[build] rustc 0 <target1> -> rustc 1 <target1>
12731268
[build] rustc 1 <target1> -> std 1 <target1>
12741269
[build] rustc 1 <target1> -> rustc 2 <target1>
1275-
[build] rustc 1 <target1> -> rustc 2 <target1>
12761270
");
12771271
}
12781272

12791273
fn get_steps(path: &str, kind: &str, stage: Option<u32>) -> String {
1280-
let mut args = vec![kind];
1274+
let mut args = vec![kind, path];
12811275
let stage_str = stage.map(|v| v.to_string()).unwrap_or_default();
12821276
if let Some(stage) = stage {
12831277
args.push("--stage");

0 commit comments

Comments
 (0)