@@ -65,7 +65,7 @@ pub struct FulfillmentContext<'tcx> {
6565#[ derive( Clone , Debug ) ]
6666pub struct PendingPredicateObligation < ' tcx > {
6767 pub obligation : PredicateObligation < ' tcx > ,
68- pub stalled_on : Vec < Ty < ' tcx > > ,
68+ pub stalled_on : Vec < ty :: InferTy > ,
6969}
7070
7171// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
@@ -263,8 +263,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
263263 // Match arms are in order of frequency, which matters because this
264264 // code is so hot. 1 and 0 dominate; 2+ is fairly rare.
265265 1 => {
266- let ty = pending_obligation. stalled_on [ 0 ] ;
267- ShallowResolver :: new ( self . selcx . infcx ( ) ) . shallow_resolve_changed ( ty )
266+ let infer = pending_obligation. stalled_on [ 0 ] ;
267+ ShallowResolver :: new ( self . selcx . infcx ( ) ) . shallow_resolve_changed ( infer )
268268 }
269269 0 => {
270270 // In this case we haven't changed, but wish to make a change.
@@ -274,8 +274,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
274274 // This `for` loop was once a call to `all()`, but this lower-level
275275 // form was a perf win. See #64545 for details.
276276 ( || {
277- for & ty in & pending_obligation. stalled_on {
278- if ShallowResolver :: new ( self . selcx . infcx ( ) ) . shallow_resolve_changed ( ty ) {
277+ for & infer in & pending_obligation. stalled_on {
278+ if ShallowResolver :: new ( self . selcx . infcx ( ) ) . shallow_resolve_changed ( infer ) {
279279 return true ;
280280 }
281281 }
@@ -305,6 +305,13 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
305305
306306 debug ! ( "process_obligation: obligation = {:?} cause = {:?}" , obligation, obligation. cause) ;
307307
308+ fn infer_ty ( ty : Ty < ' tcx > ) -> ty:: InferTy {
309+ match ty. kind {
310+ ty:: Infer ( infer) => infer,
311+ _ => panic ! ( ) ,
312+ }
313+ }
314+
308315 match obligation. predicate {
309316 ty:: Predicate :: Trait ( ref data) => {
310317 let trait_obligation = obligation. with ( data. clone ( ) ) ;
@@ -459,7 +466,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
459466 obligation. cause . span ,
460467 ) {
461468 None => {
462- pending_obligation. stalled_on = vec ! [ ty ] ;
469+ pending_obligation. stalled_on = vec ! [ infer_ty ( ty ) ] ;
463470 ProcessResult :: Unchanged
464471 }
465472 Some ( os) => ProcessResult :: Changed ( mk_pending ( os) )
@@ -472,8 +479,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
472479 subtype) {
473480 None => {
474481 // None means that both are unresolved.
475- pending_obligation. stalled_on = vec ! [ subtype. skip_binder( ) . a,
476- subtype. skip_binder( ) . b] ;
482+ pending_obligation. stalled_on = vec ! [ infer_ty ( subtype. skip_binder( ) . a) ,
483+ infer_ty ( subtype. skip_binder( ) . b) ] ;
477484 ProcessResult :: Unchanged
478485 }
479486 Some ( Ok ( ok) ) => {
@@ -517,7 +524,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
517524 ) )
518525 }
519526 } else {
520- pending_obligation. stalled_on = substs. types ( ) . collect ( ) ;
527+ pending_obligation. stalled_on =
528+ substs. types ( ) . map ( |ty| infer_ty ( ty) ) . collect ( ) ;
521529 ProcessResult :: Unchanged
522530 }
523531 }
@@ -542,13 +550,13 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
542550fn trait_ref_type_vars < ' a , ' tcx > (
543551 selcx : & mut SelectionContext < ' a , ' tcx > ,
544552 t : ty:: PolyTraitRef < ' tcx > ,
545- ) -> Vec < Ty < ' tcx > > {
553+ ) -> Vec < ty :: InferTy > {
546554 t. skip_binder ( ) // ok b/c this check doesn't care about regions
547555 . input_types ( )
548556 . map ( |t| selcx. infcx ( ) . resolve_vars_if_possible ( & t) )
549557 . filter ( |t| t. has_infer_types ( ) )
550558 . flat_map ( |t| t. walk ( ) )
551- . filter ( |t| match t. kind { ty:: Infer ( _ ) => true , _ => false } )
559+ . filter_map ( |t| match t. kind { ty:: Infer ( infer ) => Some ( infer ) , _ => None } )
552560 . collect ( )
553561}
554562
0 commit comments