mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
fix: Don't overwrite RUSTUP_TOOLCHAIN
if it is already set
This commit is contained in:
parent
b3e086ad10
commit
09ecc4cbf6
@ -137,7 +137,12 @@ impl Sysroot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut cmd = toolchain::command(tool.prefer_proxy(), current_dir, envs);
|
let mut cmd = toolchain::command(tool.prefer_proxy(), current_dir, envs);
|
||||||
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(root));
|
if !envs.contains_key("RUSTUP_TOOLCHAIN")
|
||||||
|
&& std::env::var_os("RUSTUP_TOOLCHAIN").is_none()
|
||||||
|
{
|
||||||
|
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(root));
|
||||||
|
}
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
_ => toolchain::command(tool.path(), current_dir, envs),
|
_ => toolchain::command(tool.path(), current_dir, envs),
|
||||||
|
@ -470,7 +470,11 @@ impl FlycheckActor {
|
|||||||
let mut cmd =
|
let mut cmd =
|
||||||
toolchain::command(Tool::Cargo.path(), &*self.root, &options.extra_env);
|
toolchain::command(Tool::Cargo.path(), &*self.root, &options.extra_env);
|
||||||
if let Some(sysroot_root) = &self.sysroot_root {
|
if let Some(sysroot_root) = &self.sysroot_root {
|
||||||
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
|
if !options.extra_env.contains_key("RUSTUP_TOOLCHAIN")
|
||||||
|
&& std::env::var_os("RUSTUP_TOOLCHAIN").is_none()
|
||||||
|
{
|
||||||
|
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cmd.arg(command);
|
cmd.arg(command);
|
||||||
|
|
||||||
|
@ -659,6 +659,10 @@ impl GlobalState {
|
|||||||
.chain(
|
.chain(
|
||||||
ws.sysroot
|
ws.sysroot
|
||||||
.root()
|
.root()
|
||||||
|
.filter(|_| {
|
||||||
|
!self.config.extra_env(None).contains_key("RUSTUP_TOOLCHAIN")
|
||||||
|
&& std::env::var_os("RUSTUP_TOOLCHAIN").is_none()
|
||||||
|
})
|
||||||
.map(|it| ("RUSTUP_TOOLCHAIN".to_owned(), Some(it.to_string()))),
|
.map(|it| ("RUSTUP_TOOLCHAIN".to_owned(), Some(it.to_string()))),
|
||||||
)
|
)
|
||||||
.collect(),
|
.collect(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user