From 8252a6eddfc59328fe6ac36ef09feb2844f28fa2 Mon Sep 17 00:00:00 2001 From: b-naber Date: Tue, 21 Feb 2023 21:54:53 +0000 Subject: address review --- .../rustc_data_structures/src/graph/scc/mod.rs | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_data_structures/src') diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index e2fe5285aad..c4b11951ab7 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -21,21 +21,21 @@ mod tests; pub struct Sccs { /// For each node, what is the SCC index of the SCC to which it /// belongs. - pub scc_indices: IndexVec, + scc_indices: IndexVec, /// Data about each SCC. - pub scc_data: SccData, + scc_data: SccData, } pub struct SccData { /// For each SCC, the range of `all_successors` where its /// successors can be found. - pub ranges: IndexVec>, + ranges: IndexVec>, /// Contains the successors for all the Sccs, concatenated. The /// range of indices corresponding to a given SCC is found in its /// SccData. - pub all_successors: Vec, + all_successors: Vec, } impl Sccs { @@ -43,6 +43,14 @@ impl Sccs { SccsConstruction::construct(graph) } + pub fn scc_indices(&self) -> &IndexVec { + &self.scc_indices + } + + pub fn scc_data(&self) -> &SccData { + &self.scc_data + } + /// Returns the number of SCCs in the graph. pub fn num_sccs(&self) -> usize { self.scc_data.len() @@ -115,6 +123,14 @@ impl SccData { self.ranges.len() } + pub fn ranges(&self) -> &IndexVec> { + &self.ranges + } + + pub fn all_successors(&self) -> &Vec { + &self.all_successors + } + /// Returns the successors of the given SCC. fn successors(&self, scc: S) -> &[S] { // Annoyingly, `range` does not implement `Copy`, so we have -- cgit 1.4.1-3-g733a5