@@ -768,30 +768,16 @@ impl<'a, Cx: TypeCx> PlaceCtxt<'a, Cx> {
768
768
pub enum ValidityConstraint {
769
769
ValidOnly ,
770
770
MaybeInvalid ,
771
- /// Option for backwards compatibility: the place is not known to be valid but we allow omitting
772
- /// `useful && !reachable` arms anyway.
773
- MaybeInvalidButAllowOmittingArms ,
774
771
}
775
772
776
773
impl ValidityConstraint {
777
774
pub fn from_bool ( is_valid_only : bool ) -> Self {
778
775
if is_valid_only { ValidOnly } else { MaybeInvalid }
779
776
}
780
777
781
- fn allow_omitting_side_effecting_arms ( self ) -> Self {
782
- match self {
783
- MaybeInvalid | MaybeInvalidButAllowOmittingArms => MaybeInvalidButAllowOmittingArms ,
784
- // There are no side-effecting empty arms here, nothing to do.
785
- ValidOnly => ValidOnly ,
786
- }
787
- }
788
-
789
778
fn is_known_valid ( self ) -> bool {
790
779
matches ! ( self , ValidOnly )
791
780
}
792
- fn allows_omitting_empty_arms ( self ) -> bool {
793
- matches ! ( self , ValidOnly | MaybeInvalidButAllowOmittingArms )
794
- }
795
781
796
782
/// If the place has validity given by `self` and we read that the value at the place has
797
783
/// constructor `ctor`, this computes what we can assume about the validity of the constructor
@@ -814,7 +800,7 @@ impl fmt::Display for ValidityConstraint {
814
800
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
815
801
let s = match self {
816
802
ValidOnly => "✓" ,
817
- MaybeInvalid | MaybeInvalidButAllowOmittingArms => "?" ,
803
+ MaybeInvalid => "?" ,
818
804
} ;
819
805
write ! ( f, "{s}" )
820
806
}
@@ -1451,8 +1437,6 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1451
1437
1452
1438
// Whether the place/column we are inspecting is known to contain valid data.
1453
1439
let place_validity = matrix. place_validity [ 0 ] ;
1454
- // For backwards compability we allow omitting some empty arms that we ideally shouldn't.
1455
- let place_validity = place_validity. allow_omitting_side_effecting_arms ( ) ;
1456
1440
1457
1441
// Analyze the constructors present in this column.
1458
1442
let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
@@ -1477,12 +1461,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1477
1461
// Whether we should report "Enum::A and Enum::C are missing" or "_ is missing".
1478
1462
let report_individual_missing_ctors = always_report_all || !all_missing;
1479
1463
// Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() =>
1480
- // split_ctors.contains(Missing)`. The converse usually holds except in the
1481
- // `MaybeInvalidButAllowOmittingArms` backwards-compatibility case.
1482
- let mut missing_ctors = split_set. missing ;
1483
- if !place_validity. allows_omitting_empty_arms ( ) {
1484
- missing_ctors. extend ( split_set. missing_empty ) ;
1485
- }
1464
+ // split_ctors.contains(Missing)`. The converse usually holds except when
1465
+ // `!place_validity.is_known_valid()`.
1466
+ let missing_ctors = split_set. missing ;
1486
1467
1487
1468
let mut ret = WitnessMatrix :: empty ( ) ;
1488
1469
for ctor in split_ctors {
0 commit comments