diff --git a/collector/src/bin/collector.rs b/collector/src/bin/collector.rs index a91186dcd..16f1078db 100644 --- a/collector/src/bin/collector.rs +++ b/collector/src/bin/collector.rs @@ -382,7 +382,8 @@ struct CompileTimeOptions { #[arg(long)] rustdoc: Option, - /// The path to the local clippy to measure + /// The path to the local clippy to measure. + /// It should be a path to the `clippy-driver` binary. #[arg(long)] clippy: Option, } diff --git a/collector/src/compile/execute/mod.rs b/collector/src/compile/execute/mod.rs index 55e48c3a9..9e94991c0 100644 --- a/collector/src/compile/execute/mod.rs +++ b/collector/src/compile/execute/mod.rs @@ -248,7 +248,7 @@ impl<'a> CargoProcess<'a> { }; if let Some(c) = &self.toolchain.components.clippy { - cmd.env("CLIPPY", &*FAKE_CLIPPY).env("CLIPPY_REAL", c); + cmd.env("CLIPPY_REAL", c); } for config in &self.toolchain.components.cargo_configs { @@ -335,7 +335,12 @@ impl<'a> CargoProcess<'a> { } Profile::Debug => {} Profile::Doc => {} - Profile::Clippy => {} + Profile::Clippy => { + cmd.arg("--profile").arg("check"); + // For Clippy, we still invoke `cargo rustc`, but we need to override the + // executed rustc to be clippy-fake. + cmd.env("RUSTC", &*FAKE_CLIPPY); + } Profile::Opt => { cmd.arg("--release"); } diff --git a/collector/src/toolchain.rs b/collector/src/toolchain.rs index 42ba7ff0f..8adf127e3 100644 --- a/collector/src/toolchain.rs +++ b/collector/src/toolchain.rs @@ -128,7 +128,7 @@ impl SysrootDownload { let components = ToolchainComponents::from_binaries_and_libdir( sysroot_bin("rustc")?, Some(sysroot_bin("rustdoc")?), - sysroot_bin("cargo-clippy").ok(), + sysroot_bin("clippy-driver").ok(), sysroot_bin("cargo")?, &self.directory.join(&self.rust_sha).join("lib"), )?; @@ -484,12 +484,12 @@ pub fn get_local_toolchain( ) } else if profiles.contains(&Profile::Clippy) { // We need a `clippy`. Look for one next to `rustc`. - if let Ok(clippy) = rustc.with_file_name("cargo-clippy").canonicalize() { + if let Ok(clippy) = rustc.with_file_name("clippy-driver").canonicalize() { debug!("found clippy: {:?}", &clippy); Some(clippy) } else { anyhow::bail!( - "'Clippy' build specified but '--cargo-clippy' not specified and no 'cargo-clippy' found \ + "'Clippy' build specified but '--clippy' not specified and no 'clippy-driver' found \ next to 'rustc'" ); }