Remove compiler_for from dist::Rustfmt

This commit is contained in:
Jakub Beránek 2025-08-15 20:18:04 +02:00
parent dfc66f08b9
commit 887831fb7f
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
3 changed files with 13 additions and 13 deletions

View File

@ -1560,7 +1560,7 @@ impl Step for CraneliftCodegenBackend {
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Rustfmt {
pub build_compiler: Compiler,
pub compilers: RustcPrivateCompilers,
pub target: TargetSelection,
}
@ -1576,21 +1576,14 @@ impl Step for Rustfmt {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Rustfmt {
build_compiler: run.builder.compiler_for(
run.builder.top_stage,
run.builder.config.host_target,
run.target,
),
compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target),
target: run.target,
});
}
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
let compilers =
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target);
let rustfmt = builder.ensure(tool::Rustfmt::from_compilers(compilers));
let cargofmt = builder.ensure(tool::Cargofmt::from_compilers(compilers));
let rustfmt = builder.ensure(tool::Rustfmt::from_compilers(self.compilers));
let cargofmt = builder.ensure(tool::Cargofmt::from_compilers(self.compilers));
let mut tarball = Tarball::new(builder, "rustfmt", &self.target.triple);
tarball.set_overlay(OverlayKind::Rustfmt);
@ -1600,6 +1593,10 @@ impl Step for Rustfmt {
tarball.add_legal_and_readme_to("share/doc/rustfmt");
Some(tarball.generate())
}
fn metadata(&self) -> Option<StepMetadata> {
Some(StepMetadata::dist("rustfmt", self.target).built_by(self.compilers.build_compiler()))
}
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@ -1666,7 +1663,7 @@ impl Step for Extended {
// Std stage N is documented with compiler stage N
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
add_component!("cargo" => Cargo { build_compiler: compiler, target });
add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target });
add_component!("rustfmt" => Rustfmt { compilers: rustc_private_compilers, target });
add_component!("rust-analyzer" => RustAnalyzer { compilers: rustc_private_compilers, target });
add_component!("llvm-components" => LlvmTools { target });
add_component!("clippy" => Clippy { compilers: rustc_private_compilers, target });

View File

@ -264,7 +264,7 @@ install!((self, builder, _config),
};
Rustfmt, alias = "rustfmt", Self::should_build(_config), IS_HOST: true, {
if let Some(tarball) = builder.ensure(dist::Rustfmt {
build_compiler: self.compiler,
compilers: RustcPrivateCompilers::from_build_compiler(builder, self.compiler, self.target),
target: self.target
}) {
install_sh(builder, "rustfmt", self.compiler.stage, Some(self.target), &tarball);

View File

@ -1206,6 +1206,7 @@ mod snapshot {
[dist] rustc 1 <host> -> rust-analyzer 2 <host>
[build] rustc 1 <host> -> rustfmt 2 <host>
[build] rustc 1 <host> -> cargo-fmt 2 <host>
[dist] rustc 1 <host> -> rustfmt 2 <host>
[build] rustc 1 <host> -> clippy-driver 2 <host>
[build] rustc 1 <host> -> cargo-clippy 2 <host>
[dist] rustc 1 <host> -> clippy 2 <host>
@ -1539,6 +1540,7 @@ mod snapshot {
[dist] rustc 1 <host> -> rust-analyzer 2 <target1>
[build] rustc 1 <host> -> rustfmt 2 <target1>
[build] rustc 1 <host> -> cargo-fmt 2 <target1>
[dist] rustc 1 <host> -> rustfmt 2 <target1>
[build] rustc 1 <host> -> clippy-driver 2 <target1>
[build] rustc 1 <host> -> cargo-clippy 2 <target1>
[dist] rustc 1 <host> -> clippy 2 <target1>
@ -2327,6 +2329,7 @@ mod snapshot {
[dist] rustc 2 <host> -> rust-analyzer 3 <host>
[build] rustc 2 <host> -> rustfmt 3 <host>
[build] rustc 2 <host> -> cargo-fmt 3 <host>
[dist] rustc 2 <host> -> rustfmt 3 <host>
[build] rustc 2 <host> -> clippy-driver 3 <host>
[build] rustc 2 <host> -> cargo-clippy 3 <host>
[dist] rustc 2 <host> -> clippy 3 <host>