-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(config)!: use unqualified names for default_toolchain
#4947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,6 @@ use crate::{ | |
| process::Process, | ||
| toolchain::{ | ||
| DistributableToolchain, MaybeOfficialToolchainName, ResolvableToolchainName, Toolchain, | ||
| ToolchainName, | ||
| }, | ||
| utils::{self, ExitCode}, | ||
| }; | ||
|
|
@@ -107,7 +106,7 @@ pub(crate) struct InstallOpts<'a> { | |
| } | ||
|
|
||
| impl InstallOpts<'_> { | ||
| fn install(self, cfg: &mut Cfg<'_>) -> Result<Option<ToolchainDesc>> { | ||
| fn install(self, cfg: &mut Cfg<'_>) -> Result<Option<PartialToolchainDesc>> { | ||
| let Self { | ||
| default_host_tuple, | ||
| default_toolchain, | ||
|
|
@@ -165,18 +164,14 @@ impl InstallOpts<'_> { | |
| MaybeOfficialToolchainName::None => unreachable!(), | ||
| MaybeOfficialToolchainName::Some(n) => n, | ||
| }; | ||
| Some(toolchain_name.resolve(&cfg.default_host_tuple()?)?) | ||
| Some(toolchain_name) | ||
| } | ||
| None => match cfg.get_default()? { | ||
| None => match cfg.get_default_resolvable()? { | ||
| // Default is installable | ||
| Some(ToolchainName::Official(t)) => Some(t), | ||
| Some(ResolvableToolchainName::Official(t)) => Some(t), | ||
| // Default is custom, presumably from a prior install. Do nothing. | ||
| Some(ToolchainName::Custom(_)) => None, | ||
| None => Some( | ||
| "stable" | ||
| .parse::<PartialToolchainDesc>()? | ||
| .resolve(&cfg.default_host_tuple()?)?, | ||
| ), | ||
| Some(ResolvableToolchainName::Custom(_)) => None, | ||
| None => Some(PartialToolchainDesc::from_str("stable")?), | ||
| }, | ||
| }) | ||
| } else { | ||
|
|
@@ -1022,7 +1017,8 @@ async fn maybe_install_rust(opts: InstallOpts<'_>, cfg: &mut Cfg<'_>) -> Result< | |
|
|
||
| let (components, targets) = (opts.components, opts.targets); | ||
| let toolchain = opts.install(cfg)?; | ||
| if let Some(desc) = &toolchain { | ||
| if let Some(partial_desc) = toolchain { | ||
| let desc = &partial_desc.clone().resolve(&cfg.default_host_tuple()?)?; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Pre-existing, but later on we have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That commit just fixed some instances of it, it didn't claim to fix all of it. |
||
| let options = DistOptions::new(components, targets, desc, cfg.get_profile()?, true, cfg)?; | ||
| let status = if Toolchain::exists(cfg, &desc.into())? { | ||
| warn!("Updating existing toolchain, profile choice will be ignored"); | ||
|
|
@@ -1041,7 +1037,7 @@ async fn maybe_install_rust(opts: InstallOpts<'_>, cfg: &mut Cfg<'_>) -> Result< | |
|
|
||
| check_proxy_sanity(cfg.process, components, desc)?; | ||
|
|
||
| cfg.set_default(Some(&desc.clone().into()))?; | ||
| cfg.set_default(Some(&partial_desc.into()))?; | ||
| writeln!(cfg.process.stdout().lock())?; | ||
| common::show_channel_update(cfg, PackageUpdate::Toolchain(desc.clone()), Ok(status))?; | ||
| } | ||
|
|
@@ -1521,11 +1517,7 @@ mod tests { | |
| }; | ||
|
|
||
| assert_eq!( | ||
| "stable" | ||
| .parse::<PartialToolchainDesc>() | ||
| .unwrap() | ||
| .resolve(&cfg.default_host_tuple().unwrap()) | ||
| .unwrap(), | ||
| "stable".parse::<PartialToolchainDesc>().unwrap(), | ||
| opts.install(&mut cfg) | ||
| .unwrap() // result | ||
| .unwrap() // option | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Pre-existing but this naming is quite confusing, how can
InstallOpts::install()be actually not installing anything?View changes since the review