Skip to content

Commit 4a1a202

Browse files
committed
use the build triple for deciding whether the first argument is clippy or not
previously we had false-negatives when cross-compiling, which meant people just wouldn't get clippy lints for targets other than the host
1 parent 1b519ae commit 4a1a202

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/bootstrap/src/bin/rustc.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ fn main() {
6666
// otherwise, substitute whatever cargo thinks rustc should be with RUSTC_REAL.
6767
// NOTE: this means we ignore RUSTC in the environment.
6868
// FIXME: We might want to consider removing RUSTC_REAL and setting RUSTC directly?
69-
let target_name = target
70-
.map(|s| s.to_owned())
71-
.unwrap_or_else(|| env::var("CFG_COMPILER_HOST_TRIPLE").unwrap());
72-
let is_clippy = args[0].to_string_lossy().ends_with(&exe("clippy-driver", &target_name));
69+
// NOTE: we intentionally pass the name of the host, not the target.
70+
let host = env::var("CFG_COMPILER_BUILD_TRIPLE").unwrap();
71+
let is_clippy = args[0].to_string_lossy().ends_with(&exe("clippy-driver", &host));
7372
let rustc_driver = if is_clippy {
7473
if is_build_script {
7574
// Don't run clippy on build scripts (for one thing, we may not have libstd built with
@@ -85,8 +84,6 @@ fn main() {
8584
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
8685
// Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually.
8786
let current_exe = env::current_exe().expect("couldn't get path to rustc shim");
88-
// NOTE: we intentionally pass the name of the host, not the target.
89-
let host = env::var("CFG_COMPILER_BUILD_TRIPLE").unwrap();
9087
let arg0 = exe(args[0].to_str().expect("only utf8 paths are supported"), &host);
9188
if Path::new(&arg0) == current_exe {
9289
args.remove(0);

0 commit comments

Comments
 (0)