@@ -163,7 +163,6 @@ use self::MaybeInfiniteInt::*;
163163use self :: SliceKind :: * ;
164164
165165use crate :: index;
166- use crate :: usefulness:: PlaceCtxt ;
167166use crate :: TypeCx ;
168167
169168/// Whether we have seen a constructor in the column or not.
@@ -818,21 +817,20 @@ impl<Cx: TypeCx> Constructor<Cx> {
818817
819818 /// The number of fields for this constructor. This must be kept in sync with
820819 /// `Fields::wildcards`.
821- pub ( crate ) fn arity ( & self , pcx : & PlaceCtxt < ' _ , Cx > ) -> usize {
822- pcx . ctor_arity ( self )
820+ pub ( crate ) fn arity ( & self , cx : & Cx , ty : & Cx :: Ty ) -> usize {
821+ cx . ctor_arity ( self , ty )
823822 }
824823
825824 /// Returns whether `self` is covered by `other`, i.e. whether `self` is a subset of `other`.
826825 /// For the simple cases, this is simply checking for equality. For the "grouped" constructors,
827826 /// this checks for inclusion.
828827 // We inline because this has a single call site in `Matrix::specialize_constructor`.
829828 #[ inline]
830- pub ( crate ) fn is_covered_by ( & self , pcx : & PlaceCtxt < ' _ , Cx > , other : & Self ) -> bool {
829+ pub ( crate ) fn is_covered_by ( & self , cx : & Cx , other : & Self ) -> bool {
831830 match ( self , other) {
832- ( Wildcard , _) => pcx
833- . mcx
834- . tycx
835- . bug ( format_args ! ( "Constructor splitting should not have returned `Wildcard`" ) ) ,
831+ ( Wildcard , _) => {
832+ cx. bug ( format_args ! ( "Constructor splitting should not have returned `Wildcard`" ) )
833+ }
836834 // Wildcards cover anything
837835 ( _, Wildcard ) => true ,
838836 // Only a wildcard pattern can match these special constructors.
@@ -873,7 +871,7 @@ impl<Cx: TypeCx> Constructor<Cx> {
873871 ( Opaque ( self_id) , Opaque ( other_id) ) => self_id == other_id,
874872 ( Opaque ( ..) , _) | ( _, Opaque ( ..) ) => false ,
875873
876- _ => pcx . mcx . tycx . bug ( format_args ! (
874+ _ => cx . bug ( format_args ! (
877875 "trying to compare incompatible constructors {self:?} and {other:?}"
878876 ) ) ,
879877 }
@@ -950,10 +948,10 @@ pub enum ConstructorSet<Cx: TypeCx> {
950948/// of the `ConstructorSet` for the type, yet if we forgot to include them in `present` we would be
951949/// ignoring any row with `Opaque`s in the algorithm. Hence the importance of point 4.
952950#[ derive( Debug ) ]
953- pub ( crate ) struct SplitConstructorSet < Cx : TypeCx > {
954- pub ( crate ) present : SmallVec < [ Constructor < Cx > ; 1 ] > ,
955- pub ( crate ) missing : Vec < Constructor < Cx > > ,
956- pub ( crate ) missing_empty : Vec < Constructor < Cx > > ,
951+ pub struct SplitConstructorSet < Cx : TypeCx > {
952+ pub present : SmallVec < [ Constructor < Cx > ; 1 ] > ,
953+ pub missing : Vec < Constructor < Cx > > ,
954+ pub missing_empty : Vec < Constructor < Cx > > ,
957955}
958956
959957impl < Cx : TypeCx > ConstructorSet < Cx > {
@@ -962,7 +960,7 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
962960 /// or slices. This can get subtle; see [`SplitConstructorSet`] for details of this operation
963961 /// and its invariants.
964962 #[ instrument( level = "debug" , skip( self , ctors) , ret) ]
965- pub ( crate ) fn split < ' a > (
963+ pub fn split < ' a > (
966964 & self ,
967965 ctors : impl Iterator < Item = & ' a Constructor < Cx > > + Clone ,
968966 ) -> SplitConstructorSet < Cx >
0 commit comments