@@ -212,18 +212,39 @@ async fn list_toolchains_with_none() {
212
212
}
213
213
214
214
#[ tokio:: test]
215
- async fn remove_toolchain ( ) {
215
+ async fn remove_toolchain_default ( ) {
216
216
let mut cx = CliTestContext :: new ( Scenario :: SimpleV2 ) . await ;
217
217
cx. config . expect_ok ( & [ "rustup" , "update" , "nightly" ] ) . await ;
218
218
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
+ )
220
223
. await ;
221
224
cx. config . expect_ok ( & [ "rustup" , "toolchain" , "list" ] ) . await ;
222
225
cx. config
223
226
. expect_stdout_ok ( & [ "rustup" , "toolchain" , "list" ] , "no installed toolchains" )
224
227
. await ;
225
228
}
226
229
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
+
227
248
// Issue #2873
228
249
#[ tokio:: test]
229
250
async fn remove_toolchain_ignore_trailing_slash ( ) {
0 commit comments