Skip to content

Commit 887831f

Browse files
committed
Remove compiler_for from dist::Rustfmt
1 parent dfc66f0 commit 887831f

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
@@ -1206,6 +1206,7 @@ mod snapshot {
12061206
[dist] rustc 1 <host> -> rust-analyzer 2 <host>
12071207
[build] rustc 1 <host> -> rustfmt 2 <host>
12081208
[build] rustc 1 <host> -> cargo-fmt 2 <host>
1209+
[dist] rustc 1 <host> -> rustfmt 2 <host>
12091210
[build] rustc 1 <host> -> clippy-driver 2 <host>
12101211
[build] rustc 1 <host> -> cargo-clippy 2 <host>
12111212
[dist] rustc 1 <host> -> clippy 2 <host>
@@ -1539,6 +1540,7 @@ mod snapshot {
15391540
[dist] rustc 1 <host> -> rust-analyzer 2 <target1>
15401541
[build] rustc 1 <host> -> rustfmt 2 <target1>
15411542
[build] rustc 1 <host> -> cargo-fmt 2 <target1>
1543+
[dist] rustc 1 <host> -> rustfmt 2 <target1>
15421544
[build] rustc 1 <host> -> clippy-driver 2 <target1>
15431545
[build] rustc 1 <host> -> cargo-clippy 2 <target1>
15441546
[dist] rustc 1 <host> -> clippy 2 <target1>
@@ -2327,6 +2329,7 @@ mod snapshot {
23272329
[dist] rustc 2 <host> -> rust-analyzer 3 <host>
23282330
[build] rustc 2 <host> -> rustfmt 3 <host>
23292331
[build] rustc 2 <host> -> cargo-fmt 3 <host>
2332+
[dist] rustc 2 <host> -> rustfmt 3 <host>
23302333
[build] rustc 2 <host> -> clippy-driver 3 <host>
23312334
[build] rustc 2 <host> -> cargo-clippy 3 <host>
23322335
[dist] rustc 2 <host> -> clippy 3 <host>

0 commit comments

Comments
 (0)