@@ -24,19 +24,18 @@ use infer::canonical::{
2424} ;
2525use infer:: region_constraints:: { Constraint , RegionConstraintData } ;
2626use infer:: InferCtxtBuilder ;
27- use infer:: { InferCtxt , InferOk , InferResult , RegionObligation } ;
27+ use infer:: { InferCtxt , InferOk , InferResult } ;
2828use rustc_data_structures:: indexed_vec:: Idx ;
2929use rustc_data_structures:: indexed_vec:: IndexVec ;
3030use rustc_data_structures:: sync:: Lrc ;
3131use std:: fmt:: Debug ;
32- use syntax:: ast;
3332use syntax_pos:: DUMMY_SP ;
3433use traits:: query:: { Fallible , NoSolution } ;
3534use traits:: { FulfillmentContext , TraitEngine } ;
3635use traits:: { Obligation , ObligationCause , PredicateObligation } ;
3736use ty:: fold:: TypeFoldable ;
3837use ty:: subst:: { Kind , UnpackedKind } ;
39- use ty:: { self , CanonicalVar , Lift , TyCtxt } ;
38+ use ty:: { self , CanonicalVar , Lift , Ty , TyCtxt } ;
4039
4140impl < ' cx , ' gcx , ' tcx > InferCtxtBuilder < ' cx , ' gcx , ' tcx > {
4241 /// The "main method" for a canonicalized trait query. Given the
@@ -157,7 +156,12 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
157156
158157 let region_obligations = self . take_registered_region_obligations ( ) ;
159158 let region_constraints = self . with_region_constraints ( |region_constraints| {
160- make_query_outlives ( tcx, region_obligations, region_constraints)
159+ make_query_outlives (
160+ tcx,
161+ region_obligations
162+ . iter ( )
163+ . map ( |( _, r_o) | ( r_o. sup_type , r_o. sub_region ) ) ,
164+ region_constraints)
161165 } ) ;
162166
163167 let certainty = if ambig_errors. is_empty ( ) {
@@ -567,7 +571,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
567571/// creates query region constraints.
568572pub fn make_query_outlives < ' tcx > (
569573 tcx : TyCtxt < ' _ , ' _ , ' tcx > ,
570- region_obligations : Vec < ( ast :: NodeId , RegionObligation < ' tcx > ) > ,
574+ outlives_obligations : impl Iterator < Item = ( Ty < ' tcx > , ty :: Region < ' tcx > ) > ,
571575 region_constraints : & RegionConstraintData < ' tcx > ,
572576) -> Vec < QueryRegionConstraint < ' tcx > > {
573577 let RegionConstraintData {
@@ -600,9 +604,8 @@ pub fn make_query_outlives<'tcx>(
600604 . collect ( ) ;
601605
602606 outlives. extend (
603- region_obligations
604- . into_iter ( )
605- . map ( |( _, r_o) | ty:: OutlivesPredicate ( r_o. sup_type . into ( ) , r_o. sub_region ) )
607+ outlives_obligations
608+ . map ( |( ty, r) | ty:: OutlivesPredicate ( ty. into ( ) , r) )
606609 . map ( ty:: Binder :: dummy) , // no bound regions in the code above
607610 ) ;
608611
0 commit comments