Skip to content

Commit b679a03

Browse files
committed
use singly connected components in analysis
1 parent 65de226 commit b679a03

File tree

2 files changed

+316
-83
lines changed

2 files changed

+316
-83
lines changed

compiler/rustc_data_structures/src/graph/implementation/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
2323
use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
2424
use rustc_index::bit_set::BitSet;
25+
use rustc_index::Idx;
2526
use std::fmt::Debug;
2627

2728
#[cfg(test)]
@@ -59,9 +60,19 @@ impl<N> SnapshotVecDelegate for Edge<N> {
5960
fn reverse(_: &mut Vec<Edge<N>>, _: ()) {}
6061
}
6162

62-
#[derive(Copy, Clone, PartialEq, Debug)]
63+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Ord, PartialOrd)]
6364
pub struct NodeIndex(pub usize);
6465

66+
impl Idx for NodeIndex {
67+
fn new(idx: usize) -> Self {
68+
NodeIndex(idx)
69+
}
70+
71+
fn index(self) -> usize {
72+
self.0
73+
}
74+
}
75+
6576
#[derive(Copy, Clone, PartialEq, Debug)]
6677
pub struct EdgeIndex(pub usize);
6778

0 commit comments

Comments
 (0)