Skip to content

Commit 58045c9

Browse files
committed
Rust: Set RUSTUP_AUTO_INSTALL=1
1 parent 97e3d36 commit 58045c9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

rust/extractor/src/config.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ impl Config {
151151

152152
pub fn to_cargo_config(&self, dir: &AbsPath) -> (CargoConfig, LoadCargoConfig) {
153153
let sysroot = self.sysroot(dir);
154+
let mut extra_env = FxHashMap::default();
155+
// RUSTUP_AUTO_INSTALL is set to 0 by rust-analyzer (https://github.com/rust-lang/rust-analyzer/issues/20719),
156+
// but we do want to allow rustup to auto-install toolchains if needed, so we set it to 1 here.
157+
extra_env.insert("RUSTUP_AUTO_INSTALL".to_owned(), Some("1".to_owned()));
158+
extra_env.extend(self.cargo_extra_env.clone());
154159
(
155160
CargoConfig {
156161
all_targets: self.cargo_all_targets,
@@ -166,7 +171,7 @@ impl Config {
166171
.map(ToOwned::to_owned)
167172
.map(RustLibSource::Path),
168173

169-
extra_env: self.cargo_extra_env.clone(),
174+
extra_env,
170175
extra_args: self.cargo_extra_args.clone(),
171176
extra_includes: self
172177
.extra_includes

0 commit comments

Comments
 (0)