@@ -88,33 +88,35 @@ pub fn predicate_obligations<'a, 'tcx>(
88
88
infcx : & InferCtxt < ' a , ' tcx > ,
89
89
param_env : ty:: ParamEnv < ' tcx > ,
90
90
body_id : hir:: HirId ,
91
- predicate : ty:: Predicate < ' tcx > ,
91
+ predicate : & ' tcx ty:: PredicateKint < ' tcx > ,
92
92
span : Span ,
93
93
) -> Vec < traits:: PredicateObligation < ' tcx > > {
94
94
let mut wf = WfPredicates { infcx, param_env, body_id, span, out : vec ! [ ] , item : None } ;
95
95
96
- // (*) ok to skip binders, because wf code is prepared for it
97
- match predicate . kind ( ) {
98
- ty :: PredicateKind :: Trait ( t , _ ) => {
99
- wf . compute_trait_ref ( & t . skip_binder ( ) . trait_ref , Elaborate :: None ) ; // (*)
96
+ match predicate {
97
+ ty :: PredicateKint :: ForAll ( binder ) => {
98
+ // It's ok to skip the binder here because wf code is prepared for it
99
+ return predicate_obligations ( infcx , param_env , body_id , * binder . skip_binder ( ) , span ) ;
100
100
}
101
- ty:: PredicateKind :: RegionOutlives ( ..) => { }
102
- ty:: PredicateKind :: TypeOutlives ( t) => {
103
- wf. compute ( t. skip_binder ( ) . 0 . into ( ) ) ;
101
+ ty:: PredicateKint :: Trait ( t, _) => {
102
+ wf. compute_trait_ref ( & t. trait_ref , Elaborate :: None ) ;
104
103
}
105
- ty:: PredicateKind :: Projection ( t) => {
106
- let t = t. skip_binder ( ) ; // (*)
104
+ ty:: PredicateKint :: RegionOutlives ( ..) => { }
105
+ & ty:: PredicateKint :: TypeOutlives ( ty:: OutlivesPredicate ( ty, _reg) ) => {
106
+ wf. compute ( ty. into ( ) ) ;
107
+ }
108
+ ty:: PredicateKint :: Projection ( t) => {
107
109
wf. compute_projection ( t. projection_ty ) ;
108
110
wf. compute ( t. ty . into ( ) ) ;
109
111
}
110
- & ty:: PredicateKind :: WellFormed ( arg) => {
112
+ & ty:: PredicateKint :: WellFormed ( arg) => {
111
113
wf. compute ( arg) ;
112
114
}
113
- ty:: PredicateKind :: ObjectSafe ( _) => { }
114
- ty:: PredicateKind :: ClosureKind ( ..) => { }
115
- ty:: PredicateKind :: Subtype ( data ) => {
116
- wf. compute ( data . skip_binder ( ) . a . into ( ) ) ; // (*)
117
- wf. compute ( data . skip_binder ( ) . b . into ( ) ) ; // (*)
115
+ ty:: PredicateKint :: ObjectSafe ( _) => { }
116
+ ty:: PredicateKint :: ClosureKind ( ..) => { }
117
+ & ty:: PredicateKint :: Subtype ( ty :: SubtypePredicate { a , b , a_is_expected : _ } ) => {
118
+ wf. compute ( a. into ( ) ) ;
119
+ wf. compute ( b. into ( ) ) ;
118
120
}
119
121
& ty:: PredicateKind :: ConstEvaluatable ( def, substs) => {
120
122
let obligations = wf. nominal_obligations ( def. did , substs) ;
@@ -124,7 +126,7 @@ pub fn predicate_obligations<'a, 'tcx>(
124
126
wf. compute ( arg) ;
125
127
}
126
128
}
127
- & ty:: PredicateKind :: ConstEquate ( c1, c2) => {
129
+ & ty:: PredicateKint :: ConstEquate ( c1, c2) => {
128
130
wf. compute ( c1. into ( ) ) ;
129
131
wf. compute ( c2. into ( ) ) ;
130
132
}
0 commit comments