@@ -240,9 +240,15 @@ struct FulfillProcessor<'a, 'b, 'tcx> {
240
240
register_region_obligations : bool ,
241
241
}
242
242
243
- fn mk_pending ( os : Vec < PredicateObligation < ' tcx > > ) -> Vec < PendingPredicateObligation < ' tcx > > {
243
+ fn mk_pending (
244
+ infcx : & InferCtxt < ' _ , ' tcx > ,
245
+ os : Vec < PredicateObligation < ' tcx > > ,
246
+ ) -> Vec < PendingPredicateObligation < ' tcx > > {
244
247
os. into_iter ( )
245
- . map ( |o| PendingPredicateObligation { obligation : o, stalled_on : vec ! [ ] } )
248
+ . map ( |mut o| {
249
+ o. predicate = infcx. resolve_vars_if_possible ( & o. predicate ) ;
250
+ PendingPredicateObligation { obligation : o, stalled_on : vec ! [ ] }
251
+ } )
246
252
. collect ( )
247
253
}
248
254
@@ -312,14 +318,16 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
312
318
313
319
debug ! ( "process_obligation: obligation = {:?} cause = {:?}" , obligation, obligation. cause) ;
314
320
321
+ let infcx = self . selcx . infcx ( ) ;
322
+
315
323
match obligation. predicate {
316
324
ty:: Predicate :: Trait ( ref data, _) => {
317
325
let trait_obligation = obligation. with ( * data) ;
318
326
319
327
if data. is_global ( ) {
320
328
// no type variables present, can use evaluation for better caching.
321
329
// FIXME: consider caching errors too.
322
- if self . selcx . infcx ( ) . predicate_must_hold_considering_regions ( & obligation) {
330
+ if infcx. predicate_must_hold_considering_regions ( & obligation) {
323
331
debug ! (
324
332
"selecting trait `{:?}` at depth {} evaluated to holds" ,
325
333
data, obligation. recursion_depth
@@ -334,7 +342,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
334
342
"selecting trait `{:?}` at depth {} yielded Ok(Some)" ,
335
343
data, obligation. recursion_depth
336
344
) ;
337
- ProcessResult :: Changed ( mk_pending ( vtable. nested_obligations ( ) ) )
345
+ ProcessResult :: Changed ( mk_pending ( infcx , vtable. nested_obligations ( ) ) )
338
346
}
339
347
Ok ( None ) => {
340
348
debug ! (
@@ -351,7 +359,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
351
359
352
360
debug ! (
353
361
"process_predicate: pending obligation {:?} now stalled on {:?}" ,
354
- self . selcx . infcx( ) . resolve_vars_if_possible( obligation) ,
362
+ infcx. resolve_vars_if_possible( obligation) ,
355
363
pending_obligation. stalled_on
356
364
) ;
357
365
@@ -369,7 +377,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
369
377
}
370
378
371
379
ty:: Predicate :: RegionOutlives ( ref binder) => {
372
- match self . selcx . infcx ( ) . region_outlives_predicate ( & obligation. cause , binder) {
380
+ match infcx. region_outlives_predicate ( & obligation. cause , binder) {
373
381
Ok ( ( ) ) => ProcessResult :: Changed ( vec ! [ ] ) ,
374
382
Err ( _) => ProcessResult :: Error ( CodeSelectionError ( Unimplemented ) ) ,
375
383
}
@@ -428,7 +436,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
428
436
trait_ref_type_vars ( self . selcx , data. to_poly_trait_ref ( tcx) ) ;
429
437
ProcessResult :: Unchanged
430
438
}
431
- Ok ( Some ( os) ) => ProcessResult :: Changed ( mk_pending ( os) ) ,
439
+ Ok ( Some ( os) ) => ProcessResult :: Changed ( mk_pending ( infcx , os) ) ,
432
440
Err ( e) => ProcessResult :: Error ( CodeProjectionError ( e) ) ,
433
441
}
434
442
}
@@ -467,7 +475,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
467
475
vec ! [ TyOrConstInferVar :: maybe_from_ty( ty) . unwrap( ) ] ;
468
476
ProcessResult :: Unchanged
469
477
}
470
- Some ( os) => ProcessResult :: Changed ( mk_pending ( os) ) ,
478
+ Some ( os) => ProcessResult :: Changed ( mk_pending ( infcx , os) ) ,
471
479
}
472
480
}
473
481
@@ -485,7 +493,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
485
493
] ;
486
494
ProcessResult :: Unchanged
487
495
}
488
- Some ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( ok. obligations ) ) ,
496
+ Some ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( infcx , ok. obligations ) ) ,
489
497
Some ( Err ( err) ) => {
490
498
let expected_found = ExpectedFound :: new (
491
499
subtype. skip_binder ( ) . a_is_expected ,
0 commit comments