@@ -736,15 +736,13 @@ pub(crate) struct PlaceCtxt<'a, 'p, Cx: TypeCx> {
736736 pub ( crate ) mcx : MatchCtxt < ' a , ' p , Cx > ,
737737 /// Type of the place under investigation.
738738 pub ( crate ) ty : Cx :: Ty ,
739- /// Whether the place is the original scrutinee place, as opposed to a subplace of it.
740- pub ( crate ) is_scrutinee : bool ,
741739}
742740
743741impl < ' a , ' p , Cx : TypeCx > PlaceCtxt < ' a , ' p , Cx > {
744742 /// A `PlaceCtxt` when code other than `is_useful` needs one.
745743 #[ cfg_attr( not( feature = "rustc" ) , allow( dead_code) ) ]
746744 pub ( crate ) fn new_dummy ( mcx : MatchCtxt < ' a , ' p , Cx > , ty : Cx :: Ty ) -> Self {
747- PlaceCtxt { mcx, ty, is_scrutinee : false }
745+ PlaceCtxt { mcx, ty }
748746 }
749747
750748 pub ( crate ) fn ctor_arity ( & self , ctor : & Constructor < Cx > ) -> usize {
@@ -767,30 +765,16 @@ impl<'a, 'p, Cx: TypeCx> PlaceCtxt<'a, 'p, Cx> {
767765pub enum ValidityConstraint {
768766 ValidOnly ,
769767 MaybeInvalid ,
770- /// Option for backwards compatibility: the place is not known to be valid but we allow omitting
771- /// `useful && !reachable` arms anyway.
772- MaybeInvalidButAllowOmittingArms ,
773768}
774769
775770impl ValidityConstraint {
776771 pub fn from_bool ( is_valid_only : bool ) -> Self {
777772 if is_valid_only { ValidOnly } else { MaybeInvalid }
778773 }
779774
780- fn allow_omitting_side_effecting_arms ( self ) -> Self {
781- match self {
782- MaybeInvalid | MaybeInvalidButAllowOmittingArms => MaybeInvalidButAllowOmittingArms ,
783- // There are no side-effecting empty arms here, nothing to do.
784- ValidOnly => ValidOnly ,
785- }
786- }
787-
788775 fn is_known_valid ( self ) -> bool {
789776 matches ! ( self , ValidOnly )
790777 }
791- fn allows_omitting_empty_arms ( self ) -> bool {
792- matches ! ( self , ValidOnly | MaybeInvalidButAllowOmittingArms )
793- }
794778
795779 /// If the place has validity given by `self` and we read that the value at the place has
796780 /// constructor `ctor`, this computes what we can assume about the validity of the constructor
@@ -813,7 +797,7 @@ impl fmt::Display for ValidityConstraint {
813797 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
814798 let s = match self {
815799 ValidOnly => "✓" ,
816- MaybeInvalid | MaybeInvalidButAllowOmittingArms => "?" ,
800+ MaybeInvalid => "?" ,
817801 } ;
818802 write ! ( f, "{s}" )
819803 }
@@ -1374,7 +1358,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
13741358 } ;
13751359
13761360 debug ! ( "ty: {ty:?}" ) ;
1377- let pcx = & PlaceCtxt { mcx, ty, is_scrutinee : is_top_level } ;
1361+ let pcx = & PlaceCtxt { mcx, ty } ;
13781362 let ctors_for_ty = pcx. ctors_for_ty ( ) ;
13791363 // Whether the place/column we are inspecting is known to contain valid data.
13801364 let place_validity = matrix. place_validity [ 0 ] ;
@@ -1390,7 +1374,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
13901374
13911375 // Analyze the constructors present in this column.
13921376 let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
1393- let split_set = ctors_for_ty. split ( pcx , ctors) ;
1377+ let split_set = ctors_for_ty. split ( ctors) ;
13941378 let all_missing = split_set. present . is_empty ( ) ;
13951379 // Build the set of constructors we will specialize with. It must cover the whole type.
13961380 let mut split_ctors = split_set. present ;
0 commit comments