Skip to content

Commit 969c3c2

Browse files
committed
feat(cli): improve warning when removing the last/host target for a toolchain
1 parent 044083c commit 969c3c2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/cli/rustup_mode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ async fn target_remove(
11651165
let target = TargetTriple::new(target);
11661166
let default_target = cfg.get_default_host_triple()?;
11671167
if target == default_target {
1168-
warn!("after removing the default host target, proc-macros and build scripts might no longer build");
1168+
warn!("removing the default host target; proc-macros and build scripts might no longer build");
11691169
}
11701170
// Whether we have at most 1 component target that is not `None` (wildcard).
11711171
let has_at_most_one_target = distributable
@@ -1179,7 +1179,7 @@ async fn target_remove(
11791179
.at_most_one()
11801180
.is_ok();
11811181
if has_at_most_one_target {
1182-
warn!("after removing the last target, no build targets will be available");
1182+
warn!("removing the last target; no build targets will be available");
11831183
}
11841184
let new_component = Component::new("rust-std".to_string(), Some(target), false);
11851185
distributable.remove_component(new_component).await?;

tests/suite/cli_v2.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,10 +1208,12 @@ async fn remove_target_host() {
12081208
cx.config
12091209
.expect_ok(&["rustup", "target", "add", clitools::CROSS_ARCH1])
12101210
.await;
1211-
cx.config.expect_stderr_ok(
1212-
&["rustup", "target", "remove", &host],
1213-
"after removing the default host target, proc-macros and build scripts might no longer build",
1214-
).await;
1211+
cx.config
1212+
.expect_stderr_ok(
1213+
&["rustup", "target", "remove", &host],
1214+
"removing the default host target; proc-macros and build scripts might no longer build",
1215+
)
1216+
.await;
12151217
let path = format!("toolchains/nightly-{host}/lib/rustlib/{host}/lib/libstd.rlib");
12161218
assert!(!cx.config.rustupdir.has(path));
12171219
let path = format!("toolchains/nightly-{host}/lib/rustlib/{host}/lib");
@@ -1228,7 +1230,7 @@ async fn remove_target_last() {
12281230
cx.config
12291231
.expect_stderr_ok(
12301232
&["rustup", "target", "remove", &host],
1231-
"after removing the last target, no build targets will be available",
1233+
"removing the last target; no build targets will be available",
12321234
)
12331235
.await;
12341236
}

0 commit comments

Comments
 (0)