For toolchain binaries ue the full path found in $PATH

This commit is contained in:
Lukas Wirth 2024-03-05 10:16:30 +01:00
parent fe0daa7be3
commit c310aee8d6
7 changed files with 63 additions and 67 deletions

View file

@ -12,7 +12,7 @@ use itertools::Itertools;
use la_arena::{Arena, Idx};
use paths::{AbsPath, AbsPathBuf};
use rustc_hash::FxHashMap;
use toolchain::probe_for_binary;
use toolchain::{probe_for_binary, Tool};
use crate::{utf8_stdout, CargoConfig, CargoWorkspace, ManifestPath};
@ -411,7 +411,7 @@ fn discover_sysroot_dir(
current_dir: &AbsPath,
extra_env: &FxHashMap<String, String>,
) -> Result<AbsPathBuf> {
let mut rustc = Command::new(toolchain::rustc());
let mut rustc = Command::new(Tool::Rustc.path());
rustc.envs(extra_env);
rustc.current_dir(current_dir).args(["--print", "sysroot"]);
tracing::debug!("Discovering sysroot by {:?}", rustc);
@ -443,7 +443,7 @@ fn discover_sysroot_src_dir_or_add_component(
) -> Result<AbsPathBuf> {
discover_sysroot_src_dir(sysroot_path)
.or_else(|| {
let mut rustup = Command::new(toolchain::rustup());
let mut rustup = Command::new(Tool::Rustup.prefer_proxy());
rustup.envs(extra_env);
rustup.current_dir(current_dir).args(["component", "add", "rust-src"]);
tracing::info!("adding rust-src component by {:?}", rustup);