Skip to content

Commit

Permalink
Return Ok status when trying to add required component
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Nov 27, 2018
1 parent d744fcc commit d1b1ff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/rustup/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cli-v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}'"));
});
}
Expand Down

0 comments on commit d1b1ff7

Please sign in to comment.