@@ -115,6 +115,7 @@ impl<'tcx> InferCtxt<'tcx> {
115
115
}
116
116
117
117
let region_obligations = self . take_registered_region_obligations ( ) ;
118
+ let region_assumptions = self . take_registered_region_assumptions ( ) ;
118
119
debug ! ( ?region_obligations) ;
119
120
let region_constraints = self . with_region_constraints ( |region_constraints| {
120
121
make_query_region_constraints (
@@ -123,6 +124,7 @@ impl<'tcx> InferCtxt<'tcx> {
123
124
. iter ( )
124
125
. map ( |r_o| ( r_o. sup_type , r_o. sub_region , r_o. origin . to_constraint_category ( ) ) ) ,
125
126
region_constraints,
127
+ region_assumptions,
126
128
)
127
129
} ) ;
128
130
debug ! ( ?region_constraints) ;
@@ -174,6 +176,11 @@ impl<'tcx> InferCtxt<'tcx> {
174
176
self . register_outlives_constraint ( predicate, cause) ;
175
177
}
176
178
179
+ for assumption in & query_response. value . region_constraints . assumptions {
180
+ let assumption = instantiate_value ( self . tcx , & result_args, * assumption) ;
181
+ self . register_region_assumption ( assumption) ;
182
+ }
183
+
177
184
let user_result: R =
178
185
query_response. instantiate_projected ( self . tcx , & result_args, |q_r| q_r. value . clone ( ) ) ;
179
186
@@ -297,6 +304,16 @@ impl<'tcx> InferCtxt<'tcx> {
297
304
} ) ,
298
305
) ;
299
306
307
+ // FIXME(higher_ranked_auto): Optimize?
308
+ output_query_region_constraints. assumptions . extend (
309
+ query_response
310
+ . value
311
+ . region_constraints
312
+ . assumptions
313
+ . iter ( )
314
+ . map ( |& r_c| instantiate_value ( self . tcx , & result_args, r_c) ) ,
315
+ ) ;
316
+
300
317
let user_result: R =
301
318
query_response. instantiate_projected ( self . tcx , & result_args, |q_r| q_r. value . clone ( ) ) ;
302
319
@@ -572,6 +589,7 @@ pub fn make_query_region_constraints<'tcx>(
572
589
tcx : TyCtxt < ' tcx > ,
573
590
outlives_obligations : impl Iterator < Item = ( Ty < ' tcx > , ty:: Region < ' tcx > , ConstraintCategory < ' tcx > ) > ,
574
591
region_constraints : & RegionConstraintData < ' tcx > ,
592
+ assumptions : Vec < ty:: OutlivesPredicate < ' tcx , ty:: GenericArg < ' tcx > > > ,
575
593
) -> QueryRegionConstraints < ' tcx > {
576
594
let RegionConstraintData { constraints, verifys } = region_constraints;
577
595
@@ -604,5 +622,5 @@ pub fn make_query_region_constraints<'tcx>(
604
622
} ) )
605
623
. collect ( ) ;
606
624
607
- QueryRegionConstraints { outlives }
625
+ QueryRegionConstraints { outlives, assumptions }
608
626
}
0 commit comments