Skip to content

Commit e0b5727

Browse files
committed
feat(config)!: remove implicit installation from toolchain_from_partial()
1 parent b066dde commit e0b5727

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/config.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -502,16 +502,14 @@ impl<'a> Cfg<'a> {
502502
&self,
503503
toolchain: Option<PartialToolchainDesc>,
504504
) -> anyhow::Result<Toolchain<'_>> {
505-
match toolchain {
505+
let toolchain = match toolchain {
506506
Some(toolchain) => {
507507
let desc = toolchain.resolve(&self.get_default_host_triple()?)?;
508-
Ok(Toolchain::new(
509-
self,
510-
LocalToolchainName::Named(ToolchainName::Official(desc)),
511-
)?)
508+
Some(LocalToolchainName::Named(ToolchainName::Official(desc)))
512509
}
513-
None => Ok(self.find_or_install_active_toolchain(false).await?.0),
514-
}
510+
None => None,
511+
};
512+
self.local_toolchain(toolchain)
515513
}
516514

517515
pub(crate) fn find_active_toolchain(

tests/suite/cli_rustup.rs

+15
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,12 @@ components = [ "rust-src" ]
21422142
)
21432143
.unwrap();
21442144

2145+
cx.config
2146+
.expect_stderr_ok(
2147+
&["rustup", "toolchain", "install"],
2148+
"info: installing component 'rust-src'",
2149+
)
2150+
.await;
21452151
cx.config
21462152
.expect_stdout_ok(&["rustup", "component", "list"], "rust-src (installed)")
21472153
.await;
@@ -2169,6 +2175,12 @@ targets = [ "arm-linux-androideabi" ]
21692175
)
21702176
.unwrap();
21712177

2178+
cx.config
2179+
.expect_stderr_ok(
2180+
&["rustup", "toolchain", "install"],
2181+
"info: installing component 'rust-std' for 'arm-linux-androideabi'",
2182+
)
2183+
.await;
21722184
cx.config
21732185
.expect_stdout_ok(
21742186
&["rustup", "component", "list"],
@@ -2225,6 +2237,9 @@ channel = "nightly"
22252237
"#,
22262238
)
22272239
.unwrap();
2240+
cx.config
2241+
.expect_ok(&["rustup", "toolchain", "install"])
2242+
.await;
22282243
cx.config
22292244
.expect_not_stdout_ok(
22302245
&["rustup", "component", "list"],

0 commit comments

Comments
 (0)