From f131d6e9454789a16678cdede7378f29bfbdfd81 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 8 Aug 2024 18:49:41 +0800 Subject: [PATCH] feat(config)!: remove implicit installation from `resolve_toolchain()` --- src/cli/rustup_mode.rs | 2 +- src/config.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 03a64708050..d80bc35e936 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -908,7 +908,7 @@ async fn which( binary: &str, toolchain: Option, ) -> Result { - let binary_path = cfg.resolve_toolchain(toolchain).await?.binary_file(binary); + let binary_path = cfg.resolve_toolchain(toolchain)?.binary_file(binary); utils::assert_is_file(&binary_path)?; diff --git a/src/config.rs b/src/config.rs index f61a3aa91b2..e0f7f9dcbd5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -709,17 +709,18 @@ impl<'a> Cfg<'a> { Ok(Some(Toolchain::new(self, name)?.rustc_version())) } - pub(crate) async fn resolve_toolchain( + pub(crate) fn resolve_toolchain( &self, name: Option, ) -> Result> { - Ok(match name { + let toolchain = match name { Some(name) => { let desc = name.resolve(&self.get_default_host_triple()?)?; - Toolchain::new(self, desc.into())? + Some(desc.into()) } - None => self.find_or_install_active_toolchain(false).await?.0, - }) + None => None, + }; + self.local_toolchain(toolchain) } pub(crate) fn resolve_local_toolchain(