@@ -24,19 +24,18 @@ use infer::canonical::{
24
24
} ;
25
25
use infer:: region_constraints:: { Constraint , RegionConstraintData } ;
26
26
use infer:: InferCtxtBuilder ;
27
- use infer:: { InferCtxt , InferOk , InferResult , RegionObligation } ;
27
+ use infer:: { InferCtxt , InferOk , InferResult } ;
28
28
use rustc_data_structures:: indexed_vec:: Idx ;
29
29
use rustc_data_structures:: indexed_vec:: IndexVec ;
30
30
use rustc_data_structures:: sync:: Lrc ;
31
31
use std:: fmt:: Debug ;
32
- use syntax:: ast;
33
32
use syntax_pos:: DUMMY_SP ;
34
33
use traits:: query:: { Fallible , NoSolution } ;
35
34
use traits:: { FulfillmentContext , TraitEngine } ;
36
35
use traits:: { Obligation , ObligationCause , PredicateObligation } ;
37
36
use ty:: fold:: TypeFoldable ;
38
37
use ty:: subst:: { Kind , UnpackedKind } ;
39
- use ty:: { self , CanonicalVar , Lift , TyCtxt } ;
38
+ use ty:: { self , CanonicalVar , Lift , Ty , TyCtxt } ;
40
39
41
40
impl < ' cx , ' gcx , ' tcx > InferCtxtBuilder < ' cx , ' gcx , ' tcx > {
42
41
/// The "main method" for a canonicalized trait query. Given the
@@ -157,7 +156,12 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
157
156
158
157
let region_obligations = self . take_registered_region_obligations ( ) ;
159
158
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)
161
165
} ) ;
162
166
163
167
let certainty = if ambig_errors. is_empty ( ) {
@@ -567,7 +571,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
567
571
/// creates query region constraints.
568
572
pub fn make_query_outlives < ' tcx > (
569
573
tcx : TyCtxt < ' _ , ' _ , ' tcx > ,
570
- region_obligations : Vec < ( ast :: NodeId , RegionObligation < ' tcx > ) > ,
574
+ outlives_obligations : impl Iterator < Item = ( Ty < ' tcx > , ty :: Region < ' tcx > ) > ,
571
575
region_constraints : & RegionConstraintData < ' tcx > ,
572
576
) -> Vec < QueryRegionConstraint < ' tcx > > {
573
577
let RegionConstraintData {
@@ -600,9 +604,8 @@ pub fn make_query_outlives<'tcx>(
600
604
. collect ( ) ;
601
605
602
606
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) )
606
609
. map ( ty:: Binder :: dummy) , // no bound regions in the code above
607
610
) ;
608
611
0 commit comments