From c190fcd944f9d52090dbafab3ba3b07c749ba195 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 10:48:36 +0800 Subject: [PATCH 01/12] chore(config): add `#[tracing::instrument]` to `ensure_installed()` --- src/config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.rs b/src/config.rs index 067da9db01..078ba0b1b2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -777,6 +777,7 @@ impl<'a> Cfg<'a> { // Returns a Toolchain matching the given ToolchainDesc, installing it and // the given components and targets if they aren't already installed. + #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] async fn ensure_installed( &self, toolchain: ToolchainDesc, From ae71bde6bd5719a42605cb6195055a64e160c801 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 10:50:02 +0800 Subject: [PATCH 02/12] feat(config)!: use `Cfg::get_profile()` for unspecified profile in `ensure_installed()` --- src/config.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 078ba0b1b2..07ae0b55d5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -787,6 +787,10 @@ impl<'a> Cfg<'a> { ) -> Result> { let components: Vec<_> = components.iter().map(AsRef::as_ref).collect(); let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect(); + let profile = match profile { + Some(profile) => profile, + None => self.get_profile()?, + }; let toolchain = match DistributableToolchain::new(self, toolchain.clone()) { Err(RustupError::ToolchainNotInstalled(_)) => { DistributableToolchain::install( @@ -794,7 +798,7 @@ impl<'a> Cfg<'a> { &toolchain, &components, &targets, - profile.unwrap_or(Profile::Default), + profile, false, ) .await? @@ -802,9 +806,7 @@ impl<'a> Cfg<'a> { } Ok(mut distributable) => { if !distributable.components_exist(&components, &targets)? { - distributable - .update(&components, &targets, profile.unwrap_or(Profile::Default)) - .await?; + distributable.update(&components, &targets, profile).await?; } distributable } From 6193ceac27c11ec764f61db1139b6dd811798de3 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 10:56:43 +0800 Subject: [PATCH 03/12] feat(config)!: return `UpdateStatus` from `ensure_installed()` --- src/config.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/config.rs b/src/config.rs index 07ae0b55d5..e0d2aae0cd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -753,7 +753,8 @@ impl<'a> Cfg<'a> { } => { let toolchain = self .ensure_installed(toolchain, components, targets, profile) - .await?; + .await? + .1; Ok((toolchain, reason)) } }, @@ -768,7 +769,8 @@ impl<'a> Cfg<'a> { let reason = ActiveReason::Default; let toolchain = self .ensure_installed(toolchain_desc, vec![], vec![], None) - .await?; + .await? + .1; Ok((toolchain, reason)) } }, @@ -784,14 +786,14 @@ impl<'a> Cfg<'a> { components: Vec, targets: Vec, profile: Option, - ) -> Result> { + ) -> Result<(UpdateStatus, Toolchain<'_>)> { let components: Vec<_> = components.iter().map(AsRef::as_ref).collect(); let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect(); let profile = match profile { Some(profile) => profile, None => self.get_profile()?, }; - let toolchain = match DistributableToolchain::new(self, toolchain.clone()) { + let (status, toolchain) = match DistributableToolchain::new(self, toolchain.clone()) { Err(RustupError::ToolchainNotInstalled(_)) => { DistributableToolchain::install( self, @@ -802,18 +804,18 @@ impl<'a> Cfg<'a> { false, ) .await? - .1 } Ok(mut distributable) => { - if !distributable.components_exist(&components, &targets)? { - distributable.update(&components, &targets, profile).await?; - } - distributable + let status = if !distributable.components_exist(&components, &targets)? { + distributable.update(&components, &targets, profile).await? + } else { + UpdateStatus::Unchanged + }; + (status, distributable) } Err(e) => return Err(e.into()), - } - .into(); - Ok(toolchain) + }; + Ok((status, toolchain.into())) } /// Get the configured default toolchain. From 7708049959d2258acf22feb5a12e152deb741fe5 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 10:59:51 +0800 Subject: [PATCH 04/12] feat(config)!: add `verbose` flag to `ensure_installed()` --- src/config.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index e0d2aae0cd..ddad65b0d5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -752,7 +752,7 @@ impl<'a> Cfg<'a> { profile, } => { let toolchain = self - .ensure_installed(toolchain, components, targets, profile) + .ensure_installed(toolchain, components, targets, profile, false) .await? .1; Ok((toolchain, reason)) @@ -768,7 +768,7 @@ impl<'a> Cfg<'a> { Some(ToolchainName::Official(toolchain_desc)) => { let reason = ActiveReason::Default; let toolchain = self - .ensure_installed(toolchain_desc, vec![], vec![], None) + .ensure_installed(toolchain_desc, vec![], vec![], None, false) .await? .1; Ok((toolchain, reason)) @@ -786,7 +786,11 @@ impl<'a> Cfg<'a> { components: Vec, targets: Vec, profile: Option, + verbose: bool, ) -> Result<(UpdateStatus, Toolchain<'_>)> { + if verbose { + (self.notify_handler)(Notification::LookingForToolchain(&toolchain)); + } let components: Vec<_> = components.iter().map(AsRef::as_ref).collect(); let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect(); let profile = match profile { @@ -806,6 +810,9 @@ impl<'a> Cfg<'a> { .await? } Ok(mut distributable) => { + if verbose { + (self.notify_handler)(Notification::UsingExistingToolchain(&toolchain)); + } let status = if !distributable.components_exist(&components, &targets)? { distributable.update(&components, &targets, profile).await? } else { From 16c96591c28560fb28d6570838bb02dace799e06 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 3 Aug 2024 12:45:09 +0800 Subject: [PATCH 05/12] refactor(distributable)!: replace `install_if_not_installed()` with `ensure_installed()` --- src/cli/rustup_mode.rs | 5 ++++- src/config.rs | 2 +- src/toolchain/distributable.rs | 19 ------------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 84fbd658d0..a7f7cc4b61 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -717,7 +717,10 @@ async fn default_( } MaybeResolvableToolchainName::Some(ResolvableToolchainName::Official(toolchain)) => { let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?; - let status = DistributableToolchain::install_if_not_installed(cfg, &desc).await?; + let status = cfg + .ensure_installed(desc.clone(), vec![], vec![], None, true) + .await? + .0; cfg.set_default(Some(&(&desc).into()))?; diff --git a/src/config.rs b/src/config.rs index ddad65b0d5..0bfcc059a7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -780,7 +780,7 @@ impl<'a> Cfg<'a> { // Returns a Toolchain matching the given ToolchainDesc, installing it and // the given components and targets if they aren't already installed. #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] - async fn ensure_installed( + pub(crate) async fn ensure_installed( &self, toolchain: ToolchainDesc, components: Vec, diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 6b6265aca7..45cfa4da05 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -17,7 +17,6 @@ use crate::{ DistOptions, PartialToolchainDesc, Profile, ToolchainDesc, }, install::{InstallMethod, UpdateStatus}, - notifications::Notification, RustupError, }; @@ -358,24 +357,6 @@ impl<'a> DistributableToolchain<'a> { Ok((status, Self::new(cfg, toolchain.clone())?)) } - #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] - pub async fn install_if_not_installed( - cfg: &'a Cfg<'a>, - desc: &ToolchainDesc, - ) -> anyhow::Result { - (cfg.notify_handler)(Notification::LookingForToolchain(desc)); - if Toolchain::exists(cfg, &desc.into())? { - (cfg.notify_handler)(Notification::UsingExistingToolchain(desc)); - Ok(UpdateStatus::Unchanged) - } else { - Ok( - Self::install(cfg, desc, &[], &[], cfg.get_profile()?, false) - .await? - .0, - ) - } - } - #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn update( &mut self, From 46ef1309db90d5636ccb7e55f0d8a6d34742eef1 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 3 Aug 2024 13:26:28 +0800 Subject: [PATCH 06/12] refactor(distributable)!: avoid unnecessary clones --- src/cli/rustup_mode.rs | 2 +- src/config.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index a7f7cc4b61..96ed3d15b2 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -718,7 +718,7 @@ async fn default_( MaybeResolvableToolchainName::Some(ResolvableToolchainName::Official(toolchain)) => { let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?; let status = cfg - .ensure_installed(desc.clone(), vec![], vec![], None, true) + .ensure_installed(&desc, vec![], vec![], None, true) .await? .0; diff --git a/src/config.rs b/src/config.rs index 0bfcc059a7..5597eca99c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -752,7 +752,7 @@ impl<'a> Cfg<'a> { profile, } => { let toolchain = self - .ensure_installed(toolchain, components, targets, profile, false) + .ensure_installed(&toolchain, components, targets, profile, false) .await? .1; Ok((toolchain, reason)) @@ -768,7 +768,7 @@ impl<'a> Cfg<'a> { Some(ToolchainName::Official(toolchain_desc)) => { let reason = ActiveReason::Default; let toolchain = self - .ensure_installed(toolchain_desc, vec![], vec![], None, false) + .ensure_installed(&toolchain_desc, vec![], vec![], None, false) .await? .1; Ok((toolchain, reason)) @@ -782,14 +782,14 @@ impl<'a> Cfg<'a> { #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn ensure_installed( &self, - toolchain: ToolchainDesc, + toolchain: &ToolchainDesc, components: Vec, targets: Vec, profile: Option, verbose: bool, ) -> Result<(UpdateStatus, Toolchain<'_>)> { if verbose { - (self.notify_handler)(Notification::LookingForToolchain(&toolchain)); + (self.notify_handler)(Notification::LookingForToolchain(toolchain)); } let components: Vec<_> = components.iter().map(AsRef::as_ref).collect(); let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect(); @@ -801,7 +801,7 @@ impl<'a> Cfg<'a> { Err(RustupError::ToolchainNotInstalled(_)) => { DistributableToolchain::install( self, - &toolchain, + toolchain, &components, &targets, profile, @@ -811,7 +811,7 @@ impl<'a> Cfg<'a> { } Ok(mut distributable) => { if verbose { - (self.notify_handler)(Notification::UsingExistingToolchain(&toolchain)); + (self.notify_handler)(Notification::UsingExistingToolchain(toolchain)); } let status = if !distributable.components_exist(&components, &targets)? { distributable.update(&components, &targets, profile).await? From 07edfc95475223e7d97d773fa9de1718566b7c18 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 11:11:49 +0800 Subject: [PATCH 07/12] style(common): merge imports --- src/cli/common.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index da703d06ad..5792dbcca8 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -15,17 +15,18 @@ use git_testament::{git_testament, render_testament}; use tracing::{debug, error, info, trace, warn}; use super::self_update; -use crate::cli::download_tracker::DownloadTracker; -use crate::dist::{ - manifest::ComponentStatus, notifications as dist_notifications, TargetTriple, ToolchainDesc, +use crate::{ + cli::download_tracker::DownloadTracker, + config::Cfg, + dist::{ + manifest::ComponentStatus, notifications as dist_notifications, TargetTriple, ToolchainDesc, + }, + install::UpdateStatus, + notifications::Notification, + process::{terminalsource, Process}, + toolchain::{DistributableToolchain, LocalToolchainName, Toolchain, ToolchainName}, + utils::{notifications as util_notifications, notify::NotificationLevel, utils}, }; -use crate::install::UpdateStatus; -use crate::process::{terminalsource, Process}; -use crate::toolchain::{DistributableToolchain, LocalToolchainName, Toolchain, ToolchainName}; -use crate::utils::notifications as util_notifications; -use crate::utils::notify::NotificationLevel; -use crate::utils::utils; -use crate::{config::Cfg, notifications::Notification}; pub(crate) const WARN_COMPLETE_PROFILE: &str = "downloading with complete profile isn't recommended unless you are a developer of the rust language"; From 9638654a19907194baf90942ff065bafc4ba4db1 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 3 Aug 2024 13:47:53 +0800 Subject: [PATCH 08/12] refactor(rustup-mode): extract `warn_if_host_is_incompatible()` --- src/cli/common.rs | 16 ++++++++++++++++ src/cli/rustup_mode.rs | 12 ++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index 5792dbcca8..f342fd5abc 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -634,6 +634,22 @@ pub(crate) fn ignorable_error( } } +/// Warns if rustup is trying to install a toolchain that might not be +/// able to run on the host system. +pub(crate) fn warn_if_host_is_incompatible( + toolchain: impl Display, + host_arch: &TargetTriple, + target_triple: &TargetTriple, + force_non_host: bool, +) -> Result<()> { + if !force_non_host && !host_arch.can_run(target_triple)? { + error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain."); + warn!("toolchain '{toolchain}' may not be able to run on this system."); + warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?"); + } + Ok(()) +} + /// Warns if rustup is running under emulation, such as macOS Rosetta pub(crate) fn warn_if_host_is_emulated(process: &Process) { if TargetTriple::is_host_emulated() { diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 96ed3d15b2..af76b7ef0f 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -9,7 +9,7 @@ use anyhow::{anyhow, Error, Result}; use clap::{builder::PossibleValue, Args, CommandFactory, Parser, Subcommand, ValueEnum}; use clap_complete::Shell; use itertools::Itertools; -use tracing::{error, info, trace, warn}; +use tracing::{info, trace, warn}; use crate::{ cli::{ @@ -817,16 +817,8 @@ async fn update(cfg: &mut Cfg<'_>, opts: UpdateOpts) -> Result // This needs another pass to fix it all up if name.has_triple() { let host_arch = TargetTriple::from_host_or_build(cfg.process); - let target_triple = name.clone().resolve(&host_arch)?.target; - if !forced && !host_arch.can_run(&target_triple)? { - error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain."); - warn!("toolchain '{name}' may not be able to run on this system."); - warn!( - "If you meant to build software to target that platform, perhaps try `rustup target add {}` instead?", - target_triple.to_string() - ); - } + common::warn_if_host_is_incompatible(&name, &host_arch, &target_triple, forced)?; } let desc = name.resolve(&cfg.get_default_host_triple()?)?; From 822151dc37b6f22e10e7a81ec38dc544b9bf0eb4 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 11:17:38 +0800 Subject: [PATCH 09/12] refactor(common): use early return in `warn_if_host_is_incompatible()` --- src/cli/common.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index f342fd5abc..5d3a99a812 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -642,11 +642,12 @@ pub(crate) fn warn_if_host_is_incompatible( target_triple: &TargetTriple, force_non_host: bool, ) -> Result<()> { - if !force_non_host && !host_arch.can_run(target_triple)? { - error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain."); - warn!("toolchain '{toolchain}' may not be able to run on this system."); - warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?"); + if force_non_host || host_arch.can_run(target_triple)? { + return Ok(()); } + error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain."); + warn!("toolchain '{toolchain}' may not be able to run on this system."); + warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?"); Ok(()) } From 240054edb2d4314e92ab40dd311fce3844f64b0f Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 3 Aug 2024 14:28:32 +0800 Subject: [PATCH 10/12] fix(config): call `warn_if_host_is_incompatible()` in `ensure_installed()` --- src/config.rs | 13 +++++++++++-- tests/suite/cli_rustup.rs | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 5597eca99c..05e7291c8e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,8 +11,11 @@ use tokio_stream::StreamExt; use tracing::trace; use crate::{ - cli::self_update::SelfUpdateMode, - dist::{self, download::DownloadCfg, temp, PartialToolchainDesc, Profile, ToolchainDesc}, + cli::{common, self_update::SelfUpdateMode}, + dist::{ + self, download::DownloadCfg, temp, PartialToolchainDesc, Profile, TargetTriple, + ToolchainDesc, + }, errors::RustupError, fallback_settings::FallbackSettings, install::UpdateStatus, @@ -788,6 +791,12 @@ impl<'a> Cfg<'a> { profile: Option, verbose: bool, ) -> Result<(UpdateStatus, Toolchain<'_>)> { + common::warn_if_host_is_incompatible( + toolchain, + &TargetTriple::from_host_or_build(self.process), + &toolchain.target, + false, + )?; if verbose { (self.notify_handler)(Notification::LookingForToolchain(toolchain)); } diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 6e82ede94c..5ae0e97385 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -2725,6 +2725,19 @@ warn: If you meant to build software to target that platform, perhaps try `rustu ).await; } +#[tokio::test] +async fn warn_on_unmatch_build_default() { + let cx = CliTestContext::new(Scenario::MultiHost).await; + let arch = clitools::MULTI_ARCH1; + cx.config.expect_stderr_ok( + &["rustup", "default", &format!("nightly-{arch}")], + &format!( + r"warn: toolchain 'nightly-{arch}' may not be able to run on this system. +warn: If you meant to build software to target that platform, perhaps try `rustup target add {arch}` instead?", + ), + ).await; +} + #[tokio::test] async fn dont_warn_on_partial_build() { let cx = CliTestContext::new(Scenario::SimpleV2).await; From 00f5572984a770f79ce4c4275b66c842ce4ed644 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 11:36:43 +0800 Subject: [PATCH 11/12] style(config): replace `dist::TargetTriple` with `TargetTriple` --- src/config.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 05e7291c8e..9ce610ed1f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -934,7 +934,7 @@ impl<'a> Cfg<'a> { // against the 'stable' toolchain. This provides early errors // if the supplied triple is insufficient / bad. dist::PartialToolchainDesc::from_str("stable")? - .resolve(&dist::TargetTriple::new(host_triple.clone()))?; + .resolve(&TargetTriple::new(host_triple.clone()))?; self.settings_file.with_mut(|s| { s.default_host_triple = Some(host_triple); Ok(()) @@ -942,7 +942,7 @@ impl<'a> Cfg<'a> { } #[tracing::instrument(level = "trace", skip_all)] - pub(crate) fn get_default_host_triple(&self) -> Result { + pub(crate) fn get_default_host_triple(&self) -> Result { self.settings_file .with(|s| Ok(get_default_host_triple(s, self.process))) } @@ -1010,11 +1010,11 @@ impl<'a> Debug for Cfg<'a> { } } -fn get_default_host_triple(s: &Settings, process: &Process) -> dist::TargetTriple { +fn get_default_host_triple(s: &Settings, process: &Process) -> TargetTriple { s.default_host_triple .as_ref() - .map(dist::TargetTriple::new) - .unwrap_or_else(|| dist::TargetTriple::from_host_or_build(process)) + .map(TargetTriple::new) + .unwrap_or_else(|| TargetTriple::from_host_or_build(process)) } fn non_empty_env_var(name: &str, process: &Process) -> anyhow::Result> { From 86a57c3f0f6a277befb4d0f6d8465e3a178fa43a Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 5 Aug 2024 11:37:48 +0800 Subject: [PATCH 12/12] style(config): replace `dist::Profile` with `Profile` --- src/config.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 9ce610ed1f..8990b5a47e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -123,7 +123,7 @@ enum OverrideCfg { toolchain: ToolchainDesc, components: Vec, targets: Vec, - profile: Option, + profile: Option, }, } @@ -175,7 +175,7 @@ impl OverrideCfg { .toolchain .profile .as_deref() - .map(dist::Profile::from_str) + .map(Profile::from_str) .transpose()?, } } @@ -230,7 +230,7 @@ impl From for OverrideCfg { pub(crate) const UNIX_FALLBACK_SETTINGS: &str = "/etc/rustup/settings.toml"; pub(crate) struct Cfg<'a> { - profile_override: Option, + profile_override: Option, pub rustup_dir: PathBuf, pub settings_file: SettingsFile, pub fallback_settings: Option, @@ -348,7 +348,7 @@ impl<'a> Cfg<'a> { } } - pub(crate) fn set_profile_override(&mut self, profile: dist::Profile) { + pub(crate) fn set_profile_override(&mut self, profile: Profile) { self.profile_override = Some(profile); } @@ -391,7 +391,7 @@ impl<'a> Cfg<'a> { // if there is no profile in the settings file. The last variant happens when // a user upgrades from a version of Rustup without profiles to a version of // Rustup with profiles. - pub(crate) fn get_profile(&self) -> Result { + pub(crate) fn get_profile(&self) -> Result { if let Some(p) = self.profile_override { return Ok(p); }