@@ -767,30 +767,16 @@ impl<'a, 'p, Cx: TypeCx> PlaceCtxt<'a, 'p, Cx> {
767
767
pub enum ValidityConstraint {
768
768
ValidOnly ,
769
769
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 ,
773
770
}
774
771
775
772
impl ValidityConstraint {
776
773
pub fn from_bool ( is_valid_only : bool ) -> Self {
777
774
if is_valid_only { ValidOnly } else { MaybeInvalid }
778
775
}
779
776
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
-
788
777
fn is_known_valid ( self ) -> bool {
789
778
matches ! ( self , ValidOnly )
790
779
}
791
- fn allows_omitting_empty_arms ( self ) -> bool {
792
- matches ! ( self , ValidOnly | MaybeInvalidButAllowOmittingArms )
793
- }
794
780
795
781
/// If the place has validity given by `self` and we read that the value at the place has
796
782
/// constructor `ctor`, this computes what we can assume about the validity of the constructor
@@ -813,7 +799,7 @@ impl fmt::Display for ValidityConstraint {
813
799
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
814
800
let s = match self {
815
801
ValidOnly => "✓" ,
816
- MaybeInvalid | MaybeInvalidButAllowOmittingArms => "?" ,
802
+ MaybeInvalid => "?" ,
817
803
} ;
818
804
write ! ( f, "{s}" )
819
805
}
@@ -1378,8 +1364,6 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1378
1364
1379
1365
// Whether the place/column we are inspecting is known to contain valid data.
1380
1366
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 ( ) ;
1383
1367
1384
1368
// Analyze the constructors present in this column.
1385
1369
let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
@@ -1404,12 +1388,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1404
1388
// Whether we should report "Enum::A and Enum::C are missing" or "_ is missing".
1405
1389
let report_individual_missing_ctors = always_report_all || !all_missing;
1406
1390
// 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 ;
1413
1394
1414
1395
let mut ret = WitnessMatrix :: empty ( ) ;
1415
1396
for ctor in split_ctors {
0 commit comments