diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2024-04-14 15:40:26 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2024-04-14 15:48:53 +0000 |
| commit | 0d5fc9bf584f0e8700f0c3d2854bb6c70453f624 (patch) | |
| tree | 163982785183644158a7d71d90407fa85e9a41a1 /compiler/rustc_data_structures/src/graph/vec_graph | |
| parent | 398da593a53161c1ef9ca7dabbc5e9edf67deac6 (diff) | |
| download | rust-0d5fc9bf584f0e8700f0c3d2854bb6c70453f624.tar.gz rust-0d5fc9bf584f0e8700f0c3d2854bb6c70453f624.zip | |
Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}`
Now with GAT!
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/vec_graph')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/vec_graph/mod.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs index 79efe3fb8e0..8b75fd9f633 100644 --- a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs +++ b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs @@ -1,4 +1,4 @@ -use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithSuccessors}; +use crate::graph::{DirectedGraph, Successors, WithNumEdges}; use rustc_index::{Idx, IndexVec}; #[cfg(test)] @@ -92,14 +92,10 @@ impl<N: Idx> WithNumEdges for VecGraph<N> { } } -impl<'graph, N: Idx> GraphSuccessors<'graph> for VecGraph<N> { - type Item = N; +impl<N: Idx + Ord> Successors for VecGraph<N> { + type Successors<'g> = std::iter::Cloned<std::slice::Iter<'g, N>>; - type Iter = std::iter::Cloned<std::slice::Iter<'graph, N>>; -} - -impl<N: Idx + Ord> WithSuccessors for VecGraph<N> { - fn successors(&self, node: N) -> <Self as GraphSuccessors<'_>>::Iter { + fn successors(&self, node: N) -> Self::Successors<'_> { self.successors(node).iter().cloned() } } |
