@@ -525,12 +525,10 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
525525 result_subst : & ' a CanonicalVarValues < ' tcx > ,
526526 ) -> impl Iterator < Item = PredicateObligation < ' tcx > > + ' a + Captures < ' tcx > {
527527 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 ( ) ;
529530
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 ( ) {
534532 GenericArgKind :: Lifetime ( r1) => {
535533 ty:: PredicateKind :: RegionOutlives ( ty:: OutlivesPredicate ( r1, r2) )
536534 . to_predicate ( self . tcx )
@@ -541,16 +539,11 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
541539 }
542540 GenericArgKind :: Const ( ..) => {
543541 // Consts cannot outlive one another, so we don't expect to
544- // ecounter this branch.
542+ // encounter this branch.
545543 span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
546544 }
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 ) ;
554547
555548 Obligation :: new ( cause. clone ( ) , param_env, predicate)
556549 } )
0 commit comments