@@ -741,25 +741,25 @@ 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 ( & self , ctor : & Constructor < Cx > ) -> & [ Cx :: Ty ] {
756
- self . mcx . tycx . ctor_sub_tys ( ctor, self . ty )
756
+ self . cx . ctor_sub_tys ( ctor, self . ty )
757
757
}
758
758
fn ctors_for_ty ( & self ) -> Result < ConstructorSet < Cx > , Cx :: Error > {
759
- self . mcx . tycx . ctors_for_ty ( self . ty )
759
+ self . cx . ctors_for_ty ( self . ty )
760
760
}
761
761
fn wild_from_ctor ( & self , ctor : Constructor < Cx > ) -> WitnessPat < Cx > {
762
- WitnessPat :: wild_from_ctor ( self . mcx . tycx , ctor, self . ty . clone ( ) )
762
+ WitnessPat :: wild_from_ctor ( self . cx , ctor, self . ty . clone ( ) )
763
763
}
764
764
}
765
765
@@ -1077,7 +1077,7 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> {
1077
1077
wildcard_row_is_relevant : self . wildcard_row_is_relevant && ctor_is_relevant,
1078
1078
} ;
1079
1079
for ( i, row) in self . rows ( ) . enumerate ( ) {
1080
- if ctor. is_covered_by ( pcx. mcx . tycx , row. head ( ) . ctor ( ) ) {
1080
+ if ctor. is_covered_by ( pcx. cx , row. head ( ) . ctor ( ) ) {
1081
1081
let new_row = row. pop_head_constructor ( ctor, arity, ctor_is_relevant, i) ;
1082
1082
matrix. expand_and_push ( new_row) ;
1083
1083
}
@@ -1437,7 +1437,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1437
1437
} ;
1438
1438
1439
1439
debug ! ( "ty: {ty:?}" ) ;
1440
- let pcx = & PlaceCtxt { mcx, ty : & ty } ;
1440
+ let pcx = & PlaceCtxt { cx : mcx. tycx , ty : & ty } ;
1441
1441
let ctors_for_ty = pcx. ctors_for_ty ( ) ?;
1442
1442
1443
1443
// Whether the place/column we are inspecting is known to contain valid data.
0 commit comments