From d1b1ff73f24b806b06e171553fc2b65a40b5a447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Tue, 27 Nov 2018 18:27:00 +0100 Subject: [PATCH] Return Ok status when trying to add required component Fixes https://github.com/rust-lang/rustup.rs/issues/441 --- src/rustup/toolchain.rs | 8 +++++--- tests/cli-v2.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rustup/toolchain.rs b/src/rustup/toolchain.rs index c7e595503c2..ae31b9572e4 100644 --- a/src/rustup/toolchain.rs +++ b/src/rustup/toolchain.rs @@ -636,12 +636,14 @@ impl<'a> Toolchain<'a> { .expect("installed manifest should have a known target"); if targ_pkg.components.contains(&component) { - return Err( + // Treat it as a warning, see https://github.com/rust-lang/rustup.rs/issues/441 + return Ok(println!( + "{}", ErrorKind::AddingRequiredComponent( self.name.to_string(), component.description(&manifest), - ).into(), - ); + ), + )); } if !targ_pkg.extensions.contains(&component) { diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index 0c2af955a7b..ef83821ae16 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -636,7 +636,7 @@ fn add_target_host() { setup(&|config| { let trip = TargetTriple::from_build(); expect_ok(config, &["rustup", "default", "nightly"]); - expect_err(config, &["rustup", "target", "add", &trip.to_string()], + expect_stdout_ok(config, &["rustup", "target", "add", &trip.to_string()], for_host!("component 'rust-std' for target '{0}' was automatically added because it is required for toolchain 'nightly-{0}'")); }); }