@@ -221,7 +221,7 @@ fn do_normalize_predicates<'tcx>(
221
221
mut causes : impl Iterator < Item = ObligationCause < ' tcx > > + Debug ,
222
222
elaborated_env : ty:: ParamEnv < ' tcx > ,
223
223
predicates : Vec < ty:: Predicate < ' tcx > > ,
224
- outlives : bool ,
224
+ normalize_outlive_predicates : bool ,
225
225
) -> Result < Vec < ty:: Predicate < ' tcx > > , ErrorGuaranteed > {
226
226
// FIXME. We should really... do something with these region
227
227
// obligations. But this call just continues the older
@@ -237,24 +237,27 @@ fn do_normalize_predicates<'tcx>(
237
237
// them here too, and we will remove this function when
238
238
// we move over to lazy normalization *anyway*.
239
239
tcx. infer_ctxt ( ) . ignoring_regions ( ) . enter ( |infcx| {
240
- let predicates = match predicates. try_map_id ( |predicate| {
241
- if outlives
242
- != matches ! ( predicate. kind( ) . skip_binder( ) , ty:: PredicateKind :: TypeOutlives ( ..) )
240
+ let normalized_predicates = match predicates. try_map_id ( |origin_predicate| {
241
+ if normalize_outlive_predicates
242
+ != matches ! (
243
+ origin_predicate. kind( ) . skip_binder( ) ,
244
+ ty:: PredicateKind :: TypeOutlives ( ..)
245
+ )
243
246
{
244
247
causes. next ( ) . unwrap ( ) ;
245
- Ok ( predicate )
248
+ Ok ( origin_predicate )
246
249
} else {
247
- fully_normalize ( & infcx, causes. next ( ) . unwrap ( ) , elaborated_env, predicate )
250
+ fully_normalize ( & infcx, causes. next ( ) . unwrap ( ) , elaborated_env, origin_predicate )
248
251
}
249
252
} ) {
250
- Ok ( predicates ) => predicates ,
253
+ Ok ( normalized ) => normalized ,
251
254
Err ( errors) => {
252
255
let reported = infcx. report_fulfillment_errors ( & errors, None , false ) ;
253
256
return Err ( reported) ;
254
257
}
255
258
} ;
256
259
257
- debug ! ( "do_normalize_predictes: normalized predicates = {:?}" , predicates ) ;
260
+ debug ! ( "do_normalize_predictes: normalized predicates = {:?}" , normalized_predicates ) ;
258
261
259
262
// We can use the `elaborated_env` here; the region code only
260
263
// cares about declarations like `'a: 'b`.
@@ -273,17 +276,17 @@ fn do_normalize_predicates<'tcx>(
273
276
) ;
274
277
}
275
278
276
- match predicates . try_map_id ( |predicate| {
277
- if outlives
278
- != matches ! ( predicate . kind ( ) . skip_binder ( ) , ty :: PredicateKind :: TypeOutlives ( .. ) )
279
- {
280
- Ok ( predicate )
281
- } else {
282
- infcx . fully_resolve ( predicate )
283
- }
284
- } ) {
285
- Ok ( predicates ) => Ok ( predicates ) ,
286
- Err ( fixup_err) => {
279
+ normalized_predicates
280
+ . try_map_id ( |predicate| {
281
+ if normalize_outlive_predicates
282
+ != matches ! ( predicate . kind ( ) . skip_binder ( ) , ty :: PredicateKind :: TypeOutlives ( .. ) )
283
+ {
284
+ Ok ( predicate )
285
+ } else {
286
+ infcx . fully_resolve ( predicate )
287
+ }
288
+ } )
289
+ . map_err ( | fixup_err| {
287
290
// If we encounter a fixup error, it means that some type
288
291
// variable wound up unconstrained. I actually don't know
289
292
// if this can happen, and I certainly don't expect it to
@@ -298,8 +301,7 @@ fn do_normalize_predicates<'tcx>(
298
301
"inference variables in normalized parameter environment: {}" ,
299
302
fixup_err
300
303
) ;
301
- }
302
- }
304
+ } )
303
305
} )
304
306
}
305
307
0 commit comments