From cb9458d3ff7f64c309bc80776d71e4f73705f4ce Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 21 Apr 2020 08:52:29 +0000 Subject: sccs are computed in dependency order We don't need the `scc_dependency_order` vector, `all_sccs` is already in dependency order. --- src/librustc_data_structures/graph/scc/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/librustc_data_structures') 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 Sccs { } /// 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 { (0..self.scc_data.len()).map(S::new) } -- cgit 1.4.1-3-g733a5