@@ -1030,7 +1030,7 @@ impl<'tcx> GenericPredicates<'tcx> {
10301030
10311031#[ derive( Debug ) ]
10321032crate struct PredicateInner < ' tcx > {
1033- kind : Binder < PredicateAtom < ' tcx > > ,
1033+ binder : Binder < PredicateAtom < ' tcx > > ,
10341034 flags : TypeFlags ,
10351035 /// See the comment for the corresponding field of [TyS].
10361036 outer_exclusive_binder : ty:: DebruijnIndex ,
@@ -1060,25 +1060,14 @@ impl Hash for Predicate<'_> {
10601060impl < ' tcx > Eq for Predicate < ' tcx > { }
10611061
10621062impl < ' tcx > Predicate < ' tcx > {
1063- #[ inline( always) ]
1064- pub fn kind ( self ) -> Binder < PredicateAtom < ' tcx > > {
1065- self . inner . kind
1066- }
1067-
1068- #[ inline( always) ]
1069- pub fn kind_ref ( & self ) -> & Binder < PredicateAtom < ' tcx > > {
1070- & self . inner . kind
1071- }
1072-
10731063 /// Returns the inner `PredicateAtom`.
10741064 ///
10751065 /// The returned atom may contain unbound variables bound to binders skipped in this method.
10761066 /// It is safe to reapply binders to the given atom.
10771067 ///
10781068 /// Note that this method panics in case this predicate has unbound variables.
10791069 pub fn skip_binders ( self ) -> PredicateAtom < ' tcx > {
1080- let binder = self . kind ( ) ;
1081- binder. skip_binder ( )
1070+ self . inner . binder . skip_binder ( )
10821071 }
10831072
10841073 /// Returns the inner `PredicateAtom`.
@@ -1088,37 +1077,38 @@ impl<'tcx> Predicate<'tcx> {
10881077 /// Rebinding the returned atom can causes the previously bound variables
10891078 /// to end up at the wrong binding level.
10901079 pub fn skip_binders_unchecked ( self ) -> PredicateAtom < ' tcx > {
1091- let binder = self . kind ( ) ;
1092- binder. skip_binder ( )
1080+ self . inner . binder . skip_binder ( )
10931081 }
10941082
10951083 /// Converts this to a `Binder<PredicateAtom<'tcx>>`. If the value was an
10961084 /// `Atom`, then it is not allowed to contain escaping bound vars.
10971085 pub fn bound_atom ( self ) -> Binder < PredicateAtom < ' tcx > > {
1098- let binder = self . kind ( ) ;
1099- binder
1086+ self . inner . binder
1087+ }
1088+
1089+ pub fn bound_atom_ref ( self ) -> & ' tcx Binder < PredicateAtom < ' tcx > > {
1090+ & self . inner . binder
11001091 }
11011092
11021093 /// Allows using a `Binder<PredicateAtom<'tcx>>` even if the given predicate previously
11031094 /// contained unbound variables by shifting these variables outwards.
11041095 pub fn bound_atom_with_opt_escaping ( self , _tcx : TyCtxt < ' tcx > ) -> Binder < PredicateAtom < ' tcx > > {
1105- let binder = self . kind ( ) ;
1106- binder
1096+ self . inner . binder
11071097 }
11081098}
11091099
11101100impl < ' a , ' tcx > HashStable < StableHashingContext < ' a > > for Predicate < ' tcx > {
11111101 fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
11121102 let PredicateInner {
1113- ref kind ,
1103+ ref binder ,
11141104
11151105 // The other fields just provide fast access to information that is
11161106 // also contained in `kind`, so no need to hash them.
11171107 flags : _,
11181108 outer_exclusive_binder : _,
11191109 } = self . inner ;
11201110
1121- kind . hash_stable ( hcx, hasher) ;
1111+ binder . hash_stable ( hcx, hasher) ;
11221112 }
11231113}
11241114
0 commit comments