@@ -1037,7 +1037,7 @@ crate struct PredicateInner<'tcx> {
10371037}
10381038
10391039#[ cfg( target_arch = "x86_64" ) ]
1040- static_assert_size ! ( PredicateInner <' _>, 48 ) ;
1040+ static_assert_size ! ( PredicateInner <' _>, 40 ) ;
10411041
10421042#[ derive( Clone , Copy , Lift ) ]
10431043pub struct Predicate < ' tcx > {
@@ -1074,10 +1074,6 @@ impl<'tcx> Predicate<'tcx> {
10741074 pub fn skip_binders ( self ) -> PredicateAtom < ' tcx > {
10751075 match self . kind ( ) {
10761076 & PredicateKind :: ForAll ( binder) => binder. skip_binder ( ) ,
1077- & PredicateKind :: Atom ( atom) => {
1078- debug_assert ! ( !atom. has_escaping_bound_vars( ) ) ;
1079- atom
1080- }
10811077 }
10821078 }
10831079
@@ -1090,7 +1086,6 @@ impl<'tcx> Predicate<'tcx> {
10901086 pub fn skip_binders_unchecked ( self ) -> PredicateAtom < ' tcx > {
10911087 match self . kind ( ) {
10921088 & PredicateKind :: ForAll ( binder) => binder. skip_binder ( ) ,
1093- & PredicateKind :: Atom ( atom) => atom,
10941089 }
10951090 }
10961091
@@ -1099,19 +1094,14 @@ impl<'tcx> Predicate<'tcx> {
10991094 pub fn bound_atom ( self ) -> Binder < PredicateAtom < ' tcx > > {
11001095 match self . kind ( ) {
11011096 & PredicateKind :: ForAll ( binder) => binder,
1102- & PredicateKind :: Atom ( atom) => {
1103- debug_assert ! ( !atom. has_escaping_bound_vars( ) ) ;
1104- Binder :: dummy ( atom)
1105- }
11061097 }
11071098 }
11081099
11091100 /// Allows using a `Binder<PredicateAtom<'tcx>>` even if the given predicate previously
11101101 /// contained unbound variables by shifting these variables outwards.
1111- pub fn bound_atom_with_opt_escaping ( self , tcx : TyCtxt < ' tcx > ) -> Binder < PredicateAtom < ' tcx > > {
1102+ pub fn bound_atom_with_opt_escaping ( self , _tcx : TyCtxt < ' tcx > ) -> Binder < PredicateAtom < ' tcx > > {
11121103 match self . kind ( ) {
11131104 & PredicateKind :: ForAll ( binder) => binder,
1114- & PredicateKind :: Atom ( atom) => Binder :: wrap_nonbinding ( tcx, atom) ,
11151105 }
11161106 }
11171107}
@@ -1136,7 +1126,6 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Predicate<'tcx> {
11361126pub enum PredicateKind < ' tcx > {
11371127 /// `for<'a>: ...`
11381128 ForAll ( Binder < PredicateAtom < ' tcx > > ) ,
1139- Atom ( PredicateAtom < ' tcx > ) ,
11401129}
11411130
11421131#[ derive( Clone , Copy , PartialEq , Eq , Hash , TyEncodable , TyDecodable ) ]
@@ -1189,16 +1178,8 @@ pub enum PredicateAtom<'tcx> {
11891178
11901179impl < ' tcx > Binder < PredicateAtom < ' tcx > > {
11911180 /// Wraps `self` with the given qualifier if this predicate has any unbound variables.
1192- pub fn potentially_quantified (
1193- self ,
1194- tcx : TyCtxt < ' tcx > ,
1195- qualifier : impl FnOnce ( Binder < PredicateAtom < ' tcx > > ) -> PredicateKind < ' tcx > ,
1196- ) -> Predicate < ' tcx > {
1197- match self . no_bound_vars ( ) {
1198- Some ( atom) => PredicateKind :: Atom ( atom) ,
1199- None => qualifier ( self ) ,
1200- }
1201- . to_predicate ( tcx)
1181+ pub fn potentially_quantified ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1182+ PredicateKind :: ForAll ( self ) . to_predicate ( tcx)
12021183 }
12031184}
12041185
@@ -1289,11 +1270,7 @@ impl<'tcx> Predicate<'tcx> {
12891270 let substs = trait_ref. skip_binder ( ) . substs ;
12901271 let pred = self . skip_binders ( ) ;
12911272 let new = pred. subst ( tcx, substs) ;
1292- if new != pred {
1293- ty:: Binder :: bind ( new) . potentially_quantified ( tcx, PredicateKind :: ForAll )
1294- } else {
1295- self
1296- }
1273+ if new != pred { ty:: Binder :: bind ( new) . potentially_quantified ( tcx) } else { self }
12971274 }
12981275}
12991276
@@ -1425,7 +1402,7 @@ impl ToPredicate<'tcx> for PredicateAtom<'tcx> {
14251402 #[ inline( always) ]
14261403 fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
14271404 debug_assert ! ( !self . has_escaping_bound_vars( ) , "escaping bound vars for {:?}" , self ) ;
1428- tcx. mk_predicate ( PredicateKind :: Atom ( self ) )
1405+ tcx. mk_predicate ( PredicateKind :: ForAll ( Binder :: dummy ( self ) ) )
14291406 }
14301407}
14311408
@@ -1450,27 +1427,25 @@ impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<PolyTraitPredicate<'tcx>> {
14501427 fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
14511428 self . value
14521429 . map_bound ( |value| PredicateAtom :: Trait ( value, self . constness ) )
1453- . potentially_quantified ( tcx, PredicateKind :: ForAll )
1430+ . potentially_quantified ( tcx)
14541431 }
14551432}
14561433
14571434impl < ' tcx > ToPredicate < ' tcx > for PolyRegionOutlivesPredicate < ' tcx > {
14581435 fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1459- self . map_bound ( PredicateAtom :: RegionOutlives )
1460- . potentially_quantified ( tcx, PredicateKind :: ForAll )
1436+ self . map_bound ( PredicateAtom :: RegionOutlives ) . potentially_quantified ( tcx)
14611437 }
14621438}
14631439
14641440impl < ' tcx > ToPredicate < ' tcx > for PolyTypeOutlivesPredicate < ' tcx > {
14651441 fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1466- self . map_bound ( PredicateAtom :: TypeOutlives )
1467- . potentially_quantified ( tcx, PredicateKind :: ForAll )
1442+ self . map_bound ( PredicateAtom :: TypeOutlives ) . potentially_quantified ( tcx)
14681443 }
14691444}
14701445
14711446impl < ' tcx > ToPredicate < ' tcx > for PolyProjectionPredicate < ' tcx > {
14721447 fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1473- self . map_bound ( PredicateAtom :: Projection ) . potentially_quantified ( tcx, PredicateKind :: ForAll )
1448+ self . map_bound ( PredicateAtom :: Projection ) . potentially_quantified ( tcx)
14741449 }
14751450}
14761451
0 commit comments