Skip to content

Commit 3613fec

Browse files
rbtcollinsdjc
authored andcommitted
Make DistributableToolchain::add_component async
1 parent cbd2f7c commit 3613fec

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ fn target_add(
11511151
Some(TargetTriple::new(target)),
11521152
false,
11531153
);
1154-
distributable.add_component(new_component)?;
1154+
utils::run_future(distributable.add_component(new_component))?;
11551155
}
11561156

11571157
Ok(utils::ExitCode(0))
@@ -1213,7 +1213,7 @@ fn component_add(
12131213

12141214
for component in &components {
12151215
let new_component = Component::try_new(component, &distributable, target.as_ref())?;
1216-
distributable.add_component(new_component)?;
1216+
utils::run_future(distributable.add_component(new_component))?;
12171217
}
12181218

12191219
Ok(utils::ExitCode(0))

src/toolchain/distributable.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'a> DistributableToolchain<'a> {
5353
&self.desc
5454
}
5555

56-
pub(crate) fn add_component(&self, mut component: Component) -> anyhow::Result<()> {
56+
pub(crate) async fn add_component(&self, mut component: Component) -> anyhow::Result<()> {
5757
// TODO: take multiple components?
5858
let manifestation = self.get_manifestation()?;
5959
let manifest = self.get_manifest()?;
@@ -111,14 +111,16 @@ impl<'a> DistributableToolchain<'a> {
111111
&|n: crate::dist::Notification<'_>| (self.cfg.notify_handler)(n.into());
112112
let download_cfg = self.cfg.download_cfg(&notify_handler);
113113

114-
utils::run_future(manifestation.update(
115-
&manifest,
116-
changes,
117-
false,
118-
&download_cfg,
119-
&self.desc.manifest_name(),
120-
false,
121-
))?;
114+
manifestation
115+
.update(
116+
&manifest,
117+
changes,
118+
false,
119+
&download_cfg,
120+
&self.desc.manifest_name(),
121+
false,
122+
)
123+
.await?;
122124

123125
Ok(())
124126
}

0 commit comments

Comments
 (0)