Skip to content

Commit 71d1e72

Browse files
committed
Update force_update param in install_from_dist calls in config.rs
1 parent d63478d commit 71d1e72

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl Cfg {
317317
ErrorKind::OverrideToolchainNotInstalled(name.to_string())
318318
})
319319
} else {
320-
toolchain.install_from_dist(false, &[], &[])?;
320+
toolchain.install_from_dist(true, &[], &[])?;
321321
Ok(Some((toolchain, reason)))
322322
}
323323
}
@@ -478,7 +478,7 @@ impl Cfg {
478478
) -> Result<Command> {
479479
let toolchain = self.get_toolchain(toolchain, false)?;
480480
if install_if_missing && !toolchain.exists() {
481-
toolchain.install_from_dist(false, &[], &[])?;
481+
toolchain.install_from_dist(true, &[], &[])?;
482482
}
483483

484484
if let Some(cmd) = self.maybe_do_cargo_fallback(&toolchain, binary)? {

tests/cli-v2.rs

+35-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
pub mod mock;
55

66
use crate::mock::clitools::{
7-
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_stderr_ok,
8-
expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
7+
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_ok_ex,
8+
expect_stderr_ok, expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
99
};
1010
use std::fs;
1111
use std::io::Write;
@@ -1185,3 +1185,36 @@ fn test_complete_profile_skips_missing_when_forced() {
11851185
);
11861186
})
11871187
}
1188+
1189+
#[test]
1190+
fn run_with_install_flag_against_unavailable_component() {
1191+
setup(&|config| {
1192+
let trip = TargetTriple::from_build();
1193+
make_component_unavailable(config, "rust-std", &trip);
1194+
expect_ok_ex(
1195+
config,
1196+
&[
1197+
"rustup",
1198+
"run",
1199+
"--install",
1200+
"nightly",
1201+
"rustc",
1202+
"--version",
1203+
],
1204+
"1.3.0 (hash-nightly-2)
1205+
",
1206+
for_host!(
1207+
r"info: syncing channel updates for 'nightly-{0}'
1208+
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
1209+
warning: Force-skipping unavailable component 'rust-std-x86_64-apple-darwin'
1210+
info: downloading component 'cargo'
1211+
info: downloading component 'rust-docs'
1212+
info: downloading component 'rustc'
1213+
info: installing component 'cargo'
1214+
info: installing component 'rust-docs'
1215+
info: installing component 'rustc'
1216+
"
1217+
),
1218+
);
1219+
});
1220+
}

0 commit comments

Comments
 (0)