Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl Cfg {
ErrorKind::OverrideToolchainNotInstalled(name.to_string())
})
} else {
toolchain.install_from_dist(false, &[], &[])?;
toolchain.install_from_dist(true, &[], &[])?;
Ok(Some((toolchain, reason)))
}
}
Expand Down Expand Up @@ -478,7 +478,7 @@ impl Cfg {
) -> Result<Command> {
let toolchain = self.get_toolchain(toolchain, false)?;
if install_if_missing && !toolchain.exists() {
toolchain.install_from_dist(false, &[], &[])?;
toolchain.install_from_dist(true, &[], &[])?;
}

if let Some(cmd) = self.maybe_do_cargo_fallback(&toolchain, binary)? {
Expand Down
37 changes: 35 additions & 2 deletions tests/cli-v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub mod mock;

use crate::mock::clitools::{
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_stderr_ok,
expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_ok_ex,
expect_stderr_ok, expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
};
use std::fs;
use std::io::Write;
Expand Down Expand Up @@ -1185,3 +1185,36 @@ fn test_complete_profile_skips_missing_when_forced() {
);
})
}

#[test]
fn run_with_install_flag_against_unavailable_component() {
setup(&|config| {
let trip = TargetTriple::from_build();
make_component_unavailable(config, "rust-std", &trip);
expect_ok_ex(
config,
&[
"rustup",
"run",
"--install",
"nightly",
"rustc",
"--version",
],
"1.3.0 (hash-nightly-2)
",
for_host!(
r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
warning: Force-skipping unavailable component 'rust-std-{0}'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rustc'
"
),
);
});
}