@@ -212,18 +212,38 @@ async fn list_toolchains_with_none() {
212212}
213213
214214#[ tokio:: test]
215- async fn remove_toolchain ( ) {
215+ async fn remove_toolchain_default ( ) {
216216 let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
217217 cx. config . expect_ok ( & [ "rustup" , "update" , "nightly" ] ) . await ;
218218 cx. config
219- . expect_ok ( & [ "rustup" , "toolchain" , "remove" , "nightly" ] )
220- . await ;
219+ . expect_stderr_ok (
220+ & [ "rustup" , "toolchain" , "remove" , "nightly" ] ,
221+ "after removing the default toolchain, proc-macros and build scripts might no longer build" ,
222+ ) . await ;
221223 cx. config . expect_ok ( & [ "rustup" , "toolchain" , "list" ] ) . await ;
222224 cx. config
223225 . expect_stdout_ok ( & [ "rustup" , "toolchain" , "list" ] , "no installed toolchains" )
224226 . await ;
225227}
226228
229+ #[ tokio:: test]
230+ async fn remove_toolchain_active ( ) {
231+ let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
232+ cx. config . expect_ok ( & [ "rustup" , "default" , "nightly" ] ) . await ;
233+ cx. config
234+ . expect_ok ( & [ "rustup" , "override" , "set" , "stable" ] )
235+ . await ;
236+ cx. config
237+ . expect_stderr_ok (
238+ & [ "rustup" , "toolchain" , "remove" , "stable" ] ,
239+ "it seems that you are removing the active toolchain, is this intentional?" ,
240+ )
241+ . await ;
242+ cx. config
243+ . expect_stdout_ok ( & [ "rustup" , "toolchain" , "list" ] , "nightly" )
244+ . await ;
245+ }
246+
227247// Issue #2873
228248#[ tokio:: test]
229249async fn remove_toolchain_ignore_trailing_slash ( ) {
0 commit comments