@@ -163,7 +163,6 @@ use self::MaybeInfiniteInt::*;
163
163
use self :: SliceKind :: * ;
164
164
165
165
use crate :: index;
166
- use crate :: usefulness:: PlaceCtxt ;
167
166
use crate :: TypeCx ;
168
167
169
168
/// Whether we have seen a constructor in the column or not.
@@ -818,21 +817,20 @@ impl<Cx: TypeCx> Constructor<Cx> {
818
817
819
818
/// The number of fields for this constructor. This must be kept in sync with
820
819
/// `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 )
823
822
}
824
823
825
824
/// Returns whether `self` is covered by `other`, i.e. whether `self` is a subset of `other`.
826
825
/// For the simple cases, this is simply checking for equality. For the "grouped" constructors,
827
826
/// this checks for inclusion.
828
827
// We inline because this has a single call site in `Matrix::specialize_constructor`.
829
828
#[ 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 {
831
830
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
+ }
836
834
// Wildcards cover anything
837
835
( _, Wildcard ) => true ,
838
836
// Only a wildcard pattern can match these special constructors.
@@ -873,7 +871,7 @@ impl<Cx: TypeCx> Constructor<Cx> {
873
871
( Opaque ( self_id) , Opaque ( other_id) ) => self_id == other_id,
874
872
( Opaque ( ..) , _) | ( _, Opaque ( ..) ) => false ,
875
873
876
- _ => pcx . mcx . tycx . bug ( format_args ! (
874
+ _ => cx . bug ( format_args ! (
877
875
"trying to compare incompatible constructors {self:?} and {other:?}"
878
876
) ) ,
879
877
}
@@ -950,10 +948,10 @@ pub enum ConstructorSet<Cx: TypeCx> {
950
948
/// of the `ConstructorSet` for the type, yet if we forgot to include them in `present` we would be
951
949
/// ignoring any row with `Opaque`s in the algorithm. Hence the importance of point 4.
952
950
#[ 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 > > ,
957
955
}
958
956
959
957
impl < Cx : TypeCx > ConstructorSet < Cx > {
@@ -962,7 +960,7 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
962
960
/// or slices. This can get subtle; see [`SplitConstructorSet`] for details of this operation
963
961
/// and its invariants.
964
962
#[ instrument( level = "debug" , skip( self , ctors) , ret) ]
965
- pub ( crate ) fn split < ' a > (
963
+ pub fn split < ' a > (
966
964
& self ,
967
965
ctors : impl Iterator < Item = & ' a Constructor < Cx > > + Clone ,
968
966
) -> SplitConstructorSet < Cx >
0 commit comments