@@ -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
}
@@ -1373,8 +1359,6 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1373
1359
1374
1360
// Whether the place/column we are inspecting is known to contain valid data.
1375
1361
let place_validity = matrix. place_validity [ 0 ] ;
1376
- // For backwards compability we allow omitting some empty arms that we ideally shouldn't.
1377
- let place_validity = place_validity. allow_omitting_side_effecting_arms ( ) ;
1378
1362
1379
1363
// Analyze the constructors present in this column.
1380
1364
let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
@@ -1399,12 +1383,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1399
1383
// Whether we should report "Enum::A and Enum::C are missing" or "_ is missing".
1400
1384
let report_individual_missing_ctors = always_report_all || !all_missing;
1401
1385
// Which constructors are considered missing. We ensure that `!missing_ctors.is_empty() =>
1402
- // split_ctors.contains(Missing)`. The converse usually holds except in the
1403
- // `MaybeInvalidButAllowOmittingArms` backwards-compatibility case.
1404
- let mut missing_ctors = split_set. missing ;
1405
- if !place_validity. allows_omitting_empty_arms ( ) {
1406
- missing_ctors. extend ( split_set. missing_empty ) ;
1407
- }
1386
+ // split_ctors.contains(Missing)`. The converse usually holds except when
1387
+ // `!place_validity.is_known_valid()`.
1388
+ let missing_ctors = split_set. missing ;
1408
1389
1409
1390
let mut ret = WitnessMatrix :: empty ( ) ;
1410
1391
for ctor in split_ctors {
0 commit comments