@@ -212,18 +212,39 @@ 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" ] )
219+ . expect_stderr_ok (
220+ & [ "rustup" , "toolchain" , "remove" , "nightly" ] ,
221+ "removing the default toolchain; proc-macros and build scripts might no longer build" ,
222+ )
220223 . await ;
221224 cx. config . expect_ok ( & [ "rustup" , "toolchain" , "list" ] ) . await ;
222225 cx. config
223226 . expect_stdout_ok ( & [ "rustup" , "toolchain" , "list" ] , "no installed toolchains" )
224227 . await ;
225228}
226229
230+ #[ tokio:: test]
231+ async fn remove_toolchain_active ( ) {
232+ let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
233+ cx. config . expect_ok ( & [ "rustup" , "default" , "nightly" ] ) . await ;
234+ cx. config
235+ . expect_ok ( & [ "rustup" , "override" , "set" , "stable" ] )
236+ . await ;
237+ cx. config
238+ . expect_stderr_ok (
239+ & [ "rustup" , "toolchain" , "remove" , "stable" ] ,
240+ "removing the active toolchain; a toolchain override will be required for running Rust tools" ,
241+ )
242+ . await ;
243+ cx. config
244+ . expect_stdout_ok ( & [ "rustup" , "toolchain" , "list" ] , "nightly" )
245+ . await ;
246+ }
247+
227248// Issue #2873
228249#[ tokio:: test]
229250async fn remove_toolchain_ignore_trailing_slash ( ) {
0 commit comments