@@ -135,8 +135,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
135135 // Remove any trivial region constraints once we've resolved regions
136136 external_constraints
137137 . 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 ) ) ;
140139
141140 let canonical = Canonicalizer :: canonicalize (
142141 self . infcx ,
@@ -193,19 +192,23 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
193192 // Cannot use `take_registered_region_obligations` as we may compute the response
194193 // inside of a `probe` whenever we have multiple choices inside of the solver.
195194 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![ ] ) ;
206206 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 ( )
209212 } else {
210213 Default :: default ( )
211214 } ;
@@ -369,16 +372,17 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
369372 }
370373 }
371374
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 {
374380 match lhs. unpack ( ) {
375381 GenericArgKind :: Lifetime ( lhs) => self . register_region_outlives ( lhs, rhs) ,
376382 GenericArgKind :: Type ( lhs) => self . register_ty_outlives ( lhs, rhs) ,
377383 GenericArgKind :: Const ( _) => bug ! ( "const outlives: {lhs:?}: {rhs:?}" ) ,
378384 }
379385 }
380-
381- assert ! ( region_constraints. member_constraints. is_empty( ) ) ;
382386 }
383387
384388 fn register_new_opaque_types ( & mut self , opaque_types : & [ ( ty:: OpaqueTypeKey < ' tcx > , Ty < ' tcx > ) ] ) {
0 commit comments