@@ -7,6 +7,7 @@ use std::fmt;
77use std:: io:: { self , ErrorKind as IOErrorKind , Read } ;
88use std:: mem;
99use std:: path:: { Path , PathBuf } ;
10+ use std:: sync:: Arc ;
1011
1112use anyhow:: { Context , Result , anyhow, bail} ;
1213use tar:: EntryType ;
@@ -26,13 +27,13 @@ pub(crate) const VERSION_FILE: &str = "rust-installer-version";
2627
2728pub trait Package : fmt:: Debug {
2829 fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool ;
29- fn install < ' a > (
30+ fn install (
3031 & self ,
3132 target : & Components ,
3233 component : & str ,
3334 short_name : Option < & str > ,
34- tx : Transaction < ' a > ,
35- ) -> Result < Transaction < ' a > > ;
35+ tx : Transaction ,
36+ ) -> Result < Transaction > ;
3637 fn components ( & self ) -> Vec < String > ;
3738}
3839
@@ -79,13 +80,13 @@ impl Package for DirectoryPackage {
7980 false
8081 }
8182 }
82- fn install < ' a > (
83+ fn install (
8384 & self ,
8485 target : & Components ,
8586 name : & str ,
8687 short_name : Option < & str > ,
87- tx : Transaction < ' a > ,
88- ) -> Result < Transaction < ' a > > {
88+ tx : Transaction ,
89+ ) -> Result < Transaction > {
8990 let actual_name = if self . components . contains ( name) {
9091 name
9192 } else if let Some ( n) = short_name {
@@ -137,13 +138,13 @@ impl Package for DirectoryPackage {
137138
138139#[ derive( Debug ) ]
139140#[ allow( dead_code) ] // temp::Dir is held for drop.
140- pub ( crate ) struct TarPackage < ' a > ( DirectoryPackage , temp:: Dir < ' a > ) ;
141+ pub ( crate ) struct TarPackage ( DirectoryPackage , temp:: Dir ) ;
141142
142- impl < ' a > TarPackage < ' a > {
143+ impl TarPackage {
143144 pub ( crate ) fn new < R : Read > (
144145 stream : R ,
145- tmp_cx : & ' a temp:: Context ,
146- notify_handler : Option < & ' a dyn Fn ( Notification < ' _ > ) > ,
146+ tmp_cx : Arc < temp:: Context > ,
147+ notify_handler : Option < & dyn Fn ( Notification < ' _ > ) > ,
147148 process : & Process ,
148149 ) -> Result < Self > {
149150 let temp_dir = tmp_cx. new_directory ( ) ?;
@@ -532,17 +533,17 @@ fn unpack_without_first_dir<R: Read>(
532533 Ok ( ( ) )
533534}
534535
535- impl Package for TarPackage < ' _ > {
536+ impl Package for TarPackage {
536537 fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool {
537538 self . 0 . contains ( component, short_name)
538539 }
539- fn install < ' b > (
540+ fn install (
540541 & self ,
541542 target : & Components ,
542543 component : & str ,
543544 short_name : Option < & str > ,
544- tx : Transaction < ' b > ,
545- ) -> Result < Transaction < ' b > > {
545+ tx : Transaction ,
546+ ) -> Result < Transaction > {
546547 self . 0 . install ( target, component, short_name, tx)
547548 }
548549 fn components ( & self ) -> Vec < String > {
@@ -551,36 +552,36 @@ impl Package for TarPackage<'_> {
551552}
552553
553554#[ derive( Debug ) ]
554- pub ( crate ) struct TarGzPackage < ' a > ( TarPackage < ' a > ) ;
555+ pub ( crate ) struct TarGzPackage ( TarPackage ) ;
555556
556- impl < ' a > TarGzPackage < ' a > {
557+ impl TarGzPackage {
557558 pub ( crate ) fn new < R : Read > (
558559 stream : R ,
559- tmp_cx : & ' a temp:: Context ,
560- notify_handler : Option < & ' a dyn Fn ( Notification < ' _ > ) > ,
560+ tmp_cx : Arc < temp:: Context > ,
561+ notify_handler : Option < & dyn Fn ( Notification < ' _ > ) > ,
561562 process : & Process ,
562563 ) -> Result < Self > {
563564 let stream = flate2:: read:: GzDecoder :: new ( stream) ;
564565 Ok ( TarGzPackage ( TarPackage :: new (
565566 stream,
566- tmp_cx,
567+ Arc :: clone ( & tmp_cx) ,
567568 notify_handler,
568569 process,
569570 ) ?) )
570571 }
571572}
572573
573- impl Package for TarGzPackage < ' _ > {
574+ impl Package for TarGzPackage {
574575 fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool {
575576 self . 0 . contains ( component, short_name)
576577 }
577- fn install < ' b > (
578+ fn install (
578579 & self ,
579580 target : & Components ,
580581 component : & str ,
581582 short_name : Option < & str > ,
582- tx : Transaction < ' b > ,
583- ) -> Result < Transaction < ' b > > {
583+ tx : Transaction ,
584+ ) -> Result < Transaction > {
584585 self . 0 . install ( target, component, short_name, tx)
585586 }
586587 fn components ( & self ) -> Vec < String > {
@@ -589,36 +590,36 @@ impl Package for TarGzPackage<'_> {
589590}
590591
591592#[ derive( Debug ) ]
592- pub ( crate ) struct TarXzPackage < ' a > ( TarPackage < ' a > ) ;
593+ pub ( crate ) struct TarXzPackage ( TarPackage ) ;
593594
594- impl < ' a > TarXzPackage < ' a > {
595+ impl TarXzPackage {
595596 pub ( crate ) fn new < R : Read > (
596597 stream : R ,
597- tmp_cx : & ' a temp:: Context ,
598- notify_handler : Option < & ' a dyn Fn ( Notification < ' _ > ) > ,
598+ tmp_cx : Arc < temp:: Context > ,
599+ notify_handler : Option < & dyn Fn ( Notification < ' _ > ) > ,
599600 process : & Process ,
600601 ) -> Result < Self > {
601602 let stream = xz2:: read:: XzDecoder :: new ( stream) ;
602603 Ok ( TarXzPackage ( TarPackage :: new (
603604 stream,
604- tmp_cx,
605+ Arc :: clone ( & tmp_cx) ,
605606 notify_handler,
606607 process,
607608 ) ?) )
608609 }
609610}
610611
611- impl Package for TarXzPackage < ' _ > {
612+ impl Package for TarXzPackage {
612613 fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool {
613614 self . 0 . contains ( component, short_name)
614615 }
615- fn install < ' b > (
616+ fn install (
616617 & self ,
617618 target : & Components ,
618619 component : & str ,
619620 short_name : Option < & str > ,
620- tx : Transaction < ' b > ,
621- ) -> Result < Transaction < ' b > > {
621+ tx : Transaction ,
622+ ) -> Result < Transaction > {
622623 self . 0 . install ( target, component, short_name, tx)
623624 }
624625 fn components ( & self ) -> Vec < String > {
@@ -627,36 +628,36 @@ impl Package for TarXzPackage<'_> {
627628}
628629
629630#[ derive( Debug ) ]
630- pub ( crate ) struct TarZStdPackage < ' a > ( TarPackage < ' a > ) ;
631+ pub ( crate ) struct TarZStdPackage ( TarPackage ) ;
631632
632- impl < ' a > TarZStdPackage < ' a > {
633+ impl TarZStdPackage {
633634 pub ( crate ) fn new < R : Read > (
634635 stream : R ,
635- tmp_cx : & ' a temp:: Context ,
636- notify_handler : Option < & ' a dyn Fn ( Notification < ' _ > ) > ,
636+ tmp_cx : Arc < temp:: Context > ,
637+ notify_handler : Option < & dyn Fn ( Notification < ' _ > ) > ,
637638 process : & Process ,
638639 ) -> Result < Self > {
639640 let stream = zstd:: stream:: read:: Decoder :: new ( stream) ?;
640641 Ok ( TarZStdPackage ( TarPackage :: new (
641642 stream,
642- tmp_cx,
643+ Arc :: clone ( & tmp_cx) ,
643644 notify_handler,
644645 process,
645646 ) ?) )
646647 }
647648}
648649
649- impl Package for TarZStdPackage < ' _ > {
650+ impl Package for TarZStdPackage {
650651 fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool {
651652 self . 0 . contains ( component, short_name)
652653 }
653- fn install < ' b > (
654+ fn install (
654655 & self ,
655656 target : & Components ,
656657 component : & str ,
657658 short_name : Option < & str > ,
658- tx : Transaction < ' b > ,
659- ) -> Result < Transaction < ' b > > {
659+ tx : Transaction ,
660+ ) -> Result < Transaction > {
660661 self . 0 . install ( target, component, short_name, tx)
661662 }
662663 fn components ( & self ) -> Vec < String > {
0 commit comments