Skip to content

Commit 82bc859

Browse files
Prevent rustup from automatically installing toolchains
By setting RUSTUP_AUTO_INSTALL=0.
1 parent e7d7cb4 commit 82bc859

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

crates/project-model/src/cargo_workspace.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ impl FetchMetadata {
632632
) -> Self {
633633
let cargo = sysroot.tool(Tool::Cargo, current_dir, &config.extra_env);
634634
let mut command = MetadataCommand::new();
635+
// Prevent rustup from automatically installing toolchains, see https://github.com/rust-lang/rust-analyzer/issues/20719.
636+
command.env("RUSTUP_AUTO_INSTALL", "0");
635637
command.cargo_path(cargo.get_program());
636638
cargo.get_envs().for_each(|(var, val)| _ = command.env(var, val.unwrap_or_default()));
637639
command.manifest_path(cargo_toml.to_path_buf());

crates/toolchain/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ pub fn command<H>(
8181
#[allow(clippy::disallowed_methods)]
8282
let mut cmd = Command::new(cmd);
8383
cmd.current_dir(working_directory);
84+
// Prevent rustup from automatically installing toolchains, see https://github.com/rust-lang/rust-analyzer/issues/20719.
85+
cmd.env("RUSTUP_AUTO_INSTALL", "0");
8486
for env in extra_env {
8587
match env {
8688
(key, Some(val)) => cmd.env(key, val),

0 commit comments

Comments
 (0)