Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fe0daa7

Browse files
committed
Revert "prioritise rustup sysroots over system ones"
This reverts commit 9f1d4aa.
1 parent 0c2e9fe commit fe0daa7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/toolchain/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,21 @@ fn get_path_for_executable(executable_name: &'static str) -> PathBuf {
6363
// The current implementation checks three places for an executable to use:
6464
// 1) Appropriate environment variable (erroring if this is set but not a usable executable)
6565
// example: for cargo, this checks $CARGO environment variable; for rustc, $RUSTC; etc
66-
// 2) `$CARGO_HOME/bin/<executable_name>`
66+
// 2) `<executable_name>`
67+
// example: for cargo, this tries just `cargo`, which will succeed if `cargo` is on the $PATH
68+
// 3) `$CARGO_HOME/bin/<executable_name>`
6769
// where $CARGO_HOME defaults to ~/.cargo (see https://doc.rust-lang.org/cargo/guide/cargo-home.html)
6870
// example: for cargo, this tries $CARGO_HOME/bin/cargo, or ~/.cargo/bin/cargo if $CARGO_HOME is unset.
6971
// It seems that this is a reasonable place to try for cargo, rustc, and rustup
70-
// 3) `<executable_name>`
71-
// example: for cargo, this tries just `cargo`, which will succeed if `cargo` is on the $PATH
7272
let env_var = executable_name.to_ascii_uppercase();
7373
if let Some(path) = env::var_os(env_var) {
7474
return path.into();
7575
}
7676

77+
if lookup_in_path(executable_name) {
78+
return executable_name.into();
79+
}
80+
7781
if let Some(mut path) = get_cargo_home() {
7882
path.push("bin");
7983
path.push(executable_name);
@@ -82,10 +86,6 @@ fn get_path_for_executable(executable_name: &'static str) -> PathBuf {
8286
}
8387
}
8488

85-
if lookup_in_path(executable_name) {
86-
return executable_name.into();
87-
}
88-
8989
executable_name.into()
9090
}
9191

0 commit comments

Comments
 (0)