diff --git a/src/errors.rs b/src/errors.rs index dafc69c9ed..7161e56910 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -351,11 +351,16 @@ error_chain! { } UnknownComponent(t: String, c: String, s: Option) { description("toolchain does not contain component") - display("toolchain '{}' does not contain component {}{}", t, c, if let Some(suggestion) = s { - format!("; did you mean '{}'?", suggestion) - } else { - "".to_string() - }) + display("toolchain '{}' does not contain component {}{}{}", t, c, if let Some(suggestion) = s { + format!("; did you mean '{}'?", suggestion) + } else { + "".to_string() + }, if c.contains("rust-std") { + format!("\nnote: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html{}", + if t.contains("nightly") { "\nhelp: consider using `cargo build -Z build-std` instead" } else { "" } + ) + } else { "".to_string() } + ) } UnknownProfile(p: String) { description("unknown profile name") diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index a415e1db49..9b84131839 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -784,7 +784,9 @@ fn add_target_bogus() { expect_err( config, &["rustup", "target", "add", "bogus"], - "does not contain component 'rust-std' for target 'bogus'", + "does not contain component 'rust-std' for target 'bogus'\n\ + note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html\n\ + help: consider using `cargo build -Z build-std` instead", ); }); }