Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead #115319

Merged
merged 1 commit into from
Aug 28, 2023
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