@@ -736,15 +736,13 @@ pub(crate) struct PlaceCtxt<'a, 'p, Cx: TypeCx> {
736
736
pub ( crate ) mcx : MatchCtxt < ' a , ' p , Cx > ,
737
737
/// Type of the place under investigation.
738
738
pub ( crate ) ty : Cx :: Ty ,
739
- /// Whether the place is the original scrutinee place, as opposed to a subplace of it.
740
- pub ( crate ) is_scrutinee : bool ,
741
739
}
742
740
743
741
impl < ' a , ' p , Cx : TypeCx > PlaceCtxt < ' a , ' p , Cx > {
744
742
/// A `PlaceCtxt` when code other than `is_useful` needs one.
745
743
#[ cfg_attr( not( feature = "rustc" ) , allow( dead_code) ) ]
746
744
pub ( crate ) fn new_dummy ( mcx : MatchCtxt < ' a , ' p , Cx > , ty : Cx :: Ty ) -> Self {
747
- PlaceCtxt { mcx, ty, is_scrutinee : false }
745
+ PlaceCtxt { mcx, ty }
748
746
}
749
747
750
748
pub ( crate ) fn ctor_arity ( & self , ctor : & Constructor < Cx > ) -> usize {
@@ -767,30 +765,16 @@ impl<'a, 'p, Cx: TypeCx> PlaceCtxt<'a, 'p, Cx> {
767
765
pub enum ValidityConstraint {
768
766
ValidOnly ,
769
767
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
768
}
774
769
775
770
impl ValidityConstraint {
776
771
pub fn from_bool ( is_valid_only : bool ) -> Self {
777
772
if is_valid_only { ValidOnly } else { MaybeInvalid }
778
773
}
779
774
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
775
fn is_known_valid ( self ) -> bool {
789
776
matches ! ( self , ValidOnly )
790
777
}
791
- fn allows_omitting_empty_arms ( self ) -> bool {
792
- matches ! ( self , ValidOnly | MaybeInvalidButAllowOmittingArms )
793
- }
794
778
795
779
/// If the place has validity given by `self` and we read that the value at the place has
796
780
/// constructor `ctor`, this computes what we can assume about the validity of the constructor
@@ -813,7 +797,7 @@ impl fmt::Display for ValidityConstraint {
813
797
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
814
798
let s = match self {
815
799
ValidOnly => "✓" ,
816
- MaybeInvalid | MaybeInvalidButAllowOmittingArms => "?" ,
800
+ MaybeInvalid => "?" ,
817
801
} ;
818
802
write ! ( f, "{s}" )
819
803
}
@@ -1374,7 +1358,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1374
1358
} ;
1375
1359
1376
1360
debug ! ( "ty: {ty:?}" ) ;
1377
- let pcx = & PlaceCtxt { mcx, ty, is_scrutinee : is_top_level } ;
1361
+ let pcx = & PlaceCtxt { mcx, ty } ;
1378
1362
let ctors_for_ty = pcx. ctors_for_ty ( ) ;
1379
1363
// Whether the place/column we are inspecting is known to contain valid data.
1380
1364
let place_validity = matrix. place_validity [ 0 ] ;
@@ -1390,7 +1374,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>(
1390
1374
1391
1375
// Analyze the constructors present in this column.
1392
1376
let ctors = matrix. heads ( ) . map ( |p| p. ctor ( ) ) ;
1393
- let split_set = ctors_for_ty. split ( pcx , ctors) ;
1377
+ let split_set = ctors_for_ty. split ( ctors) ;
1394
1378
let all_missing = split_set. present . is_empty ( ) ;
1395
1379
// Build the set of constructors we will specialize with. It must cover the whole type.
1396
1380
let mut split_ctors = split_set. present ;
0 commit comments