RegionInferenceContext: remove Rc from rev_scc_graph field
This commit is contained in:
parent
d3edfd18c7
commit
a621ec35ae
2 changed files with 8 additions and 11 deletions
|
@ -76,7 +76,7 @@ pub struct RegionInferenceContext<'tcx> {
|
||||||
/// Reverse of the SCC constraint graph -- i.e., an edge `A -> B` exists if
|
/// Reverse of the SCC constraint graph -- i.e., an edge `A -> B` exists if
|
||||||
/// `B: A`. This is used to compute the universal regions that are required
|
/// `B: A`. This is used to compute the universal regions that are required
|
||||||
/// to outlive a given SCC. Computed lazily.
|
/// to outlive a given SCC. Computed lazily.
|
||||||
rev_scc_graph: Option<Rc<ReverseSccGraph>>,
|
rev_scc_graph: Option<ReverseSccGraph>,
|
||||||
|
|
||||||
/// The "R0 member of [R1..Rn]" constraints, indexed by SCC.
|
/// The "R0 member of [R1..Rn]" constraints, indexed by SCC.
|
||||||
member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>,
|
member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>,
|
||||||
|
@ -813,9 +813,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
// free region that must outlive the member region `R0` (`UB:
|
// free region that must outlive the member region `R0` (`UB:
|
||||||
// R0`). Therefore, we need only keep an option `O` if `UB: O`
|
// R0`). Therefore, we need only keep an option `O` if `UB: O`
|
||||||
// for all UB.
|
// for all UB.
|
||||||
let rev_scc_graph = self.reverse_scc_graph();
|
self.compute_reverse_scc_graph();
|
||||||
let universal_region_relations = &self.universal_region_relations;
|
let universal_region_relations = &self.universal_region_relations;
|
||||||
for ub in rev_scc_graph.upper_bounds(scc) {
|
for ub in self.rev_scc_graph.as_ref().unwrap().upper_bounds(scc) {
|
||||||
debug!(?ub);
|
debug!(?ub);
|
||||||
choice_regions.retain(|&o_r| universal_region_relations.outlives(ub, o_r));
|
choice_regions.retain(|&o_r| universal_region_relations.outlives(ub, o_r));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use rustc_data_structures::graph::vec_graph::VecGraph;
|
||||||
use rustc_data_structures::graph::WithSuccessors;
|
use rustc_data_structures::graph::WithSuccessors;
|
||||||
use rustc_middle::ty::RegionVid;
|
use rustc_middle::ty::RegionVid;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
pub(crate) struct ReverseSccGraph {
|
pub(crate) struct ReverseSccGraph {
|
||||||
graph: VecGraph<ConstraintSccIndex>,
|
graph: VecGraph<ConstraintSccIndex>,
|
||||||
|
@ -40,10 +39,10 @@ impl ReverseSccGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RegionInferenceContext<'_> {
|
impl RegionInferenceContext<'_> {
|
||||||
/// Compute and return the reverse SCC-based constraint graph (lazily).
|
/// Compute the reverse SCC-based constraint graph (lazily).
|
||||||
pub(super) fn reverse_scc_graph(&mut self) -> Rc<ReverseSccGraph> {
|
pub(super) fn compute_reverse_scc_graph(&mut self) {
|
||||||
if let Some(g) = &self.rev_scc_graph {
|
if matches!(self.rev_scc_graph, Some(_)) {
|
||||||
return g.clone();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let graph = self.constraint_sccs.reverse();
|
let graph = self.constraint_sccs.reverse();
|
||||||
|
@ -63,8 +62,6 @@ impl RegionInferenceContext<'_> {
|
||||||
start += group_size;
|
start += group_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rev_graph = Rc::new(ReverseSccGraph { graph, scc_regions, universal_regions });
|
self.rev_scc_graph = Some(ReverseSccGraph { graph, scc_regions, universal_regions });
|
||||||
self.rev_scc_graph = Some(rev_graph.clone());
|
|
||||||
rev_graph
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue