File tree 2 files changed +26
-12
lines changed
2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -498,19 +498,11 @@ impl Component {
498
498
distributable : & DistributableToolchain < ' _ > ,
499
499
fallback_target : Option < & TargetTriple > ,
500
500
) -> Result < Self > {
501
+ let manifest = distributable. get_manifest ( ) ?;
501
502
for component_status in distributable. components ( ) ? {
502
- let short_name = component_status. component . short_name_in_manifest ( ) ;
503
- let target = component_status. component . target . as_ref ( ) ;
504
-
505
- if name. starts_with ( short_name)
506
- && target. is_some ( )
507
- && name == format ! ( "{}-{}" , short_name, target. unwrap( ) )
508
- {
509
- return Ok ( Component :: new (
510
- short_name. to_string ( ) ,
511
- target. cloned ( ) ,
512
- false ,
513
- ) ) ;
503
+ let component = component_status. component ;
504
+ if name == component. name_in_manifest ( ) || name == component. name ( & manifest) {
505
+ return Ok ( component) ;
514
506
}
515
507
}
516
508
Original file line number Diff line number Diff line change @@ -1542,6 +1542,28 @@ async fn add_component_by_target_triple() {
1542
1542
assert ! ( cx. config. rustupdir. has( path) ) ;
1543
1543
}
1544
1544
1545
+ #[ tokio:: test]
1546
+ async fn add_component_by_target_triple_renamed_from ( ) {
1547
+ let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
1548
+ cx. config . expect_ok ( & [ "rustup" , "default" , "nightly" ] ) . await ;
1549
+ cx. config
1550
+ . expect_ok ( & [ "rustup" , "component" , "add" , for_host ! ( "rls-{}" ) ] )
1551
+ . await ;
1552
+ let path = for_host ! ( "toolchains/nightly-{}/bin/rls" ) ;
1553
+ assert ! ( cx. config. rustupdir. has( path) ) ;
1554
+ }
1555
+
1556
+ #[ tokio:: test]
1557
+ async fn add_component_by_target_triple_renamed_to ( ) {
1558
+ let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
1559
+ cx. config . expect_ok ( & [ "rustup" , "default" , "nightly" ] ) . await ;
1560
+ cx. config
1561
+ . expect_ok ( & [ "rustup" , "component" , "add" , for_host ! ( "rls-preview-{}" ) ] )
1562
+ . await ;
1563
+ let path = for_host ! ( "toolchains/nightly-{}/bin/rls" ) ;
1564
+ assert ! ( cx. config. rustupdir. has( path) ) ;
1565
+ }
1566
+
1545
1567
#[ tokio:: test]
1546
1568
async fn fail_invalid_component_name ( ) {
1547
1569
let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
You can’t perform that action at this time.
0 commit comments