about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/graph/mod.rs
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2024-04-14 15:15:03 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2024-04-14 15:46:40 +0000
commit398da593a53161c1ef9ca7dabbc5e9edf67deac6 (patch)
tree540996de1e73ca1f6c0ba581a1754b4a624bf519 /compiler/rustc_data_structures/src/graph/mod.rs
parent029cb1b13b6388b95e64e8996ec8b41a9f3cf16e (diff)
downloadrust-398da593a53161c1ef9ca7dabbc5e9edf67deac6.tar.gz
rust-398da593a53161c1ef9ca7dabbc5e9edf67deac6.zip
Merge `WithNumNodes` into DirectedGraph
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/mod.rs')
-rw-r--r--compiler/rustc_data_structures/src/graph/mod.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/compiler/rustc_data_structures/src/graph/mod.rs b/compiler/rustc_data_structures/src/graph/mod.rs
index e06ab2fe36b..853b8f1775e 100644
--- a/compiler/rustc_data_structures/src/graph/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/mod.rs
@@ -12,9 +12,7 @@ mod tests;
 
 pub trait DirectedGraph {
     type Node: Idx;
-}
 
-pub trait WithNumNodes: DirectedGraph {
     fn num_nodes(&self) -> usize;
 }
 
@@ -28,10 +26,7 @@ where
 {
     fn successors(&self, node: Self::Node) -> <Self as GraphSuccessors<'_>>::Iter;
 
-    fn depth_first_search(&self, from: Self::Node) -> iterate::DepthFirstSearch<'_, Self>
-    where
-        Self: WithNumNodes,
-    {
+    fn depth_first_search(&self, from: Self::Node) -> iterate::DepthFirstSearch<'_, Self> {
         iterate::DepthFirstSearch::new(self).with_start_node(from)
     }
 }
@@ -60,20 +55,20 @@ pub trait WithStartNode: DirectedGraph {
 }
 
 pub trait ControlFlowGraph:
-    DirectedGraph + WithStartNode + WithPredecessors + WithSuccessors + WithNumNodes
+    DirectedGraph + WithStartNode + WithPredecessors + WithSuccessors
 {
     // convenient trait
 }
 
 impl<T> ControlFlowGraph for T where
-    T: DirectedGraph + WithStartNode + WithPredecessors + WithSuccessors + WithNumNodes
+    T: DirectedGraph + WithStartNode + WithPredecessors + WithSuccessors
 {
 }
 
 /// Returns `true` if the graph has a cycle that is reachable from the start node.
 pub fn is_cyclic<G>(graph: &G) -> bool
 where
-    G: ?Sized + DirectedGraph + WithStartNode + WithSuccessors + WithNumNodes,
+    G: ?Sized + DirectedGraph + WithStartNode + WithSuccessors,
 {
     iterate::TriColorDepthFirstSearch::new(graph)
         .run_from_start(&mut iterate::CycleDetector)