@@ -240,9 +240,15 @@ struct FulfillProcessor<'a, 'b, 'tcx> {
240240 register_region_obligations : bool ,
241241}
242242
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 > > {
244247 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+ } )
246252 . collect ( )
247253}
248254
@@ -312,14 +318,16 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
312318
313319 debug ! ( "process_obligation: obligation = {:?} cause = {:?}" , obligation, obligation. cause) ;
314320
321+ let infcx = self . selcx . infcx ( ) ;
322+
315323 match obligation. predicate {
316324 ty:: Predicate :: Trait ( ref data, _) => {
317325 let trait_obligation = obligation. with ( * data) ;
318326
319327 if data. is_global ( ) {
320328 // no type variables present, can use evaluation for better caching.
321329 // 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) {
323331 debug ! (
324332 "selecting trait `{:?}` at depth {} evaluated to holds" ,
325333 data, obligation. recursion_depth
@@ -334,7 +342,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
334342 "selecting trait `{:?}` at depth {} yielded Ok(Some)" ,
335343 data, obligation. recursion_depth
336344 ) ;
337- ProcessResult :: Changed ( mk_pending ( vtable. nested_obligations ( ) ) )
345+ ProcessResult :: Changed ( mk_pending ( infcx , vtable. nested_obligations ( ) ) )
338346 }
339347 Ok ( None ) => {
340348 debug ! (
@@ -351,7 +359,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
351359
352360 debug ! (
353361 "process_predicate: pending obligation {:?} now stalled on {:?}" ,
354- self . selcx . infcx( ) . resolve_vars_if_possible( obligation) ,
362+ infcx. resolve_vars_if_possible( obligation) ,
355363 pending_obligation. stalled_on
356364 ) ;
357365
@@ -369,7 +377,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
369377 }
370378
371379 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) {
373381 Ok ( ( ) ) => ProcessResult :: Changed ( vec ! [ ] ) ,
374382 Err ( _) => ProcessResult :: Error ( CodeSelectionError ( Unimplemented ) ) ,
375383 }
@@ -428,7 +436,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
428436 trait_ref_type_vars ( self . selcx , data. to_poly_trait_ref ( tcx) ) ;
429437 ProcessResult :: Unchanged
430438 }
431- Ok ( Some ( os) ) => ProcessResult :: Changed ( mk_pending ( os) ) ,
439+ Ok ( Some ( os) ) => ProcessResult :: Changed ( mk_pending ( infcx , os) ) ,
432440 Err ( e) => ProcessResult :: Error ( CodeProjectionError ( e) ) ,
433441 }
434442 }
@@ -467,7 +475,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
467475 vec ! [ TyOrConstInferVar :: maybe_from_ty( ty) . unwrap( ) ] ;
468476 ProcessResult :: Unchanged
469477 }
470- Some ( os) => ProcessResult :: Changed ( mk_pending ( os) ) ,
478+ Some ( os) => ProcessResult :: Changed ( mk_pending ( infcx , os) ) ,
471479 }
472480 }
473481
@@ -485,7 +493,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
485493 ] ;
486494 ProcessResult :: Unchanged
487495 }
488- Some ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( ok. obligations ) ) ,
496+ Some ( Ok ( ok) ) => ProcessResult :: Changed ( mk_pending ( infcx , ok. obligations ) ) ,
489497 Some ( Err ( err) ) => {
490498 let expected_found = ExpectedFound :: new (
491499 subtype. skip_binder ( ) . a_is_expected ,
0 commit comments