From 4b16ae1609c65d337d4f22e2f4ddea0c4c467b3b Mon Sep 17 00:00:00 2001 From: Remy Rakic Date: Tue, 19 Nov 2019 16:53:52 +0100 Subject: [PATCH] Add a way to list the base non-transitive edges in `TransitiveRelation` --- src/librustc_data_structures/transitive_relation.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index a3926c155517..bbf6999b9837 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -373,6 +373,14 @@ impl TransitiveRelation { } matrix } + + /// Lists all the base edges in the graph: the initial _non-transitive_ set of element + /// relations, which will be later used as the basis for the transitive closure computation. + pub fn base_edges(&self) -> impl Iterator { + self.edges + .iter() + .map(move |edge| (&self.elements[edge.source.0], &self.elements[edge.target.0])) + } } /// Pare down is used as a step in the LUB computation. It edits the