From b9e36fbfaf44d5e3bacfb4ad56e5bca1b7b1370a Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 13 Dec 2019 09:58:34 -0800 Subject: [PATCH] Install: Improve error message for when rust already installed Because some people install rustc/cargo from their distro and then try and install rustup, they can get confused/worried by the error message given. This attempts to ameliorate the situation by being a little clearer about what might go wrong. Signed-off-by: Daniel Silverstone --- src/cli/self_update.rs | 6 ++++-- tests/cli-misc.rs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index bb07764596..206c1a921d 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -385,8 +385,10 @@ fn check_existence_of_rustc_or_cargo_in_path(no_prompt: bool) -> Result<()> { if let Err(path) = rustc_or_cargo_exists_in_path() { err!("it looks like you have an existing installation of Rust at:"); err!("{}", path); - err!("rustup cannot be installed alongside Rust. Please uninstall first"); - err!("if this is what you want, restart the installation with `-y'"); + err!("rustup should not be installed alongside Rust. Please uninstall your existing Rust first."); + err!("Otherwise you may have confusion unless you are careful with your PATH"); + err!("If you are sure that you want both rustup and your already installed Rust"); + err!("then please restart the installation and pass `-y' to bypass this check."); Err("cannot install while Rust is installed".into()) } else { Ok(()) diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index 4b64b42522..a466f39f37 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -622,7 +622,7 @@ fn install_stops_if_rustc_exists() { .contains("it looks like you have an existing installation of Rust at:")); assert!(out .stderr - .contains("if this is what you want, restart the installation with `-y'")); + .contains("restart the installation and pass `-y'")); }); } @@ -654,7 +654,7 @@ fn install_stops_if_cargo_exists() { .contains("it looks like you have an existing installation of Rust at:")); assert!(out .stderr - .contains("if this is what you want, restart the installation with `-y'")); + .contains("restart the installation and pass `-y'")); }); }