Remove compiler_for from dist::Clippy

This commit is contained in:
Jakub Beránek 2025-08-15 21:06:37 +02:00
parent 5c0371072f
commit 693e2aec4e
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
3 changed files with 16 additions and 13 deletions

View file

@ -1380,7 +1380,7 @@ impl Step for RustAnalyzer {
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Clippy {
pub build_compiler: Compiler,
pub compilers: RustcPrivateCompilers,
pub target: TargetSelection,
}
@ -1396,25 +1396,19 @@ impl Step for Clippy {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Clippy {
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 target = self.target;
let compilers =
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target);
// Prepare the image directory
// We expect clippy to build, because we've exited this step above if tool
// state for clippy isn't testing.
let clippy = builder.ensure(tool::Clippy::from_compilers(compilers));
let cargoclippy = builder.ensure(tool::CargoClippy::from_compilers(compilers));
let clippy = builder.ensure(tool::Clippy::from_compilers(self.compilers));
let cargoclippy = builder.ensure(tool::CargoClippy::from_compilers(self.compilers));
let mut tarball = Tarball::new(builder, "clippy", &target.triple);
tarball.set_overlay(OverlayKind::Clippy);
@ -1424,6 +1418,10 @@ impl Step for Clippy {
tarball.add_legal_and_readme_to("share/doc/clippy");
Some(tarball.generate())
}
fn metadata(&self) -> Option<StepMetadata> {
Some(StepMetadata::dist("clippy", self.target).built_by(self.compilers.build_compiler()))
}
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@ -1668,14 +1666,17 @@ impl Step for Extended {
tarballs.push(builder.ensure(Mingw { target }).expect("missing mingw"));
}
let rustc_private_compilers =
RustcPrivateCompilers::from_build_compiler(builder, compiler, target);
add_component!("rust-docs" => Docs { host: target });
// 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!("rust-analyzer" => RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, compiler, target), target });
add_component!("rust-analyzer" => RustAnalyzer { compilers: rustc_private_compilers, target });
add_component!("llvm-components" => LlvmTools { target });
add_component!("clippy" => Clippy { build_compiler: compiler, target });
add_component!("clippy" => Clippy { compilers: rustc_private_compilers, target });
add_component!("miri" => Miri { build_compiler: compiler, target });
add_component!("analysis" => Analysis { build_compiler: compiler, target });
add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend {

View file

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

View file

@ -1208,6 +1208,7 @@ mod snapshot {
[build] rustc 1 <host> -> cargo-fmt 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>
[build] rustc 1 <host> -> miri 2 <host>
[build] rustc 1 <host> -> cargo-miri 2 <host>
");
@ -1539,6 +1540,7 @@ mod snapshot {
[build] rustc 1 <host> -> cargo-fmt 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>
[build] rustc 1 <host> -> miri 2 <target1>
[build] rustc 1 <host> -> cargo-miri 2 <target1>
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>