diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2020-04-21 08:52:29 +0000 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2020-04-21 08:57:14 +0000 |
| commit | cb9458d3ff7f64c309bc80776d71e4f73705f4ce (patch) | |
| tree | 50f1e9dc6733e08b6257e039b4185fa60dc33af1 /src/librustc_data_structures/graph | |
| parent | c7526fec8ae3bbab08e7c4a59f9b4c9e627fbdda (diff) | |
sccs are computed in dependency order
We don't need the `scc_dependency_order` vector, `all_sccs` is already in dependency order.
Diffstat (limited to 'src/librustc_data_structures/graph')
| -rw-r--r-- | src/librustc_data_structures/graph/scc/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc_data_structures/graph/scc/mod.rs b/src/librustc_data_structures/graph/scc/mod.rs index 7ecf3e3cb8d..57eaf56f268 100644 --- a/src/librustc_data_structures/graph/scc/mod.rs +++ b/src/librustc_data_structures/graph/scc/mod.rs @@ -47,6 +47,11 @@ impl<N: Idx, S: Idx> Sccs<N, S> { } /// Returns an iterator over the SCCs in the graph. + /// + /// The SCCs will be iterated in **dependency order** (or **post order**), + /// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after. + /// This is convenient when the edges represent dependencies: when you visit + /// `S1`, the value for `S2` will already have been computed. pub fn all_sccs(&self) -> impl Iterator<Item = S> { (0..self.scc_data.len()).map(S::new) } |
