@@ -191,10 +191,6 @@ pub struct RegionInferenceContext<'tcx> {
191191 /// Type constraints that we check after solving.
192192 type_tests : Vec < TypeTest < ' tcx > > ,
193193
194- /// Information about the universally quantified regions in scope
195- /// on this function.
196- universal_regions : Rc < UniversalRegions < ' tcx > > ,
197-
198194 /// Information about how the universally quantified regions in
199195 /// scope on this function relate to one another.
200196 universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
@@ -399,7 +395,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
399395 pub ( crate ) fn new (
400396 infcx : & BorrowckInferCtxt < ' tcx > ,
401397 var_infos : VarInfos ,
402- universal_regions : Rc < UniversalRegions < ' tcx > > ,
403398 placeholder_indices : Rc < PlaceholderIndices > ,
404399 universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
405400 mut outlives_constraints : OutlivesConstraintSet < ' tcx > ,
@@ -409,7 +404,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
409404 liveness_constraints : LivenessValues ,
410405 elements : Rc < DenseLocationMap > ,
411406 ) -> Self {
412- debug ! ( "universal_regions: {:#?}" , universal_regions) ;
407+ let universal_regions = & universal_region_relations. universal_regions ;
408+
409+ debug ! ( "universal_regions: {:#?}" , universal_region_relations. universal_regions) ;
413410 debug ! ( "outlives constraints: {:#?}" , outlives_constraints) ;
414411 debug ! ( "placeholder_indices: {:#?}" , placeholder_indices) ;
415412 debug ! ( "type tests: {:#?}" , type_tests) ;
@@ -453,7 +450,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
453450 universe_causes,
454451 scc_values,
455452 type_tests,
456- universal_regions,
457453 universal_region_relations,
458454 } ;
459455
@@ -518,7 +514,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
518514 fn init_free_and_bound_regions ( & mut self ) {
519515 // Update the names (if any)
520516 // This iterator has unstable order but we collect it all into an IndexVec
521- for ( external_name, variable) in self . universal_regions . named_universal_regions ( ) {
517+ for ( external_name, variable) in
518+ self . universal_region_relations . universal_regions . named_universal_regions_iter ( )
519+ {
522520 debug ! (
523521 "init_free_and_bound_regions: region {:?} has external name {:?}" ,
524522 variable, external_name
@@ -562,7 +560,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
562560 ///
563561 /// (Panics if `r` is not a registered universal region.)
564562 pub ( crate ) fn to_region_vid ( & self , r : ty:: Region < ' tcx > ) -> RegionVid {
565- self . universal_regions . to_region_vid ( r)
563+ self . universal_regions ( ) . to_region_vid ( r)
566564 }
567565
568566 /// Returns an iterator over all the outlives constraints.
@@ -574,7 +572,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
574572
575573 /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
576574 pub ( crate ) fn annotate ( & self , tcx : TyCtxt < ' tcx > , err : & mut Diag < ' _ , ( ) > ) {
577- self . universal_regions . annotate ( tcx, err)
575+ self . universal_regions ( ) . annotate ( tcx, err)
578576 }
579577
580578 /// Returns `true` if the region `r` contains the point `p`.
@@ -686,7 +684,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
686684 if outlives_requirements. is_empty ( ) {
687685 ( None , errors_buffer)
688686 } else {
689- let num_external_vids = self . universal_regions . num_global_and_external_regions ( ) ;
687+ let num_external_vids = self . universal_regions ( ) . num_global_and_external_regions ( ) ;
690688 (
691689 Some ( ClosureRegionRequirements { num_external_vids, outlives_requirements } ) ,
692690 errors_buffer,
@@ -989,7 +987,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
989987 // always be in the root universe.
990988 if let Some ( p) = self . scc_values . placeholders_contained_in ( r_scc) . next ( ) {
991989 debug ! ( "encountered placeholder in higher universe: {:?}, requiring 'static" , p) ;
992- let static_r = self . universal_regions . fr_static ;
990+ let static_r = self . universal_regions ( ) . fr_static ;
993991 propagated_outlives_requirements. push ( ClosureOutlivesRequirement {
994992 subject,
995993 outlived_free_region : static_r,
@@ -1032,8 +1030,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10321030 // avoid potential non-determinism we approximate this by requiring
10331031 // T: '1 and T: '2.
10341032 for upper_bound in non_local_ub {
1035- debug_assert ! ( self . universal_regions. is_universal_region( upper_bound) ) ;
1036- debug_assert ! ( !self . universal_regions. is_local_free_region( upper_bound) ) ;
1033+ debug_assert ! ( self . universal_regions( ) . is_universal_region( upper_bound) ) ;
1034+ debug_assert ! ( !self . universal_regions( ) . is_local_free_region( upper_bound) ) ;
10371035
10381036 let requirement = ClosureOutlivesRequirement {
10391037 subject,
@@ -1101,7 +1099,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11011099 // To do so, we simply check every candidate `u_r` for equality.
11021100 self . scc_values
11031101 . universal_regions_outlived_by ( r_scc)
1104- . filter ( |& u_r| !self . universal_regions . is_local_free_region ( u_r) )
1102+ . filter ( |& u_r| !self . universal_regions ( ) . is_local_free_region ( u_r) )
11051103 . find ( |& u_r| self . eval_equal ( u_r, r_vid) )
11061104 . map ( |u_r| ty:: Region :: new_var ( tcx, u_r) )
11071105 // In case we could not find a named region to map to,
@@ -1139,9 +1137,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11391137
11401138 // Find the smallest universal region that contains all other
11411139 // universal regions within `region`.
1142- let mut lub = self . universal_regions . fr_fn_body ;
1140+ let mut lub = self . universal_regions ( ) . fr_fn_body ;
11431141 let r_scc = self . constraint_sccs . scc ( r) ;
1144- let static_r = self . universal_regions . fr_static ;
1142+ let static_r = self . universal_regions ( ) . fr_static ;
11451143 for ur in self . scc_values . universal_regions_outlived_by ( r_scc) {
11461144 let new_lub = self . universal_region_relations . postdom_upper_bound ( lub, ur) ;
11471145 debug ! ( ?ur, ?lub, ?new_lub) ;
@@ -1288,12 +1286,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
12881286 debug ! (
12891287 "sup_region's value = {:?} universal={:?}" ,
12901288 self . region_value_str( sup_region) ,
1291- self . universal_regions. is_universal_region( sup_region) ,
1289+ self . universal_regions( ) . is_universal_region( sup_region) ,
12921290 ) ;
12931291 debug ! (
12941292 "sub_region's value = {:?} universal={:?}" ,
12951293 self . region_value_str( sub_region) ,
1296- self . universal_regions. is_universal_region( sub_region) ,
1294+ self . universal_regions( ) . is_universal_region( sub_region) ,
12971295 ) ;
12981296
12991297 let sub_region_scc = self . constraint_sccs . scc ( sub_region) ;
@@ -1308,7 +1306,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13081306 by super `{sup_region_scc:?}`, promoting to static",
13091307 ) ;
13101308
1311- return self . eval_outlives ( sup_region, self . universal_regions . fr_static ) ;
1309+ return self . eval_outlives ( sup_region, self . universal_regions ( ) . fr_static ) ;
13121310 }
13131311
13141312 // Both the `sub_region` and `sup_region` consist of the union
@@ -1332,7 +1330,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13321330 // Now we have to compare all the points in the sub region and make
13331331 // sure they exist in the sup region.
13341332
1335- if self . universal_regions . is_universal_region ( sup_region) {
1333+ if self . universal_regions ( ) . is_universal_region ( sup_region) {
13361334 // Micro-opt: universal regions contain all points.
13371335 debug ! ( "super is universal and hence contains all points" ) ;
13381336 return true ;
@@ -1736,7 +1734,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17361734 debug ! ( "provides_universal_region(r={:?}, fr1={:?}, fr2={:?})" , r, fr1, fr2) ;
17371735 let result = {
17381736 r == fr2 || {
1739- fr2 == self . universal_regions . fr_static && self . cannot_name_placeholder ( fr1, r)
1737+ fr2 == self . universal_regions ( ) . fr_static && self . cannot_name_placeholder ( fr1, r)
17401738 }
17411739 } ;
17421740 debug ! ( "provides_universal_region: result = {:?}" , result) ;
@@ -1837,7 +1835,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
18371835
18381836 // A constraint like `'r: 'x` can come from our constraint
18391837 // graph.
1840- let fr_static = self . universal_regions . fr_static ;
1838+ let fr_static = self . universal_regions ( ) . fr_static ;
18411839 let outgoing_edges_from_graph =
18421840 self . constraint_graph . outgoing_edges ( r, & self . constraints , fr_static) ;
18431841
@@ -1952,7 +1950,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19521950 }
19531951
19541952 pub ( crate ) fn universal_regions ( & self ) -> & UniversalRegions < ' tcx > {
1955- self . universal_regions . as_ref ( )
1953+ & self . universal_region_relations . universal_regions
19561954 }
19571955
19581956 /// Tries to find the best constraint to blame for the fact that
@@ -2212,7 +2210,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
22122210
22132211 /// Access to the region graph, built from the outlives constraints.
22142212 pub ( crate ) fn region_graph ( & self ) -> RegionGraph < ' _ , ' tcx , graph:: Normal > {
2215- self . constraint_graph . region_graph ( & self . constraints , self . universal_regions . fr_static )
2213+ self . constraint_graph . region_graph ( & self . constraints , self . universal_regions ( ) . fr_static )
22162214 }
22172215
22182216 /// Returns whether the given region is considered live at all points: whether it is a
0 commit comments