@@ -12,9 +12,9 @@ use rustc_mir_dataflow::points::DenseLocationMap;
1212use tracing:: debug;
1313
1414use super :: TypeChecker ;
15- use crate :: constraints:: OutlivesConstraintSet ;
15+ // use crate::constraints::OutlivesConstraintSet;
1616use crate :: region_infer:: values:: LivenessValues ;
17- use crate :: universal_regions:: UniversalRegions ;
17+ // use crate::universal_regions::UniversalRegions;
1818
1919mod local_use_map;
2020mod polonius;
@@ -37,11 +37,7 @@ pub(super) fn generate<'a, 'tcx>(
3737) {
3838 debug ! ( "liveness::generate" ) ;
3939
40- let free_regions = regions_that_outlive_free_regions (
41- typeck. infcx . num_region_vars ( ) ,
42- & typeck. universal_regions ,
43- & typeck. constraints . outlives_constraints ,
44- ) ;
40+ let free_regions = typeck. universal_regions . universal_regions_iter ( ) . collect ( ) ;
4541 let ( relevant_live_locals, boring_locals) =
4642 compute_relevant_live_locals ( typeck. tcx ( ) , & free_regions, body) ;
4743
@@ -88,45 +84,45 @@ fn compute_relevant_live_locals<'tcx>(
8884 ( relevant_live_locals, boring_locals)
8985}
9086
91- /// Computes all regions that are (currently) known to outlive free
92- /// regions. For these regions, we do not need to compute
93- /// liveness, since the outlives constraints will ensure that they
94- /// are live over the whole fn body anyhow.
95- fn regions_that_outlive_free_regions < ' tcx > (
96- num_region_vars : usize ,
97- universal_regions : & UniversalRegions < ' tcx > ,
98- constraint_set : & OutlivesConstraintSet < ' tcx > ,
99- ) -> FxHashSet < RegionVid > {
100- // Build a graph of the outlives constraints thus far. This is
101- // a reverse graph, so for each constraint `R1: R2` we have an
102- // edge `R2 -> R1`. Therefore, if we find all regions
103- // reachable from each free region, we will have all the
104- // regions that are forced to outlive some free region.
105- let rev_constraint_graph = constraint_set. reverse_graph ( num_region_vars) ;
106- let fr_static = universal_regions. fr_static ;
107- let rev_region_graph = rev_constraint_graph. region_graph ( constraint_set, fr_static) ;
108-
109- // Stack for the depth-first search. Start out with all the free regions.
110- let mut stack: Vec < _ > = universal_regions. universal_regions_iter ( ) . collect ( ) ;
111-
112- // Set of all free regions, plus anything that outlives them. Initially
113- // just contains the free regions.
114- let mut outlives_free_region: FxHashSet < _ > = stack. iter ( ) . cloned ( ) . collect ( ) ;
115-
116- // Do the DFS -- for each thing in the stack, find all things
117- // that outlive it and add them to the set. If they are not,
118- // push them onto the stack for later.
119- while let Some ( sub_region) = stack. pop ( ) {
120- stack. extend (
121- rev_region_graph
122- . outgoing_regions ( sub_region)
123- . filter ( |& r| outlives_free_region. insert ( r) ) ,
124- ) ;
125- }
126-
127- // Return the final set of things we visited.
128- outlives_free_region
129- }
87+ // // / Computes all regions that are (currently) known to outlive free
88+ // // / regions. For these regions, we do not need to compute
89+ // // / liveness, since the outlives constraints will ensure that they
90+ // // / are live over the whole fn body anyhow.
91+ // fn regions_that_outlive_free_regions<'tcx>(
92+ // num_region_vars: usize,
93+ // universal_regions: &UniversalRegions<'tcx>,
94+ // constraint_set: &OutlivesConstraintSet<'tcx>,
95+ // ) -> FxHashSet<RegionVid> {
96+ // // Build a graph of the outlives constraints thus far. This is
97+ // // a reverse graph, so for each constraint `R1: R2` we have an
98+ // // edge `R2 -> R1`. Therefore, if we find all regions
99+ // // reachable from each free region, we will have all the
100+ // // regions that are forced to outlive some free region.
101+ // let rev_constraint_graph = constraint_set.reverse_graph(num_region_vars);
102+ // let fr_static = universal_regions.fr_static;
103+ // let rev_region_graph = rev_constraint_graph.region_graph(constraint_set, fr_static);
104+
105+ // // Stack for the depth-first search. Start out with all the free regions.
106+ // let mut stack: Vec<_> = universal_regions.universal_regions_iter().collect();
107+
108+ // // Set of all free regions, plus anything that outlives them. Initially
109+ // // just contains the free regions.
110+ // let mut outlives_free_region: FxHashSet<_> = stack.iter().cloned().collect();
111+
112+ // // Do the DFS -- for each thing in the stack, find all things
113+ // // that outlive it and add them to the set. If they are not,
114+ // // push them onto the stack for later.
115+ // while let Some(sub_region) = stack.pop() {
116+ // stack.extend(
117+ // rev_region_graph
118+ // .outgoing_regions(sub_region)
119+ // .filter(|&r| outlives_free_region.insert(r)),
120+ // );
121+ // }
122+
123+ // // Return the final set of things we visited.
124+ // outlives_free_region
125+ // }
130126
131127/// Some variables are "regular live" at `location` -- i.e., they may be used later. This means that
132128/// all regions appearing in their type must be live at `location`.
0 commit comments