@@ -65,7 +65,7 @@ pub struct FulfillmentContext<'tcx> {
65
65
#[ derive( Clone , Debug ) ]
66
66
pub struct PendingPredicateObligation < ' tcx > {
67
67
pub obligation : PredicateObligation < ' tcx > ,
68
- pub stalled_on : Vec < Ty < ' tcx > > ,
68
+ pub stalled_on : Vec < ty :: InferTy > ,
69
69
}
70
70
71
71
// `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> {
263
263
// Match arms are in order of frequency, which matters because this
264
264
// code is so hot. 1 and 0 dominate; 2+ is fairly rare.
265
265
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 )
268
268
}
269
269
0 => {
270
270
// 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> {
274
274
// This `for` loop was once a call to `all()`, but this lower-level
275
275
// form was a perf win. See #64545 for details.
276
276
( || {
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 ) {
279
279
return true ;
280
280
}
281
281
}
@@ -305,6 +305,13 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
305
305
306
306
debug ! ( "process_obligation: obligation = {:?} cause = {:?}" , obligation, obligation. cause) ;
307
307
308
+ fn infer_ty ( ty : Ty < ' tcx > ) -> ty:: InferTy {
309
+ match ty. kind {
310
+ ty:: Infer ( infer) => infer,
311
+ _ => panic ! ( ) ,
312
+ }
313
+ }
314
+
308
315
match obligation. predicate {
309
316
ty:: Predicate :: Trait ( ref data) => {
310
317
let trait_obligation = obligation. with ( data. clone ( ) ) ;
@@ -459,7 +466,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
459
466
obligation. cause . span ,
460
467
) {
461
468
None => {
462
- pending_obligation. stalled_on = vec ! [ ty ] ;
469
+ pending_obligation. stalled_on = vec ! [ infer_ty ( ty ) ] ;
463
470
ProcessResult :: Unchanged
464
471
}
465
472
Some ( os) => ProcessResult :: Changed ( mk_pending ( os) )
@@ -472,8 +479,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
472
479
subtype) {
473
480
None => {
474
481
// 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) ] ;
477
484
ProcessResult :: Unchanged
478
485
}
479
486
Some ( Ok ( ok) ) => {
@@ -517,7 +524,8 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
517
524
) )
518
525
}
519
526
} else {
520
- pending_obligation. stalled_on = substs. types ( ) . collect ( ) ;
527
+ pending_obligation. stalled_on =
528
+ substs. types ( ) . map ( |ty| infer_ty ( ty) ) . collect ( ) ;
521
529
ProcessResult :: Unchanged
522
530
}
523
531
}
@@ -542,13 +550,13 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
542
550
fn trait_ref_type_vars < ' a , ' tcx > (
543
551
selcx : & mut SelectionContext < ' a , ' tcx > ,
544
552
t : ty:: PolyTraitRef < ' tcx > ,
545
- ) -> Vec < Ty < ' tcx > > {
553
+ ) -> Vec < ty :: InferTy > {
546
554
t. skip_binder ( ) // ok b/c this check doesn't care about regions
547
555
. input_types ( )
548
556
. map ( |t| selcx. infcx ( ) . resolve_vars_if_possible ( & t) )
549
557
. filter ( |t| t. has_infer_types ( ) )
550
558
. 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 } )
552
560
. collect ( )
553
561
}
554
562
0 commit comments