Skip to content

Commit d536825

Browse files
committed
rustup-cli: error message unavailable toolchain
Currently if a user runs `rustup install unavailable-toolchain`, the error message is: `error: toolchain 'unavailable-toolchain' is not installed`. This is error message is weird, since the user runs rustup to install the toolchain. This commit copies the "InvalidToolchainName" error from rustup-dist, and configures rustup install to use this error.
1 parent cc87d74 commit d536825

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/rustup-cli/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ error_chain! {
2727
description("toolchain is not installed")
2828
display("toolchain '{}' is not installed", t)
2929
}
30+
InvalidToolchainName(t: String) {
31+
description("invalid toolchain name")
32+
display("invalid toolchain name: '{}'", t)
33+
}
3034
InfiniteRecursion {
3135
description("infinite recursion detected")
3236
}

src/rustup-cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn update(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
468468
let status = if !toolchain.is_custom() {
469469
Some(try!(toolchain.install_from_dist(m.is_present("force"))))
470470
} else if !toolchain.exists() {
471-
return Err(ErrorKind::ToolchainNotInstalled(toolchain.name().to_string()).into());
471+
return Err(ErrorKind::InvalidToolchainName(toolchain.name().to_string()).into());
472472
} else {
473473
None
474474
};

0 commit comments

Comments
 (0)