@@ -745,15 +745,15 @@ impl<'a, Cx: TypeCx> Clone for UsefulnessCtxt<'a, Cx> {
745
745
746
746
/// Context that provides information local to a place under investigation.
747
747
struct PlaceCtxt < ' a , Cx : TypeCx > {
748
- mcx : UsefulnessCtxt < ' a , Cx > ,
748
+ cx : & ' a Cx ,
749
749
/// Type of the place under investigation.
750
750
ty : & ' a Cx :: Ty ,
751
751
}
752
752
753
753
impl < ' a , Cx : TypeCx > Copy for PlaceCtxt < ' a , Cx > { }
754
754
impl < ' a , Cx : TypeCx > Clone for PlaceCtxt < ' a , Cx > {
755
755
fn clone ( & self ) -> Self {
756
- Self { mcx : self . mcx , ty : self . ty }
756
+ Self { cx : self . cx , ty : self . ty }
757
757
}
758
758
}
759
759
@@ -765,19 +765,19 @@ impl<'a, Cx: TypeCx> fmt::Debug for PlaceCtxt<'a, Cx> {
765
765
766
766
impl < ' a , Cx : TypeCx > PlaceCtxt < ' a , Cx > {
767
767
fn ctor_arity ( & self , ctor : & Constructor < Cx > ) -> usize {
768
- self . mcx . tycx . ctor_arity ( ctor, self . ty )
768
+ self . cx . ctor_arity ( ctor, self . ty )
769
769
}
770
770
fn ctor_sub_tys (
771
771
& ' a self ,
772
772
ctor : & ' a Constructor < Cx > ,
773
773
) -> impl Iterator < Item = Cx :: Ty > + ExactSizeIterator + Captures < ' a > {
774
- self . mcx . tycx . ctor_sub_tys ( ctor, self . ty )
774
+ self . cx . ctor_sub_tys ( ctor, self . ty )
775
775
}
776
776
fn ctors_for_ty ( & self ) -> Result < ConstructorSet < Cx > , Cx :: Error > {
777
- self . mcx . tycx . ctors_for_ty ( self . ty )
777
+ self . cx . ctors_for_ty ( self . ty )
778
778
}
779
779
fn wild_from_ctor ( & self , ctor : Constructor < Cx > ) -> WitnessPat < Cx > {
780
- WitnessPat :: wild_from_ctor ( self . mcx . tycx , ctor, self . ty . clone ( ) )
780
+ WitnessPat :: wild_from_ctor ( self . cx , ctor, self . ty . clone ( ) )
781
781
}
782
782
}
783
783
@@ -1098,7 +1098,7 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> {
1098
1098
wildcard_row_is_relevant : self . wildcard_row_is_relevant && ctor_is_relevant,
1099
1099
} ;
1100
1100
for ( i, row) in self . rows ( ) . enumerate ( ) {
1101
- if ctor. is_covered_by ( pcx. mcx . tycx , row. head ( ) . ctor ( ) ) {
1101
+ if ctor. is_covered_by ( pcx. cx , row. head ( ) . ctor ( ) ) {
1102
1102
let new_row = row. pop_head_constructor ( ctor, arity, ctor_is_relevant, i) ;
1103
1103
matrix. expand_and_push ( new_row) ;
1104
1104
}
@@ -1478,7 +1478,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1478
1478
} ;
1479
1479
1480
1480
debug ! ( "ty: {ty:?}" ) ;
1481
- let pcx = & PlaceCtxt { mcx, ty : & ty } ;
1481
+ let pcx = & PlaceCtxt { cx : mcx. tycx , ty : & ty } ;
1482
1482
let ctors_for_ty = pcx. ctors_for_ty ( ) ?;
1483
1483
1484
1484
// Whether the place/column we are inspecting is known to contain valid data.
0 commit comments