@@ -767,30 +767,16 @@ impl<'a, 'p, Cx: TypeCx> PlaceCtxt<'a, 'p, Cx> {
767767pub enum ValidityConstraint {
768768 ValidOnly ,
769769 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 ,
773770}
774771
775772impl ValidityConstraint {
776773 pub fn from_bool ( is_valid_only : bool ) -> Self {
777774 if is_valid_only { ValidOnly } else { MaybeInvalid }
778775 }
779776
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-
788777 fn is_known_valid ( self ) -> bool {
789778 matches ! ( self , ValidOnly )
790779 }
791- fn allows_omitting_empty_arms ( self ) -> bool {
792- matches ! ( self , ValidOnly | MaybeInvalidButAllowOmittingArms )
793- }
794780
795781 /// If the place has validity given by `self` and we read that the value at the place has
796782 /// constructor `ctor`, this computes what we can assume about the validity of the constructor
@@ -813,7 +799,7 @@ impl fmt::Display for ValidityConstraint {
813799 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
814800 let s = match self {
815801 ValidOnly => "✓" ,
816- MaybeInvalid | MaybeInvalidButAllowOmittingArms => "?" ,
802+ MaybeInvalid => "?" ,
817803 } ;
818804 write ! ( f, "{s}" )
819805 }
@@ -1378,8 +1364,6 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
13781364
13791365 // Whether the place/column we are inspecting is known to contain valid data.
13801366 let place_validity = matrix. place_validity [ 0 ] ;
1381- // For backwards compability we allow omitting some empty arms that we ideally shouldn't.
1382- let place_validity = place_validity. allow_omitting_side_effecting_arms ( ) ;
13831367
13841368 // Analyze the constructors present in this column.
13851369 let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
@@ -1404,12 +1388,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
14041388 // Whether we should report "Enum::A and Enum::C are missing" or "_ is missing".
14051389 let report_individual_missing_ctors = always_report_all || !all_missing;
14061390 // Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() =>
1407- // split_ctors.contains(Missing)`. The converse usually holds except in the
1408- // `MaybeInvalidButAllowOmittingArms` backwards-compatibility case.
1409- let mut missing_ctors = split_set. missing ;
1410- if !place_validity. allows_omitting_empty_arms ( ) {
1411- missing_ctors. extend ( split_set. missing_empty ) ;
1412- }
1391+ // split_ctors.contains(Missing)`. The converse usually holds except when
1392+ // `!place_validity.is_known_valid()`.
1393+ let missing_ctors = split_set. missing ;
14131394
14141395 let mut ret = WitnessMatrix :: empty ( ) ;
14151396 for ctor in split_ctors {
0 commit comments