From 5dcfc35db1fcd2998ca8c3ee41c5019f4c25a9bf Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 9 Dec 2020 19:22:24 +0000 Subject: [PATCH] dist: Identify requested additional component wildcards Sometimes someone might choose an additional component to add during an install/update which is wildcarded. We need to ensure that we detect this and request the install with the wildcard otherwise we can hit situations such as that identified in #2601 Signed-off-by: Daniel Silverstone --- src/dist/dist.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index af3d91492c..d2993619ad 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -730,12 +730,27 @@ fn try_update_from_dist_<'a>( let mut all_components: HashSet = profile_components.into_iter().collect(); + let rust_package = m.get_package("rust")?; + let rust_target_package = rust_package.get_target(Some(&toolchain.target.clone()))?; + for component in components.iter().copied() { let mut component = Component::new(component.to_string(), Some(toolchain.target.clone()), false); if let Some(renamed) = m.rename_component(&component) { component = renamed; } + // Look up the newly constructed/renamed component and ensure that + // if it's a wildcard component we note such, otherwise we end up + // exacerbating the problem we thought we'd fixed with #2087 and #2115 + if let Some(c) = rust_target_package + .components + .iter() + .find(|c| c.short_name_in_manifest() == component.short_name_in_manifest()) + { + if c.target.is_none() { + component = component.wildcard(); + } + } all_components.insert(component); }