@@ -525,12 +525,10 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
525
525
result_subst : & ' a CanonicalVarValues < ' tcx > ,
526
526
) -> impl Iterator < Item = PredicateObligation < ' tcx > > + ' a + Captures < ' tcx > {
527
527
unsubstituted_region_constraints. iter ( ) . map ( move |constraint| {
528
- let constraint = substitute_value ( self . tcx , result_subst, constraint) ;
528
+ let ty:: OutlivesPredicate ( k1, r2) =
529
+ * substitute_value ( self . tcx , result_subst, constraint) . skip_binder ( ) ;
529
530
530
- let to_predicate = |ty:: OutlivesPredicate ( k1, r2) : ty:: OutlivesPredicate <
531
- GenericArg < ' tcx > ,
532
- ty:: Region < ' tcx > ,
533
- > | match k1. unpack ( ) {
531
+ let predicate = match k1. unpack ( ) {
534
532
GenericArgKind :: Lifetime ( r1) => {
535
533
ty:: PredicateKind :: RegionOutlives ( ty:: OutlivesPredicate ( r1, r2) )
536
534
. to_predicate ( self . tcx )
@@ -541,16 +539,11 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
541
539
}
542
540
GenericArgKind :: Const ( ..) => {
543
541
// Consts cannot outlive one another, so we don't expect to
544
- // ecounter this branch.
542
+ // encounter this branch.
545
543
span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
546
544
}
547
- } ;
548
-
549
- let predicate = if let Some ( constraint) = constraint. no_bound_vars ( ) {
550
- to_predicate ( constraint)
551
- } else {
552
- ty:: PredicateKind :: ForAll ( constraint. map_bound ( to_predicate) ) . to_predicate ( self . tcx )
553
- } ;
545
+ }
546
+ . potentially_quantified ( self . tcx , ty:: PredicateKind :: ForAll ) ;
554
547
555
548
Obligation :: new ( cause. clone ( ) , param_env, predicate)
556
549
} )
0 commit comments