diff --git a/src/rustup-dist/src/errors.rs b/src/rustup-dist/src/errors.rs index 3d3187c723..e513c10fb5 100644 --- a/src/rustup-dist/src/errors.rs +++ b/src/rustup-dist/src/errors.rs @@ -5,6 +5,11 @@ use std::io::{self, Write}; use std::path::PathBuf; use toml; +pub const TOOLSTATE_MSG: &str = + "if you require these components, please install and use the latest successful build version, \ + which you can find at https://rust-lang-nursery.github.io/rust-toolstate, for example.\n\ + rustup install nightly-2018-12-27"; + error_chain! { links { Utils(rustup_utils::Error, rustup_utils::ErrorKind); @@ -127,11 +132,19 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest) -> String { if same_target { let mut cs_strs = cs.iter().map(|c| format!("'{}'", c.short_name(manifest))); let cs_str = cs_strs.join(", "); - let _ = write!(buf, "some components unavailable for download: {}", cs_str); + let _ = write!( + buf, + "some components unavailable for download: {}\n{}", + cs_str, TOOLSTATE_MSG, + ); } else { let mut cs_strs = cs.iter().map(|c| c.description(manifest)); let cs_str = cs_strs.join(", "); - let _ = write!(buf, "some components unavailable for download: {}", cs_str); + let _ = write!( + buf, + "some components unavailable for download: {}\n{}", + cs_str, TOOLSTATE_MSG, + ); } } diff --git a/tests/cli-misc.rs b/tests/cli-misc.rs index 08aa775bf1..c227149ec7 100644 --- a/tests/cli-misc.rs +++ b/tests/cli-misc.rs @@ -7,6 +7,7 @@ extern crate rustup_utils; extern crate tempdir; extern crate time; +use rustup_dist::errors::TOOLSTATE_MSG; use rustup_mock::clitools::{ self, expect_err, expect_ok, expect_ok_ex, expect_stderr_ok, expect_stdout_ok, expect_timeout_ok, run, set_current_dist_date, this_host_triple, Config, Scenario, @@ -808,7 +809,11 @@ fn update_unavailable_rustc() { expect_err( config, &["rustup", "update", "nightly"], - "some components unavailable for download: 'rustc', 'cargo'", + format!( + "some components unavailable for download: 'rustc', 'cargo'\n{}", + TOOLSTATE_MSG + ) + .as_str(), ); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1");