Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions compiler/rustc_data_structures/src/graph/implementation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
//! the field `next_edge`). Each of those fields is an array that should
//! be indexed by the direction (see the type `Direction`).

use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
use rustc_index::bit_set::BitSet;
use std::fmt::Debug;

#[cfg(test)]
mod tests;

pub struct Graph<N, E> {
nodes: SnapshotVec<Node<N>>,
edges: SnapshotVec<Edge<E>>,
nodes: Vec<Node<N>>,
edges: Vec<Edge<E>>,
}

pub struct Node<N> {
Expand All @@ -45,20 +44,6 @@ pub struct Edge<E> {
pub data: E,
}

impl<N> SnapshotVecDelegate for Node<N> {
type Value = Node<N>;
type Undo = ();

fn reverse(_: &mut Vec<Node<N>>, _: ()) {}
}

impl<N> SnapshotVecDelegate for Edge<N> {
type Value = Edge<N>;
type Undo = ();

fn reverse(_: &mut Vec<Edge<N>>, _: ()) {}
}

#[derive(Copy, Clone, PartialEq, Debug)]
pub struct NodeIndex(pub usize);

Expand Down Expand Up @@ -86,11 +71,11 @@ impl NodeIndex {

impl<N: Debug, E: Debug> Graph<N, E> {
pub fn new() -> Graph<N, E> {
Graph { nodes: SnapshotVec::new(), edges: SnapshotVec::new() }
Graph { nodes: Vec::new(), edges: Vec::new() }
}

pub fn with_capacity(nodes: usize, edges: usize) -> Graph<N, E> {
Graph { nodes: SnapshotVec::with_capacity(nodes), edges: SnapshotVec::with_capacity(edges) }
Graph { nodes: Vec::with_capacity(nodes), edges: Vec::with_capacity(edges) }
}

// # Simple accessors
Expand Down