@@ -677,7 +677,33 @@ fn rename_rls_remove() {
677
677
} ) ;
678
678
}
679
679
680
+ // issue #3737
681
+ /// `~/.rustup/toolchains` is permitted to be a symlink.
682
+ #[ test]
683
+ #[ cfg( any( unix, windows) ) ]
684
+ fn toolchains_symlink ( ) {
685
+ use rustup:: utils:: raw:: symlink_dir;
686
+ use std:: fs;
687
+
688
+ clitools:: test ( Scenario :: SimpleV2 , & |config| {
689
+ let cwd = config. current_dir ( ) ;
690
+ let test_toolchains = cwd. join ( "toolchains-test" ) ;
691
+ fs:: create_dir ( & test_toolchains) . unwrap ( ) ;
692
+ symlink_dir ( & test_toolchains, & config. rustupdir . join ( "toolchains" ) ) . unwrap ( ) ;
693
+
694
+ config. expect_ok ( & [ "rustup" , "default" , "nightly" ] ) ;
695
+ config. expect_ok_contains ( & [ "rustup" , "toolchain" , "list" ] , "nightly" , "" ) ;
696
+ config. expect_ok_contains ( & [ "rustc" , "--version" ] , "hash-nightly-2" , "" ) ;
697
+ config. expect_ok ( & [ "rustup" , "toolchain" , "uninstall" , "nightly" ] ) ;
698
+ config. expect_stdout_ok (
699
+ & [ "rustup" , "toolchain" , "list" ] ,
700
+ "no installed toolchains\n " ,
701
+ ) ;
702
+ } ) ;
703
+ }
704
+
680
705
// issue #1169
706
+ /// A toolchain that is a stale symlink should be correctly uninstalled.
681
707
#[ test]
682
708
#[ cfg( any( unix, windows) ) ]
683
709
fn toolchain_broken_symlink ( ) {
0 commit comments