Skip to content

Commit 66dee4a

Browse files
committed
Set CARGO instead of PATH for Rust Clippy
Resolves #123227
1 parent 36b6f9b commit 66dee4a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/bootstrap/src/core/builder.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -1194,20 +1194,11 @@ impl<'a> Builder<'a> {
11941194
}
11951195

11961196
pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> Command {
1197-
let initial_sysroot_bin = self.initial_rustc.parent().unwrap();
1198-
// Set PATH to include the sysroot bin dir so clippy can find cargo.
1199-
// FIXME: once rust-clippy#11944 lands on beta, set `CARGO` directly instead.
1200-
let path = t!(env::join_paths(
1201-
// The sysroot comes first in PATH to avoid using rustup's cargo.
1202-
std::iter::once(PathBuf::from(initial_sysroot_bin))
1203-
.chain(env::split_paths(&t!(env::var("PATH"))))
1204-
));
1205-
12061197
if run_compiler.stage == 0 {
12071198
// `ensure(Clippy { stage: 0 })` *builds* clippy with stage0, it doesn't use the beta clippy.
12081199
let cargo_clippy = self.build.config.download_clippy();
12091200
let mut cmd = Command::new(cargo_clippy);
1210-
cmd.env("PATH", &path);
1201+
cmd.env("CARGO", &self.initial_cargo);
12111202
return cmd;
12121203
}
12131204

@@ -1227,7 +1218,7 @@ impl<'a> Builder<'a> {
12271218

12281219
let mut cmd = Command::new(cargo_clippy);
12291220
cmd.env(helpers::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
1230-
cmd.env("PATH", path);
1221+
cmd.env("CARGO", &self.initial_cargo);
12311222
cmd
12321223
}
12331224

0 commit comments

Comments
 (0)