Skip to content

Commit 6c1ca03

Browse files
committed
Remove compiler_for from dist::Rustfmt
1 parent 3652493 commit 6c1ca03

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ impl Step for CraneliftCodegenBackend {
15601560

15611561
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
15621562
pub struct Rustfmt {
1563-
pub build_compiler: Compiler,
1563+
pub compilers: RustcPrivateCompilers,
15641564
pub target: TargetSelection,
15651565
}
15661566

@@ -1576,21 +1576,14 @@ impl Step for Rustfmt {
15761576

15771577
fn make_run(run: RunConfig<'_>) {
15781578
run.builder.ensure(Rustfmt {
1579-
build_compiler: run.builder.compiler_for(
1580-
run.builder.top_stage,
1581-
run.builder.config.host_target,
1582-
run.target,
1583-
),
1579+
compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target),
15841580
target: run.target,
15851581
});
15861582
}
15871583

15881584
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
1589-
let compilers =
1590-
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target);
1591-
1592-
let rustfmt = builder.ensure(tool::Rustfmt::from_compilers(compilers));
1593-
let cargofmt = builder.ensure(tool::Cargofmt::from_compilers(compilers));
1585+
let rustfmt = builder.ensure(tool::Rustfmt::from_compilers(self.compilers));
1586+
let cargofmt = builder.ensure(tool::Cargofmt::from_compilers(self.compilers));
15941587

15951588
let mut tarball = Tarball::new(builder, "rustfmt", &self.target.triple);
15961589
tarball.set_overlay(OverlayKind::Rustfmt);
@@ -1600,6 +1593,10 @@ impl Step for Rustfmt {
16001593
tarball.add_legal_and_readme_to("share/doc/rustfmt");
16011594
Some(tarball.generate())
16021595
}
1596+
1597+
fn metadata(&self) -> Option<StepMetadata> {
1598+
Some(StepMetadata::dist("rustfmt", self.target).built_by(self.compilers.build_compiler()))
1599+
}
16031600
}
16041601

16051602
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -1666,7 +1663,7 @@ impl Step for Extended {
16661663
// Std stage N is documented with compiler stage N
16671664
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
16681665
add_component!("cargo" => Cargo { build_compiler: compiler, target });
1669-
add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target });
1666+
add_component!("rustfmt" => Rustfmt { compilers: rustc_private_compilers, target });
16701667
add_component!("rust-analyzer" => RustAnalyzer { compilers: rustc_private_compilers, target });
16711668
add_component!("llvm-components" => LlvmTools { target });
16721669
add_component!("clippy" => Clippy { compilers: rustc_private_compilers, target });

src/bootstrap/src/core/build_steps/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ install!((self, builder, _config),
264264
};
265265
Rustfmt, alias = "rustfmt", Self::should_build(_config), IS_HOST: true, {
266266
if let Some(tarball) = builder.ensure(dist::Rustfmt {
267-
build_compiler: self.compiler,
267+
compilers: RustcPrivateCompilers::from_build_compiler(builder, self.compiler, self.target),
268268
target: self.target
269269
}) {
270270
install_sh(builder, "rustfmt", self.compiler.stage, Some(self.target), &tarball);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ mod snapshot {
11291129
[dist] rustc 1 <host> -> rust-analyzer 2 <host>
11301130
[build] rustc 1 <host> -> rustfmt 2 <host>
11311131
[build] rustc 1 <host> -> cargo-fmt 2 <host>
1132+
[dist] rustc 1 <host> -> rustfmt 2 <host>
11321133
[build] rustc 1 <host> -> clippy-driver 2 <host>
11331134
[build] rustc 1 <host> -> cargo-clippy 2 <host>
11341135
[dist] rustc 1 <host> -> clippy 2 <host>
@@ -1462,6 +1463,7 @@ mod snapshot {
14621463
[dist] rustc 1 <host> -> rust-analyzer 2 <target1>
14631464
[build] rustc 1 <host> -> rustfmt 2 <target1>
14641465
[build] rustc 1 <host> -> cargo-fmt 2 <target1>
1466+
[dist] rustc 1 <host> -> rustfmt 2 <target1>
14651467
[build] rustc 1 <host> -> clippy-driver 2 <target1>
14661468
[build] rustc 1 <host> -> cargo-clippy 2 <target1>
14671469
[dist] rustc 1 <host> -> clippy 2 <target1>
@@ -2250,6 +2252,7 @@ mod snapshot {
22502252
[dist] rustc 2 <host> -> rust-analyzer 3 <host>
22512253
[build] rustc 2 <host> -> rustfmt 3 <host>
22522254
[build] rustc 2 <host> -> cargo-fmt 3 <host>
2255+
[dist] rustc 2 <host> -> rustfmt 3 <host>
22532256
[build] rustc 2 <host> -> clippy-driver 3 <host>
22542257
[build] rustc 2 <host> -> cargo-clippy 3 <host>
22552258
[dist] rustc 2 <host> -> clippy 3 <host>

0 commit comments

Comments
 (0)