@@ -223,7 +223,7 @@ impl Manifestation {
223223 // This is recommended in the official docs: https://docs.rs/tokio/latest/tokio/sync/index.html#mpsc-channel
224224 let total_components = components. len ( ) ;
225225 let ( download_tx, mut download_rx) =
226- mpsc:: channel :: < Result < ( ComponentBinary < ' _ > , File ) > > ( total_components) ;
226+ mpsc:: channel :: < Result < ( ComponentBinary , File ) > > ( total_components) ;
227227
228228 let semaphore = Arc :: new ( Semaphore :: new ( concurrent_downloads) ) ;
229229 let component_stream = tokio_stream:: iter ( components. into_iter ( ) ) . map ( {
@@ -287,20 +287,23 @@ impl Manifestation {
287287 let ( component_bin, installer_file) = message?;
288288 let component_name = component_bin. component . short_name ( & new_manifest) ;
289289 let notify_handler = Arc :: clone ( & download_cfg. notify_handler ) ;
290- current_tx = {
290+ current_tx = tokio :: task :: spawn_blocking ( {
291291 let this = Arc :: clone ( & self ) ;
292292 let new_manifest = Arc :: clone ( & new_manifest) ;
293293 let tmp_cx = Arc :: clone ( & download_cfg. tmp_cx ) ;
294294 let download_cfg = Arc :: clone ( & download_cfg) ;
295- this. install_component (
296- component_bin,
297- installer_file,
298- tmp_cx,
299- download_cfg,
300- new_manifest,
301- current_tx,
302- )
303- } ?;
295+ move || {
296+ this. install_component (
297+ component_bin,
298+ installer_file,
299+ tmp_cx,
300+ download_cfg,
301+ new_manifest,
302+ current_tx,
303+ )
304+ }
305+ } )
306+ . await ??;
304307 ( notify_handler) ( Notification :: ComponentInstalled (
305308 & component_name,
306309 & self . target_triple ,
@@ -566,7 +569,7 @@ impl Manifestation {
566569
567570 fn install_component (
568571 & self ,
569- component_bin : ComponentBinary < ' a > ,
572+ component_bin : ComponentBinary ,
570573 installer_file : File ,
571574 tmp_cx : Arc < temp:: Context > ,
572575 download_cfg : Arc < DownloadCfg > ,
@@ -805,7 +808,7 @@ impl Update {
805808 fn components_urls_and_hashes < ' a > (
806809 & ' a self ,
807810 new_manifest : & ' a Manifest ,
808- ) -> Result < Vec < ComponentBinary < ' a > > > {
811+ ) -> Result < Vec < ComponentBinary > > {
809812 let mut components_urls_and_hashes = Vec :: new ( ) ;
810813 for component in & self . components_to_install {
811814 let package = new_manifest. get_package ( component. short_name_in_manifest ( ) ) ?;
@@ -818,21 +821,21 @@ impl Update {
818821 // We prefer the first format in the list, since the parsing of the
819822 // manifest leaves us with the files/hash pairs in preference order.
820823 components_urls_and_hashes. push ( ComponentBinary {
821- component,
822- binary : & target_package. bins [ 0 ] ,
824+ component : Arc :: new ( component . clone ( ) ) ,
825+ binary : Arc :: new ( target_package. bins [ 0 ] . clone ( ) ) ,
823826 } ) ;
824827 }
825828
826829 Ok ( components_urls_and_hashes)
827830 }
828831}
829832
830- struct ComponentBinary < ' a > {
831- component : & ' a Component ,
832- binary : & ' a HashedBinary ,
833+ struct ComponentBinary {
834+ component : Arc < Component > ,
835+ binary : Arc < HashedBinary > ,
833836}
834837
835- impl < ' a > ComponentBinary < ' a > {
838+ impl ComponentBinary {
836839 async fn download (
837840 & self ,
838841 url : & Url ,
0 commit comments