Skip to content

Commit be16639

Browse files
authored
Merge pull request #1595 from h-michael/more-detail-error-msg
Add more detail error messages when installing with some components has failed.
2 parents 67f9e43 + cec8cbb commit be16639

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/rustup-dist/src/errors.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ use std::io::{self, Write};
55
use std::path::PathBuf;
66
use toml;
77

8+
pub const TOOLSTATE_MSG: &str =
9+
"if you require these components, please install and use the latest successful build version, \
10+
which you can find at https://rust-lang-nursery.github.io/rust-toolstate, for example.\n\
11+
rustup install nightly-2018-12-27";
12+
813
error_chain! {
914
links {
1015
Utils(rustup_utils::Error, rustup_utils::ErrorKind);
@@ -127,11 +132,19 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest) -> String {
127132
if same_target {
128133
let mut cs_strs = cs.iter().map(|c| format!("'{}'", c.short_name(manifest)));
129134
let cs_str = cs_strs.join(", ");
130-
let _ = write!(buf, "some components unavailable for download: {}", cs_str);
135+
let _ = write!(
136+
buf,
137+
"some components unavailable for download: {}\n{}",
138+
cs_str, TOOLSTATE_MSG,
139+
);
131140
} else {
132141
let mut cs_strs = cs.iter().map(|c| c.description(manifest));
133142
let cs_str = cs_strs.join(", ");
134-
let _ = write!(buf, "some components unavailable for download: {}", cs_str);
143+
let _ = write!(
144+
buf,
145+
"some components unavailable for download: {}\n{}",
146+
cs_str, TOOLSTATE_MSG,
147+
);
135148
}
136149
}
137150

tests/cli-misc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ extern crate rustup_utils;
77
extern crate tempdir;
88
extern crate time;
99

10+
use rustup_dist::errors::TOOLSTATE_MSG;
1011
use rustup_mock::clitools::{
1112
self, expect_err, expect_ok, expect_ok_ex, expect_stderr_ok, expect_stdout_ok,
1213
expect_timeout_ok, run, set_current_dist_date, this_host_triple, Config, Scenario,
@@ -808,7 +809,11 @@ fn update_unavailable_rustc() {
808809
expect_err(
809810
config,
810811
&["rustup", "update", "nightly"],
811-
"some components unavailable for download: 'rustc', 'cargo'",
812+
format!(
813+
"some components unavailable for download: 'rustc', 'cargo'\n{}",
814+
TOOLSTATE_MSG
815+
)
816+
.as_str(),
812817
);
813818

814819
expect_stdout_ok(config, &["rustc", "--version"], "hash-n-1");

0 commit comments

Comments
 (0)