Skip to content

Commit eb30f91

Browse files
rbtcollinsdjc
authored andcommitted
Make try_update_from_dist_ async
1 parent 2b4cf31 commit eb30f91

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

src/dist/dist.rs

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ fn update_from_dist_(
802802
};
803803

804804
loop {
805-
match try_update_from_dist_(
805+
match utils::run_future(try_update_from_dist_(
806806
download,
807807
update_hash,
808808
&toolchain,
@@ -812,7 +812,7 @@ fn update_from_dist_(
812812
components,
813813
targets,
814814
&mut fetched,
815-
) {
815+
)) {
816816
Ok(v) => break Ok(v),
817817
Err(e) => {
818818
if !backtrack {
@@ -882,7 +882,7 @@ fn update_from_dist_(
882882
}
883883
}
884884

885-
fn try_update_from_dist_(
885+
async fn try_update_from_dist_(
886886
download: DownloadCfg<'_>,
887887
update_hash: Option<&Path>,
888888
toolchain: &ToolchainDesc,
@@ -898,7 +898,7 @@ fn try_update_from_dist_(
898898

899899
// TODO: Add a notification about which manifest version is going to be used
900900
(download.notify_handler)(Notification::DownloadingManifest(&toolchain_str));
901-
match utils::run_future(dl_v2_manifest(
901+
match dl_v2_manifest(
902902
download,
903903
// Even if manifest has not changed, we must continue to install requested components.
904904
// So if components or targets is not empty, we skip passing `update_hash` so that
@@ -909,7 +909,9 @@ fn try_update_from_dist_(
909909
None
910910
},
911911
toolchain,
912-
)) {
912+
)
913+
.await
914+
{
913915
Ok(Some((m, hash))) => {
914916
(download.notify_handler)(Notification::DownloadedManifest(
915917
&m.date,
@@ -962,14 +964,17 @@ fn try_update_from_dist_(
962964

963965
fetched.clone_from(&m.date);
964966

965-
return match utils::run_future(manifestation.update(
966-
&m,
967-
changes,
968-
force_update,
969-
&download,
970-
&toolchain.manifest_name(),
971-
true,
972-
)) {
967+
return match manifestation
968+
.update(
969+
&m,
970+
changes,
971+
force_update,
972+
&download,
973+
&toolchain.manifest_name(),
974+
true,
975+
)
976+
.await
977+
{
973978
Ok(status) => match status {
974979
UpdateStatus::Unchanged => Ok(None),
975980
UpdateStatus::Changed => Ok(Some(hash)),
@@ -1012,7 +1017,7 @@ fn try_update_from_dist_(
10121017
}
10131018

10141019
// If the v2 manifest is not found then try v1
1015-
let manifest = match utils::run_future(dl_v1_manifest(download, toolchain)) {
1020+
let manifest = match dl_v1_manifest(download, toolchain).await {
10161021
Ok(m) => m,
10171022
Err(any) => {
10181023
enum Cases {
@@ -1043,12 +1048,14 @@ fn try_update_from_dist_(
10431048
}
10441049
}
10451050
};
1046-
let result = utils::run_future(manifestation.update_v1(
1047-
&manifest,
1048-
update_hash,
1049-
download.tmp_cx,
1050-
&download.notify_handler,
1051-
));
1051+
let result = manifestation
1052+
.update_v1(
1053+
&manifest,
1054+
update_hash,
1055+
download.tmp_cx,
1056+
&download.notify_handler,
1057+
)
1058+
.await;
10521059
// inspect, determine what context to add, then process afterwards.
10531060
let mut download_not_exists = false;
10541061
match &result {

0 commit comments

Comments
 (0)