about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemy Rakic <remy.rakic@gmail.com>2019-11-19 16:53:52 +0100
committerRemy Rakic <remy.rakic@gmail.com>2019-12-06 11:50:01 +0100
commit4b16ae1609c65d337d4f22e2f4ddea0c4c467b3b (patch)
treeb60076dd31dbda430bd14bb93bbd643cefdfd709
parent479cc7ae9ab02700516829221291865944e2c6cb (diff)
downloadrust-4b16ae1609c65d337d4f22e2f4ddea0c4c467b3b.tar.gz
rust-4b16ae1609c65d337d4f22e2f4ddea0c4c467b3b.zip
Add a way to list the base non-transitive edges in `TransitiveRelation`
-rw-r--r--src/librustc_data_structures/transitive_relation.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs
index a3926c15551..bbf6999b983 100644
--- a/src/librustc_data_structures/transitive_relation.rs
+++ b/src/librustc_data_structures/transitive_relation.rs
@@ -373,6 +373,14 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
         }
         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<Item=(&T, &T)> {
+        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