From 693e2aec4e61f413a9b138cd499fd77a1544cbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 15 Aug 2025 21:06:37 +0200 Subject: [PATCH] Remove `compiler_for` from `dist::Clippy` --- src/bootstrap/src/core/build_steps/dist.rs | 25 ++++++++++--------- src/bootstrap/src/core/build_steps/install.rs | 2 +- src/bootstrap/src/core/builder/tests.rs | 2 ++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 0effc037209c..f6379f7e71ea 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -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 { 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 { + 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 { diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index b155c172e356..aea54512f7c4 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -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); }; diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 08b1b4ac19ad..2a922d5f4b8c 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1208,6 +1208,7 @@ mod snapshot { [build] rustc 1 -> cargo-fmt 2 [build] rustc 1 -> clippy-driver 2 [build] rustc 1 -> cargo-clippy 2 + [dist] rustc 1 -> clippy 2 [build] rustc 1 -> miri 2 [build] rustc 1 -> cargo-miri 2 "); @@ -1539,6 +1540,7 @@ mod snapshot { [build] rustc 1 -> cargo-fmt 2 [build] rustc 1 -> clippy-driver 2 [build] rustc 1 -> cargo-clippy 2 + [dist] rustc 1 -> clippy 2 [build] rustc 1 -> miri 2 [build] rustc 1 -> cargo-miri 2 [build] rustc 1 -> LlvmBitcodeLinker 2