Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/toolchain/src/lib.rs')
| -rw-r--r-- | crates/toolchain/src/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/toolchain/src/lib.rs b/crates/toolchain/src/lib.rs index 8b7bf1a806..39319886cf 100644 --- a/crates/toolchain/src/lib.rs +++ b/crates/toolchain/src/lib.rs @@ -71,6 +71,9 @@ impl Tool { } } +// Prevent rustup from automatically installing toolchains, see https://github.com/rust-lang/rust-analyzer/issues/20719. +pub const NO_RUSTUP_AUTO_INSTALL_ENV: (&str, &str) = ("RUSTUP_AUTO_INSTALL", "0"); + #[allow(clippy::disallowed_types)] /* generic parameter allows for FxHashMap */ pub fn command<H>( cmd: impl AsRef<OsStr>, @@ -81,6 +84,7 @@ pub fn command<H>( #[allow(clippy::disallowed_methods)] let mut cmd = Command::new(cmd); cmd.current_dir(working_directory); + cmd.env(NO_RUSTUP_AUTO_INSTALL_ENV.0, NO_RUSTUP_AUTO_INSTALL_ENV.1); for env in extra_env { match env { (key, Some(val)) => cmd.env(key, val), |