@@ -741,28 +741,28 @@ pub struct UsefulnessCtxt<'a, Cx: TypeCx> {
741
741
#[ derive( derivative:: Derivative ) ]
742
742
#[ derivative( Debug ( bound = "" ) , Clone ( bound = "" ) , Copy ( bound = "" ) ) ]
743
743
struct PlaceCtxt < ' a , Cx : TypeCx > {
744
- #[ derivative( Debug = "ignore" ) ]
745
- pub ( crate ) mcx : UsefulnessCtxt < ' a , Cx > ,
744
+ #[ derivative( Debug = "ignore" , Clone ( clone_with = "Clone::clone" ) ) ] // See rust-derivative#90
745
+ pub ( crate ) cx : & ' a Cx ,
746
746
/// Type of the place under investigation.
747
747
#[ derivative( Clone ( clone_with = "Clone::clone" ) ) ] // See rust-derivative#90
748
748
pub ( crate ) ty : & ' a Cx :: Ty ,
749
749
}
750
750
751
751
impl < ' a , Cx : TypeCx > PlaceCtxt < ' a , Cx > {
752
752
fn ctor_arity ( & self , ctor : & Constructor < Cx > ) -> usize {
753
- self . mcx . tycx . ctor_arity ( ctor, self . ty )
753
+ self . cx . ctor_arity ( ctor, self . ty )
754
754
}
755
755
fn ctor_sub_tys (
756
756
& ' a self ,
757
757
ctor : & ' a Constructor < Cx > ,
758
758
) -> impl Iterator < Item = Cx :: Ty > + ExactSizeIterator + Captures < ' a > {
759
- self . mcx . tycx . ctor_sub_tys ( ctor, self . ty )
759
+ self . cx . ctor_sub_tys ( ctor, self . ty )
760
760
}
761
761
fn ctors_for_ty ( & self ) -> Result < ConstructorSet < Cx > , Cx :: Error > {
762
- self . mcx . tycx . ctors_for_ty ( self . ty )
762
+ self . cx . ctors_for_ty ( self . ty )
763
763
}
764
764
fn wild_from_ctor ( & self , ctor : Constructor < Cx > ) -> WitnessPat < Cx > {
765
- WitnessPat :: wild_from_ctor ( self . mcx . tycx , ctor, self . ty . clone ( ) )
765
+ WitnessPat :: wild_from_ctor ( self . cx , ctor, self . ty . clone ( ) )
766
766
}
767
767
}
768
768
@@ -1079,7 +1079,7 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> {
1079
1079
wildcard_row_is_relevant : self . wildcard_row_is_relevant && ctor_is_relevant,
1080
1080
} ;
1081
1081
for ( i, row) in self . rows ( ) . enumerate ( ) {
1082
- if ctor. is_covered_by ( pcx. mcx . tycx , row. head ( ) . ctor ( ) ) {
1082
+ if ctor. is_covered_by ( pcx. cx , row. head ( ) . ctor ( ) ) {
1083
1083
let new_row = row. pop_head_constructor ( ctor, arity, ctor_is_relevant, i) ;
1084
1084
matrix. expand_and_push ( new_row) ;
1085
1085
}
@@ -1439,7 +1439,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1439
1439
} ;
1440
1440
1441
1441
debug ! ( "ty: {ty:?}" ) ;
1442
- let pcx = & PlaceCtxt { mcx, ty : & ty } ;
1442
+ let pcx = & PlaceCtxt { cx : mcx. tycx , ty : & ty } ;
1443
1443
let ctors_for_ty = pcx. ctors_for_ty ( ) ?;
1444
1444
1445
1445
// Whether the place/column we are inspecting is known to contain valid data.
0 commit comments