@@ -526,27 +526,31 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
526526 ) -> impl Iterator < Item = PredicateObligation < ' tcx > > + ' a + Captures < ' tcx > {
527527 unsubstituted_region_constraints. iter ( ) . map ( move |constraint| {
528528 let constraint = substitute_value ( self . tcx , result_subst, constraint) ;
529- let ty:: OutlivesPredicate ( k1, r2) = constraint. skip_binder ( ) ; // restored below
530529
531- Obligation :: new (
532- cause. clone ( ) ,
533- param_env,
534- match k1. unpack ( ) {
535- GenericArgKind :: Lifetime ( r1) => ty:: PredicateKind :: RegionOutlives (
536- ty:: Binder :: bind ( ty:: OutlivesPredicate ( r1, r2) ) ,
537- )
538- . to_predicate ( self . tcx ) ,
539- GenericArgKind :: Type ( t1) => ty:: PredicateKind :: TypeOutlives ( ty:: Binder :: bind (
540- ty:: OutlivesPredicate ( t1, r2) ,
541- ) )
542- . to_predicate ( self . tcx ) ,
543- GenericArgKind :: Const ( ..) => {
544- // Consts cannot outlive one another, so we don't expect to
545- // ecounter this branch.
546- span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
547- }
548- } ,
549- )
530+ let to_predicate = |ty:: OutlivesPredicate ( k1, r2) : ty:: OutlivesPredicate <
531+ GenericArg < ' tcx > ,
532+ ty:: Region < ' tcx > ,
533+ > | match k1. unpack ( ) {
534+ GenericArgKind :: Lifetime ( r1) => self . tcx . intern_predicate_kint (
535+ ty:: PredicateKint :: RegionOutlives ( ty:: OutlivesPredicate ( r1, r2) ) ,
536+ ) ,
537+ GenericArgKind :: Type ( t1) => self . tcx . intern_predicate_kint (
538+ ty:: PredicateKint :: TypeOutlives ( ty:: OutlivesPredicate ( t1, r2) ) ,
539+ ) ,
540+ GenericArgKind :: Const ( ..) => {
541+ // Consts cannot outlive one another, so we don't expect to
542+ // ecounter this branch.
543+ span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
544+ }
545+ } ;
546+
547+ let predicate = if let Some ( constraint) = constraint. no_bound_vars ( ) {
548+ to_predicate ( constraint) . to_predicate ( self . tcx )
549+ } else {
550+ ty:: PredicateKint :: ForAll ( constraint. map_bound ( to_predicate) ) . to_predicate ( self . tcx )
551+ } ;
552+
553+ Obligation :: new ( cause. clone ( ) , param_env, predicate)
550554 } )
551555 }
552556
0 commit comments