Skip to content

Commit

Permalink
Rollup merge of #115319 - klensy:no-snapshot-in-graph, r=WaffleLapkin
Browse files Browse the repository at this point in the history
don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead

`Graph` don't use `SnapshotVec` methods, so use simple `Vec` instead?
  • Loading branch information
matthiaskrgr authored Aug 28, 2023
2 parents 7b6d264 + 3b26b3d commit de6b03b
Showing 1 changed file with 4 additions and 19 deletions.
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

0 comments on commit de6b03b

Please sign in to comment.