Skip to content

Commit 6d41c71

Browse files
committed
Remove compiler_for from dist::Extended
1 parent 71de9d1 commit 6d41c71

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,10 +1590,10 @@ impl Step for Rustfmt {
15901590
}
15911591
}
15921592

1593-
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
1593+
/// Extended archive that contains the compiler, standard library and a bunch of tools.
1594+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
15941595
pub struct Extended {
1595-
stage: u32,
1596-
host: TargetSelection,
1596+
build_compiler: Compiler,
15971597
target: TargetSelection,
15981598
}
15991599

@@ -1609,19 +1609,17 @@ impl Step for Extended {
16091609

16101610
fn make_run(run: RunConfig<'_>) {
16111611
run.builder.ensure(Extended {
1612-
stage: run.builder.top_stage,
1613-
host: run.builder.config.host_target,
1612+
build_compiler: run
1613+
.builder
1614+
.compiler(run.builder.top_stage - 1, run.builder.host_target),
16141615
target: run.target,
16151616
});
16161617
}
16171618

16181619
/// Creates a combined installer for the specified target in the provided stage.
16191620
fn run(self, builder: &Builder<'_>) {
16201621
let target = self.target;
1621-
let stage = self.stage;
1622-
let compiler = builder.compiler_for(self.stage, self.host, self.target);
1623-
1624-
builder.info(&format!("Dist extended stage{} ({})", compiler.stage, target));
1622+
builder.info(&format!("Dist extended stage{} ({target})", builder.top_stage));
16251623

16261624
let mut tarballs = Vec::new();
16271625
let mut built_tools = HashSet::new();
@@ -1634,38 +1632,38 @@ impl Step for Extended {
16341632
};
16351633
}
16361634

1637-
let target_compiler = builder.compiler(stage, target);
1635+
let rustc_private_compilers =
1636+
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target);
1637+
let build_compiler = rustc_private_compilers.build_compiler();
1638+
let target_compiler = rustc_private_compilers.target_compiler();
1639+
16381640
// When rust-std package split from rustc, we needed to ensure that during
16391641
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
16401642
// the std files during uninstall. To do this ensure that rustc comes
16411643
// before rust-std in the list below.
16421644
tarballs.push(builder.ensure(Rustc { target_compiler }));
1643-
tarballs
1644-
.push(builder.ensure(Std { build_compiler: compiler, target }).expect("missing std"));
1645+
tarballs.push(builder.ensure(Std { build_compiler, target }).expect("missing std"));
16451646

16461647
if target.is_windows_gnu() {
16471648
tarballs.push(builder.ensure(Mingw { target }).expect("missing mingw"));
16481649
}
16491650

1650-
let rustc_private_compilers =
1651-
RustcPrivateCompilers::from_build_compiler(builder, compiler, target);
1652-
16531651
add_component!("rust-docs" => Docs { host: target });
16541652
// Std stage N is documented with compiler stage N
16551653
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
1656-
add_component!("cargo" => Cargo { build_compiler: compiler, target });
1654+
add_component!("cargo" => Cargo { build_compiler, target });
16571655
add_component!("rustfmt" => Rustfmt { compilers: rustc_private_compilers, target });
16581656
add_component!("rust-analyzer" => RustAnalyzer { compilers: rustc_private_compilers, target });
16591657
add_component!("llvm-components" => LlvmTools { target });
16601658
add_component!("clippy" => Clippy { compilers: rustc_private_compilers, target });
16611659
add_component!("miri" => Miri { compilers: rustc_private_compilers, target });
1662-
add_component!("analysis" => Analysis { build_compiler: compiler, target });
1660+
add_component!("analysis" => Analysis { build_compiler, target });
16631661
add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend {
16641662
compilers: rustc_private_compilers,
16651663
target
16661664
});
16671665
add_component!("llvm-bitcode-linker" => LlvmBitcodeLinker {
1668-
build_compiler: compiler,
1666+
build_compiler,
16691667
target
16701668
});
16711669

@@ -2131,6 +2129,10 @@ impl Step for Extended {
21312129
}
21322130
}
21332131
}
2132+
2133+
fn metadata(&self) -> Option<StepMetadata> {
2134+
Some(StepMetadata::dist("extended", self.target).built_by(self.build_compiler))
2135+
}
21342136
}
21352137

21362138
fn add_env(

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,7 @@ mod snapshot {
11361136
[build] rustc 1 <host> -> miri 2 <host>
11371137
[build] rustc 1 <host> -> cargo-miri 2 <host>
11381138
[dist] rustc 1 <host> -> miri 2 <host>
1139+
[dist] rustc 1 <host> -> extended 2 <host>
11391140
");
11401141
}
11411142

@@ -1472,6 +1473,7 @@ mod snapshot {
14721473
[dist] rustc 1 <host> -> miri 2 <target1>
14731474
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>
14741475
[doc] rustc 2 <target1> -> std 2 <target1> crates=[]
1476+
[dist] rustc 1 <host> -> extended 2 <target1>
14751477
");
14761478
}
14771479

0 commit comments

Comments
 (0)