diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 8215211ea1c9d..bae904114960a 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1330,7 +1330,7 @@ pub struct Clippy { } impl Step for Clippy { - type Output = Option; + type Output = PathBuf; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1348,7 +1348,7 @@ impl Step for Clippy { }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> PathBuf { let compiler = self.compiler; let target = self.target; assert!(builder.config.extended); @@ -1368,16 +1368,10 @@ impl Step for Clippy { // state for clippy isn't testing. let clippy = builder .ensure(tool::Clippy { compiler, target, extra_features: Vec::new() }) - .or_else(|| { - missing_tool("clippy", builder.build.config.missing_tools); - None - })?; + .expect("clippy expected to build - essential tool"); let cargoclippy = builder .ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() }) - .or_else(|| { - missing_tool("cargo clippy", builder.build.config.missing_tools); - None - })?; + .expect("clippy expected to build - essential tool"); builder.install(&clippy, &image.join("bin"), 0o755); builder.install(&cargoclippy, &image.join("bin"), 0o755); @@ -1416,7 +1410,7 @@ impl Step for Clippy { builder.info(&format!("Dist clippy stage{} ({})", compiler.stage, target)); let _time = timeit(builder); builder.run(&mut cmd); - Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) + distdir(builder).join(format!("{}-{}.tar.gz", name, target)) } } @@ -1683,7 +1677,7 @@ impl Step for Extended { tarballs.push(rustc_installer); tarballs.push(cargo_installer); tarballs.extend(rls_installer.clone()); - tarballs.extend(clippy_installer.clone()); + tarballs.push(clippy_installer); tarballs.extend(miri_installer.clone()); tarballs.extend(rustfmt_installer.clone()); tarballs.extend(llvm_tools_installer); @@ -1761,9 +1755,6 @@ impl Step for Extended { if rls_installer.is_none() { contents = filter(&contents, "rls"); } - if clippy_installer.is_none() { - contents = filter(&contents, "clippy"); - } if miri_installer.is_none() { contents = filter(&contents, "miri"); } @@ -1805,13 +1796,11 @@ impl Step for Extended { prepare("rust-docs"); prepare("rust-std"); prepare("rust-analysis"); + prepare("clippy"); if rls_installer.is_some() { prepare("rls"); } - if clippy_installer.is_some() { - prepare("clippy"); - } if miri_installer.is_some() { prepare("miri"); } @@ -1863,12 +1852,10 @@ impl Step for Extended { prepare("rust-analysis"); prepare("rust-docs"); prepare("rust-std"); + prepare("clippy"); if rls_installer.is_some() { prepare("rls"); } - if clippy_installer.is_some() { - prepare("clippy"); - } if miri_installer.is_some() { prepare("miri"); } @@ -1989,25 +1976,23 @@ impl Step for Extended { .arg(etc.join("msi/remove-duplicates.xsl")), ); } - if clippy_installer.is_some() { - builder.run( - Command::new(&heat) - .current_dir(&exe) - .arg("dir") - .arg("clippy") - .args(&heat_flags) - .arg("-cg") - .arg("ClippyGroup") - .arg("-dr") - .arg("Clippy") - .arg("-var") - .arg("var.ClippyDir") - .arg("-out") - .arg(exe.join("ClippyGroup.wxs")) - .arg("-t") - .arg(etc.join("msi/remove-duplicates.xsl")), - ); - } + builder.run( + Command::new(&heat) + .current_dir(&exe) + .arg("dir") + .arg("clippy") + .args(&heat_flags) + .arg("-cg") + .arg("ClippyGroup") + .arg("-dr") + .arg("Clippy") + .arg("-var") + .arg("var.ClippyDir") + .arg("-out") + .arg(exe.join("ClippyGroup.wxs")) + .arg("-t") + .arg(etc.join("msi/remove-duplicates.xsl")), + ); if miri_installer.is_some() { builder.run( Command::new(&heat) @@ -2073,6 +2058,7 @@ impl Step for Extended { .arg("-dCargoDir=cargo") .arg("-dStdDir=rust-std") .arg("-dAnalysisDir=rust-analysis") + .arg("-dClippyDir=clippy") .arg("-arch") .arg(&arch) .arg("-out") @@ -2083,9 +2069,6 @@ impl Step for Extended { if rls_installer.is_some() { cmd.arg("-dRlsDir=rls"); } - if clippy_installer.is_some() { - cmd.arg("-dClippyDir=clippy"); - } if miri_installer.is_some() { cmd.arg("-dMiriDir=miri"); } @@ -2101,12 +2084,10 @@ impl Step for Extended { candle("DocsGroup.wxs".as_ref()); candle("CargoGroup.wxs".as_ref()); candle("StdGroup.wxs".as_ref()); + candle("ClippyGroup.wxs".as_ref()); if rls_installer.is_some() { candle("RlsGroup.wxs".as_ref()); } - if clippy_installer.is_some() { - candle("ClippyGroup.wxs".as_ref()); - } if miri_installer.is_some() { candle("MiriGroup.wxs".as_ref()); } @@ -2138,14 +2119,12 @@ impl Step for Extended { .arg("CargoGroup.wixobj") .arg("StdGroup.wixobj") .arg("AnalysisGroup.wixobj") + .arg("ClippyGroup.wixobj") .current_dir(&exe); if rls_installer.is_some() { cmd.arg("RlsGroup.wixobj"); } - if clippy_installer.is_some() { - cmd.arg("ClippyGroup.wixobj"); - } if miri_installer.is_some() { cmd.arg("MiriGroup.wixobj"); } diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 6549262811b9f..fafd3cdf927c0 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -214,10 +214,8 @@ install!((self, builder, _config), } }; Clippy, "clippy", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Clippy { - compiler: self.compiler, - target: self.target, - }).is_some() || Self::should_install(builder) { + builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target }); + if Self::should_install(builder) { install_clippy(builder, self.compiler.stage, self.target); } else { builder.info( diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 125563b7b6086..90b8b5eea947f 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -548,9 +548,7 @@ impl Step for Clippy { builder.add_rustc_lib_path(compiler, &mut cargo); - if try_run(builder, &mut cargo.into()) { - builder.save_toolstate("clippy-driver", ToolState::TestPass); - } + try_run(builder, &mut cargo.into()); } else { eprintln!("failed to test clippy: could not build"); } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index f756b1235abee..8ebad95ea1762 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -652,14 +652,12 @@ tool_extended!((self, builder), Miri, miri, "src/tools/miri", "miri", {}; CargoMiri, miri, "src/tools/miri", "cargo-miri", {}; Rls, rls, "src/tools/rls", "rls", { - let clippy = builder.ensure(Clippy { + builder.ensure(Clippy { compiler: self.compiler, target: self.target, extra_features: Vec::new(), }); - if clippy.is_some() { - self.extra_features.push("clippy".to_owned()); - } + self.extra_features.push("clippy".to_owned()); }; Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {}; );