@@ -36,6 +36,7 @@ use traits::{Obligation, ObligationCause, PredicateObligation};
36
36
use ty:: fold:: TypeFoldable ;
37
37
use ty:: subst:: { Kind , UnpackedKind } ;
38
38
use ty:: { self , BoundVar , Lift , Ty , TyCtxt } ;
39
+ use util:: captures:: Captures ;
39
40
40
41
impl < ' cx , ' gcx , ' tcx > InferCtxtBuilder < ' cx , ' gcx , ' tcx > {
41
42
/// The "main method" for a canonicalized trait query. Given the
@@ -527,32 +528,30 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
527
528
param_env : ty:: ParamEnv < ' tcx > ,
528
529
unsubstituted_region_constraints : & ' a [ QueryRegionConstraint < ' tcx > ] ,
529
530
result_subst : & ' a CanonicalVarValues < ' tcx > ,
530
- ) -> impl Iterator < Item = PredicateObligation < ' tcx > > + ' a {
531
- Box :: new (
532
- unsubstituted_region_constraints
533
- . iter ( )
534
- . map ( move |constraint| {
535
- let constraint = substitute_value ( self . tcx , result_subst, constraint) ;
536
- let & ty:: OutlivesPredicate ( k1, r2) = constraint. skip_binder ( ) ; // restored below
537
-
538
- Obligation :: new (
539
- cause. clone ( ) ,
540
- param_env,
541
- match k1. unpack ( ) {
542
- UnpackedKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
543
- ty:: Binder :: bind (
544
- ty:: OutlivesPredicate ( r1, r2)
545
- )
546
- ) ,
547
- UnpackedKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
548
- ty:: Binder :: bind (
549
- ty:: OutlivesPredicate ( t1, r2)
550
- )
551
- ) ,
552
- }
553
- )
554
- } )
555
- ) as Box < dyn Iterator < Item = _ > >
531
+ ) -> impl Iterator < Item = PredicateObligation < ' tcx > > + ' a + Captures < ' gcx > {
532
+ unsubstituted_region_constraints
533
+ . iter ( )
534
+ . map ( move |constraint| {
535
+ let constraint = substitute_value ( self . tcx , result_subst, constraint) ;
536
+ let & ty:: OutlivesPredicate ( k1, r2) = constraint. skip_binder ( ) ; // restored below
537
+
538
+ Obligation :: new (
539
+ cause. clone ( ) ,
540
+ param_env,
541
+ match k1. unpack ( ) {
542
+ UnpackedKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
543
+ ty:: Binder :: bind (
544
+ ty:: OutlivesPredicate ( r1, r2)
545
+ )
546
+ ) ,
547
+ UnpackedKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
548
+ ty:: Binder :: bind (
549
+ ty:: OutlivesPredicate ( t1, r2)
550
+ )
551
+ ) ,
552
+ }
553
+ )
554
+ } )
556
555
}
557
556
558
557
/// Given two sets of values for the same set of canonical variables, unify them.
0 commit comments