@@ -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
}
@@ -1460,8 +1446,6 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1460
1446
1461
1447
// Whether the place/column we are inspecting is known to contain valid data.
1462
1448
let place_validity = matrix. place_validity [ 0 ] ;
1463
- // For backwards compability we allow omitting some empty arms that we ideally shouldn't.
1464
- let place_validity = place_validity. allow_omitting_side_effecting_arms ( ) ;
1465
1449
1466
1450
// Analyze the constructors present in this column.
1467
1451
let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
@@ -1486,12 +1470,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1486
1470
// Whether we should report "Enum::A and Enum::C are missing" or "_ is missing".
1487
1471
let report_individual_missing_ctors = always_report_all || !all_missing;
1488
1472
// Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() =>
1489
- // split_ctors.contains(Missing)`. The converse usually holds except in the
1490
- // `MaybeInvalidButAllowOmittingArms` backwards-compatibility case.
1491
- let mut missing_ctors = split_set. missing ;
1492
- if !place_validity. allows_omitting_empty_arms ( ) {
1493
- missing_ctors. extend ( split_set. missing_empty ) ;
1494
- }
1473
+ // split_ctors.contains(Missing)`. The converse usually holds except when
1474
+ // `!place_validity.is_known_valid()`.
1475
+ let missing_ctors = split_set. missing ;
1495
1476
1496
1477
let mut ret = WitnessMatrix :: empty ( ) ;
1497
1478
for ctor in split_ctors {
0 commit comments