@@ -826,17 +826,17 @@ impl fmt::Display for ValidityConstraint {
826826// - Cx global compilation context
827827#[ derive( derivative:: Derivative ) ]
828828#[ derivative( Clone ( bound = "" ) ) ]
829- struct PatStack < ' a , ' p , Cx : TypeCx > {
829+ struct PatStack < ' p , Cx : TypeCx > {
830830 // Rows of len 1 are very common, which is why `SmallVec[_; 2]` works well.
831- pats : SmallVec < [ & ' a DeconstructedPat < ' p , Cx > ; 2 ] > ,
831+ pats : SmallVec < [ & ' p DeconstructedPat < ' p , Cx > ; 2 ] > ,
832832 /// Sometimes we know that as far as this row is concerned, the current case is already handled
833833 /// by a different, more general, case. When the case is irrelevant for all rows this allows us
834834 /// to skip a case entirely. This is purely an optimization. See at the top for details.
835835 relevant : bool ,
836836}
837837
838- impl < ' a , ' p , Cx : TypeCx > PatStack < ' a , ' p , Cx > {
839- fn from_pattern ( pat : & ' a DeconstructedPat < ' p , Cx > ) -> Self {
838+ impl < ' a , ' p , Cx : TypeCx > PatStack < ' p , Cx > {
839+ fn from_pattern ( pat : & ' p DeconstructedPat < ' p , Cx > ) -> Self {
840840 PatStack { pats : smallvec ! [ pat] , relevant : true }
841841 }
842842
@@ -848,17 +848,17 @@ impl<'a, 'p, Cx: TypeCx> PatStack<'a, 'p, Cx> {
848848 self . pats . len ( )
849849 }
850850
851- fn head ( & self ) -> & ' a DeconstructedPat < ' p , Cx > {
851+ fn head ( & self ) -> & ' p DeconstructedPat < ' p , Cx > {
852852 self . pats [ 0 ]
853853 }
854854
855- fn iter < ' b > ( & ' b self ) -> impl Iterator < Item = & ' a DeconstructedPat < ' p , Cx > > + Captures < ' b > {
855+ fn iter < ' b > ( & ' b self ) -> impl Iterator < Item = & ' p DeconstructedPat < ' p , Cx > > + Captures < ' b > {
856856 self . pats . iter ( ) . copied ( )
857857 }
858858
859859 // Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is
860860 // an or-pattern. Panics if `self` is empty.
861- fn expand_or_pat < ' b > ( & ' b self ) -> impl Iterator < Item = PatStack < ' a , ' p , Cx > > + Captures < ' b > {
861+ fn expand_or_pat < ' b > ( & ' b self ) -> impl Iterator < Item = PatStack < ' p , Cx > > + Captures < ' b > {
862862 self . head ( ) . flatten_or_pat ( ) . into_iter ( ) . map ( move |pat| {
863863 let mut new = self . clone ( ) ;
864864 new. pats [ 0 ] = pat;
@@ -873,7 +873,7 @@ impl<'a, 'p, Cx: TypeCx> PatStack<'a, 'p, Cx> {
873873 pcx : & PlaceCtxt < ' a , ' p , Cx > ,
874874 ctor : & Constructor < Cx > ,
875875 ctor_is_relevant : bool ,
876- ) -> PatStack < ' a , ' p , Cx > {
876+ ) -> PatStack < ' p , Cx > {
877877 // We pop the head pattern and push the new fields extracted from the arguments of
878878 // `self.head()`.
879879 let mut new_pats = self . head ( ) . specialize ( pcx, ctor) ;
@@ -886,7 +886,7 @@ impl<'a, 'p, Cx: TypeCx> PatStack<'a, 'p, Cx> {
886886 }
887887}
888888
889- impl < ' a , ' p , Cx : TypeCx > fmt:: Debug for PatStack < ' a , ' p , Cx > {
889+ impl < ' p , Cx : TypeCx > fmt:: Debug for PatStack < ' p , Cx > {
890890 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
891891 // We pretty-print similarly to the `Debug` impl of `Matrix`.
892892 write ! ( f, "+" ) ?;
@@ -899,9 +899,9 @@ impl<'a, 'p, Cx: TypeCx> fmt::Debug for PatStack<'a, 'p, Cx> {
899899
900900/// A row of the matrix.
901901#[ derive( Clone ) ]
902- struct MatrixRow < ' a , ' p , Cx : TypeCx > {
902+ struct MatrixRow < ' p , Cx : TypeCx > {
903903 // The patterns in the row.
904- pats : PatStack < ' a , ' p , Cx > ,
904+ pats : PatStack < ' p , Cx > ,
905905 /// Whether the original arm had a guard. This is inherited when specializing.
906906 is_under_guard : bool ,
907907 /// When we specialize, we remember which row of the original matrix produced a given row of the
@@ -914,7 +914,7 @@ struct MatrixRow<'a, 'p, Cx: TypeCx> {
914914 useful : bool ,
915915}
916916
917- impl < ' a , ' p , Cx : TypeCx > MatrixRow < ' a , ' p , Cx > {
917+ impl < ' a , ' p , Cx : TypeCx > MatrixRow < ' p , Cx > {
918918 fn is_empty ( & self ) -> bool {
919919 self . pats . is_empty ( )
920920 }
@@ -923,17 +923,17 @@ impl<'a, 'p, Cx: TypeCx> MatrixRow<'a, 'p, Cx> {
923923 self . pats . len ( )
924924 }
925925
926- fn head ( & self ) -> & ' a DeconstructedPat < ' p , Cx > {
926+ fn head ( & self ) -> & ' p DeconstructedPat < ' p , Cx > {
927927 self . pats . head ( )
928928 }
929929
930- fn iter < ' b > ( & ' b self ) -> impl Iterator < Item = & ' a DeconstructedPat < ' p , Cx > > + Captures < ' b > {
930+ fn iter < ' b > ( & ' b self ) -> impl Iterator < Item = & ' p DeconstructedPat < ' p , Cx > > + Captures < ' b > {
931931 self . pats . iter ( )
932932 }
933933
934934 // Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is
935935 // an or-pattern. Panics if `self` is empty.
936- fn expand_or_pat < ' b > ( & ' b self ) -> impl Iterator < Item = MatrixRow < ' a , ' p , Cx > > + Captures < ' b > {
936+ fn expand_or_pat < ' b > ( & ' b self ) -> impl Iterator < Item = MatrixRow < ' p , Cx > > + Captures < ' b > {
937937 self . pats . expand_or_pat ( ) . map ( |patstack| MatrixRow {
938938 pats : patstack,
939939 parent_row : self . parent_row ,
@@ -950,7 +950,7 @@ impl<'a, 'p, Cx: TypeCx> MatrixRow<'a, 'p, Cx> {
950950 ctor : & Constructor < Cx > ,
951951 ctor_is_relevant : bool ,
952952 parent_row : usize ,
953- ) -> MatrixRow < ' a , ' p , Cx > {
953+ ) -> MatrixRow < ' p , Cx > {
954954 MatrixRow {
955955 pats : self . pats . pop_head_constructor ( pcx, ctor, ctor_is_relevant) ,
956956 parent_row,
@@ -960,7 +960,7 @@ impl<'a, 'p, Cx: TypeCx> MatrixRow<'a, 'p, Cx> {
960960 }
961961}
962962
963- impl < ' a , ' p , Cx : TypeCx > fmt:: Debug for MatrixRow < ' a , ' p , Cx > {
963+ impl < ' p , Cx : TypeCx > fmt:: Debug for MatrixRow < ' p , Cx > {
964964 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
965965 self . pats . fmt ( f)
966966 }
@@ -977,22 +977,22 @@ impl<'a, 'p, Cx: TypeCx> fmt::Debug for MatrixRow<'a, 'p, Cx> {
977977/// specializing `(,)` and `Some` on a pattern of type `(Option<u32>, bool)`, the first column of
978978/// the matrix will correspond to `scrutinee.0.Some.0` and the second column to `scrutinee.1`.
979979#[ derive( Clone ) ]
980- struct Matrix < ' a , ' p , Cx : TypeCx > {
980+ struct Matrix < ' p , Cx : TypeCx > {
981981 /// Vector of rows. The rows must form a rectangular 2D array. Moreover, all the patterns of
982982 /// each column must have the same type. Each column corresponds to a place within the
983983 /// scrutinee.
984- rows : Vec < MatrixRow < ' a , ' p , Cx > > ,
984+ rows : Vec < MatrixRow < ' p , Cx > > ,
985985 /// Stores an extra fictitious row full of wildcards. Mostly used to keep track of the type of
986986 /// each column. This must obey the same invariants as the real rows.
987- wildcard_row : PatStack < ' a , ' p , Cx > ,
987+ wildcard_row : PatStack < ' p , Cx > ,
988988 /// Track for each column/place whether it contains a known valid value.
989989 place_validity : SmallVec < [ ValidityConstraint ; 2 ] > ,
990990}
991991
992- impl < ' a , ' p , Cx : TypeCx > Matrix < ' a , ' p , Cx > {
992+ impl < ' a , ' p , Cx : TypeCx > Matrix < ' p , Cx > {
993993 /// Pushes a new row to the matrix. If the row starts with an or-pattern, this recursively
994994 /// expands it. Internal method, prefer [`Matrix::new`].
995- fn expand_and_push ( & mut self , row : MatrixRow < ' a , ' p , Cx > ) {
995+ fn expand_and_push ( & mut self , row : MatrixRow < ' p , Cx > ) {
996996 if !row. is_empty ( ) && row. head ( ) . is_or_pat ( ) {
997997 // Expand nested or-patterns.
998998 for new_row in row. expand_or_pat ( ) {
@@ -1005,7 +1005,7 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'a, 'p, Cx> {
10051005
10061006 /// Build a new matrix from an iterator of `MatchArm`s.
10071007 fn new (
1008- wildcard_arena : & ' a TypedArena < DeconstructedPat < ' p , Cx > > ,
1008+ wildcard_arena : & ' p TypedArena < DeconstructedPat < ' p , Cx > > ,
10091009 arms : & ' a [ MatchArm < ' p , Cx > ] ,
10101010 scrut_ty : Cx :: Ty ,
10111011 scrut_validity : ValidityConstraint ,
@@ -1044,13 +1044,13 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'a, 'p, Cx> {
10441044
10451045 fn rows < ' b > (
10461046 & ' b self ,
1047- ) -> impl Iterator < Item = & ' b MatrixRow < ' a , ' p , Cx > > + Clone + DoubleEndedIterator + ExactSizeIterator
1047+ ) -> impl Iterator < Item = & ' b MatrixRow < ' p , Cx > > + Clone + DoubleEndedIterator + ExactSizeIterator
10481048 {
10491049 self . rows . iter ( )
10501050 }
10511051 fn rows_mut < ' b > (
10521052 & ' b mut self ,
1053- ) -> impl Iterator < Item = & ' b mut MatrixRow < ' a , ' p , Cx > > + DoubleEndedIterator + ExactSizeIterator
1053+ ) -> impl Iterator < Item = & ' b mut MatrixRow < ' p , Cx > > + DoubleEndedIterator + ExactSizeIterator
10541054 {
10551055 self . rows . iter_mut ( )
10561056 }
@@ -1068,7 +1068,7 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'a, 'p, Cx> {
10681068 pcx : & PlaceCtxt < ' a , ' p , Cx > ,
10691069 ctor : & Constructor < Cx > ,
10701070 ctor_is_relevant : bool ,
1071- ) -> Matrix < ' a , ' p , Cx > {
1071+ ) -> Matrix < ' p , Cx > {
10721072 let wildcard_row = self . wildcard_row . pop_head_constructor ( pcx, ctor, ctor_is_relevant) ;
10731073 let new_validity = self . place_validity [ 0 ] . specialize ( ctor) ;
10741074 let new_place_validity = std:: iter:: repeat ( new_validity)
@@ -1097,7 +1097,7 @@ impl<'a, 'p, Cx: TypeCx> Matrix<'a, 'p, Cx> {
10971097/// + _ + [_, _, tail @ ..] +
10981098/// | ✓ | ? | // column validity
10991099/// ```
1100- impl < ' a , ' p , Cx : TypeCx > fmt:: Debug for Matrix < ' a , ' p , Cx > {
1100+ impl < ' p , Cx : TypeCx > fmt:: Debug for Matrix < ' p , Cx > {
11011101 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
11021102 write ! ( f, "\n " ) ?;
11031103
@@ -1336,7 +1336,7 @@ impl<Cx: TypeCx> WitnessMatrix<Cx> {
13361336#[ instrument( level = "debug" , skip( mcx, is_top_level) , ret) ]
13371337fn compute_exhaustiveness_and_usefulness < ' a , ' p , Cx : TypeCx > (
13381338 mcx : MatchCtxt < ' a , ' p , Cx > ,
1339- matrix : & mut Matrix < ' a , ' p , Cx > ,
1339+ matrix : & mut Matrix < ' p , Cx > ,
13401340 is_top_level : bool ,
13411341) -> WitnessMatrix < Cx > {
13421342 debug_assert ! ( matrix. rows( ) . all( |r| r. len( ) == matrix. column_count( ) ) ) ;
0 commit comments