@@ -135,8 +135,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
135
135
// Remove any trivial region constraints once we've resolved regions
136
136
external_constraints
137
137
. region_constraints
138
- . outlives
139
- . retain ( |( outlives, _) | outlives. 0 . as_region ( ) . map_or ( true , |re| re != outlives. 1 ) ) ;
138
+ . retain ( |outlives| outlives. 0 . as_region ( ) . map_or ( true , |re| re != outlives. 1 ) ) ;
140
139
141
140
let canonical = Canonicalizer :: canonicalize (
142
141
self . infcx ,
@@ -193,19 +192,23 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
193
192
// Cannot use `take_registered_region_obligations` as we may compute the response
194
193
// inside of a `probe` whenever we have multiple choices inside of the solver.
195
194
let region_obligations = self . infcx . inner . borrow ( ) . region_obligations ( ) . to_owned ( ) ;
196
- let mut region_constraints = self . infcx . with_region_constraints ( |region_constraints| {
197
- make_query_region_constraints (
198
- self . interner ( ) ,
199
- region_obligations. iter ( ) . map ( |r_o| {
200
- ( r_o. sup_type , r_o. sub_region , r_o. origin . to_constraint_category ( ) )
201
- } ) ,
202
- region_constraints,
203
- )
204
- } ) ;
205
-
195
+ let QueryRegionConstraints { outlives, member_constraints } =
196
+ self . infcx . with_region_constraints ( |region_constraints| {
197
+ make_query_region_constraints (
198
+ self . interner ( ) ,
199
+ region_obligations. iter ( ) . map ( |r_o| {
200
+ ( r_o. sup_type , r_o. sub_region , r_o. origin . to_constraint_category ( ) )
201
+ } ) ,
202
+ region_constraints,
203
+ )
204
+ } ) ;
205
+ assert_eq ! ( member_constraints, vec![ ] ) ;
206
206
let mut seen = FxHashSet :: default ( ) ;
207
- region_constraints. outlives . retain ( |outlives| seen. insert ( * outlives) ) ;
208
- region_constraints
207
+ outlives
208
+ . into_iter ( )
209
+ . filter ( |( outlives, _) | seen. insert ( * outlives) )
210
+ . map ( |( outlives, _origin) | outlives)
211
+ . collect ( )
209
212
} else {
210
213
Default :: default ( )
211
214
} ;
@@ -369,16 +372,17 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
369
372
}
370
373
}
371
374
372
- fn register_region_constraints ( & mut self , region_constraints : & QueryRegionConstraints < ' tcx > ) {
373
- for & ( ty:: OutlivesPredicate ( lhs, rhs) , _) in & region_constraints. outlives {
375
+ fn register_region_constraints (
376
+ & mut self ,
377
+ outlives : & [ ty:: OutlivesPredicate < ' tcx , ty:: GenericArg < ' tcx > > ] ,
378
+ ) {
379
+ for & ty:: OutlivesPredicate ( lhs, rhs) in outlives {
374
380
match lhs. unpack ( ) {
375
381
GenericArgKind :: Lifetime ( lhs) => self . register_region_outlives ( lhs, rhs) ,
376
382
GenericArgKind :: Type ( lhs) => self . register_ty_outlives ( lhs, rhs) ,
377
383
GenericArgKind :: Const ( _) => bug ! ( "const outlives: {lhs:?}: {rhs:?}" ) ,
378
384
}
379
385
}
380
-
381
- assert ! ( region_constraints. member_constraints. is_empty( ) ) ;
382
386
}
383
387
384
388
fn register_new_opaque_types ( & mut self , opaque_types : & [ ( ty:: OpaqueTypeKey < ' tcx > , Ty < ' tcx > ) ] ) {
0 commit comments