@@ -160,6 +160,8 @@ impl Manifestation {
160160 component,
161161 binary,
162162 status : download_cfg. status_for ( component. short_name ( new_manifest) ) ,
163+ manifest : new_manifest,
164+ download_cfg,
163165 } )
164166 } )
165167 . collect :: < Result < Vec < _ > > > ( ) ?;
@@ -185,7 +187,7 @@ impl Manifestation {
185187 let sem = semaphore. clone ( ) ;
186188 async move {
187189 let _permit = sem. acquire ( ) . await . unwrap ( ) ;
188- bin. download ( download_cfg , max_retries, new_manifest ) . await
190+ bin. download ( max_retries) . await
189191 }
190192 } ) ;
191193 if components_len > 0 {
@@ -240,7 +242,7 @@ impl Manifestation {
240242
241243 // Install components
242244 for ( component_bin, installer_file) in things_to_install {
243- tx = component_bin. install ( installer_file, tx, new_manifest , self , download_cfg ) ?;
245+ tx = component_bin. install ( installer_file, tx, self ) ?;
244246 }
245247
246248 // Install new distribution manifest
@@ -677,21 +679,21 @@ struct ComponentBinary<'a> {
677679 component : & ' a Component ,
678680 binary : & ' a HashedBinary ,
679681 status : DownloadStatus ,
682+ manifest : & ' a Manifest ,
683+ download_cfg : & ' a DownloadCfg < ' a > ,
680684}
681685
682686impl < ' a > ComponentBinary < ' a > {
683- async fn download (
684- self ,
685- download_cfg : & DownloadCfg < ' _ > ,
686- max_retries : usize ,
687- new_manifest : & Manifest ,
688- ) -> Result < ( Self , File ) > {
687+ async fn download ( self , max_retries : usize ) -> Result < ( Self , File ) > {
689688 use tokio_retry:: { RetryIf , strategy:: FixedInterval } ;
690689
691- let url = download_cfg. url ( & self . binary . url ) ?;
690+ let url = self . download_cfg . url ( & self . binary . url ) ?;
692691 let downloaded_file = RetryIf :: spawn (
693692 FixedInterval :: from_millis ( 0 ) . take ( max_retries) ,
694- || download_cfg. download ( & url, & self . binary . hash , & self . status ) ,
693+ || {
694+ self . download_cfg
695+ . download ( & url, & self . binary . hash , & self . status )
696+ } ,
695697 |e : & anyhow:: Error | {
696698 // retry only known retriable cases
697699 match e. downcast_ref :: < RustupError > ( ) {
@@ -705,7 +707,9 @@ impl<'a> ComponentBinary<'a> {
705707 } ,
706708 )
707709 . await
708- . with_context ( || RustupError :: ComponentDownloadFailed ( self . component . name ( new_manifest) ) ) ?;
710+ . with_context ( || {
711+ RustupError :: ComponentDownloadFailed ( self . component . name ( self . manifest ) )
712+ } ) ?;
709713
710714 Ok ( ( self , downloaded_file) )
711715 }
@@ -714,9 +718,7 @@ impl<'a> ComponentBinary<'a> {
714718 & self ,
715719 installer_file : File ,
716720 tx : Transaction < ' t > ,
717- new_manifest : & Manifest ,
718721 manifestation : & Manifestation ,
719- download_cfg : & DownloadCfg < ' _ > ,
720722 ) -> Result < Transaction < ' t > > {
721723 // For historical reasons, the rust-installer component
722724 // names are not the same as the dist manifest component
@@ -725,12 +727,13 @@ impl<'a> ComponentBinary<'a> {
725727 let component = self . component ;
726728 let pkg_name = component. name_in_manifest ( ) ;
727729 let short_pkg_name = component. short_name_in_manifest ( ) ;
728- let short_name = component. short_name ( new_manifest ) ;
730+ let short_name = component. short_name ( self . manifest ) ;
729731
730732 self . status . installing ( ) ;
731733
732734 let reader = utils:: FileReaderWithProgress :: new_file ( & installer_file) ?;
733- let package = DirectoryPackage :: compressed ( reader, self . binary . compression , download_cfg) ?;
735+ let package =
736+ DirectoryPackage :: compressed ( reader, self . binary . compression , self . download_cfg ) ?;
734737
735738 // If the package doesn't contain the component that the
736739 // manifest says it does then somebody must be playing a joke on us.
0 commit comments