about summary refs log tree commit diff
path: root/src/librustc_data_structures/graph
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2020-04-21 08:52:29 +0000
committerNiko Matsakis <niko@alum.mit.edu>2020-04-21 08:57:14 +0000
commitcb9458d3ff7f64c309bc80776d71e4f73705f4ce (patch)
tree50f1e9dc6733e08b6257e039b4185fa60dc33af1 /src/librustc_data_structures/graph
parentc7526fec8ae3bbab08e7c4a59f9b4c9e627fbdda (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.rs5
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)
     }