@@ -466,7 +466,7 @@ impl<'a> Toolchain<'a> {
466
466
self . bare_add_component ( component)
467
467
}
468
468
469
- fn bare_add_component ( & self , component : Component ) -> Result < ( ) > {
469
+ fn bare_add_component ( & self , mut component : Component ) -> Result < ( ) > {
470
470
if !self . exists ( ) {
471
471
return Err ( ErrorKind :: ToolchainNotInstalled ( self . name . to_owned ( ) ) . into ( ) ) ;
472
472
}
@@ -490,7 +490,12 @@ impl<'a> Toolchain<'a> {
490
490
}
491
491
492
492
if !targ_pkg. extensions . contains ( & component) {
493
- return Err ( ErrorKind :: UnknownComponent ( self . name . to_string ( ) , component) . into ( ) ) ;
493
+ let wildcard_component = Component { target : None , ..component. clone ( ) } ;
494
+ if targ_pkg. extensions . contains ( & wildcard_component) {
495
+ component = wildcard_component;
496
+ } else {
497
+ return Err ( ErrorKind :: UnknownComponent ( self . name . to_string ( ) , component) . into ( ) ) ;
498
+ }
494
499
}
495
500
496
501
let changes = Changes {
@@ -509,7 +514,7 @@ impl<'a> Toolchain<'a> {
509
514
}
510
515
}
511
516
512
- pub fn remove_component ( & self , component : Component ) -> Result < ( ) > {
517
+ pub fn remove_component ( & self , mut component : Component ) -> Result < ( ) > {
513
518
if !self . exists ( ) {
514
519
return Err ( ErrorKind :: ToolchainNotInstalled ( self . name . to_owned ( ) ) . into ( ) ) ;
515
520
}
@@ -534,7 +539,12 @@ impl<'a> Toolchain<'a> {
534
539
535
540
let dist_config = try!( manifestation. read_config ( ) ) . unwrap ( ) ;
536
541
if !dist_config. components . contains ( & component) {
537
- return Err ( ErrorKind :: UnknownComponent ( self . name . to_string ( ) , component) . into ( ) ) ;
542
+ let wildcard_component = Component { target : None , ..component. clone ( ) } ;
543
+ if dist_config. components . contains ( & wildcard_component) {
544
+ component = wildcard_component;
545
+ } else {
546
+ return Err ( ErrorKind :: UnknownComponent ( self . name . to_string ( ) , component) . into ( ) ) ;
547
+ }
538
548
}
539
549
540
550
let changes = Changes {
0 commit comments