summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_data_structures/src/graph
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /compiler/rustc_data_structures/src/graph
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_data_structures/src/graph')
-rw-r--r--compiler/rustc_data_structures/src/graph/dominators/mod.rs6
-rw-r--r--compiler/rustc_data_structures/src/graph/implementation/mod.rs23
2 files changed, 7 insertions, 22 deletions
diff --git a/compiler/rustc_data_structures/src/graph/dominators/mod.rs b/compiler/rustc_data_structures/src/graph/dominators/mod.rs
index 85ef2de9b..4075481e5 100644
--- a/compiler/rustc_data_structures/src/graph/dominators/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/dominators/mod.rs
@@ -51,7 +51,7 @@ pub fn dominators<G: ControlFlowGraph>(graph: &G) -> Dominators<G::Node> {
// Traverse the graph, collecting a number of things:
//
// * Preorder mapping (to it, and back to the actual ordering)
- // * Postorder mapping (used exclusively for rank_partial_cmp on the final product)
+ // * Postorder mapping (used exclusively for `cmp_in_dominator_order` on the final product)
// * Parents for each vertex in the preorder tree
//
// These are all done here rather than through one of the 'standard'
@@ -342,8 +342,8 @@ impl<Node: Idx> Dominators<Node> {
/// relationship, the dominator will always precede the dominated. (The relative ordering
/// of two unrelated nodes will also be consistent, but otherwise the order has no
/// meaning.) This method cannot be used to determine if either Node dominates the other.
- pub fn rank_partial_cmp(&self, lhs: Node, rhs: Node) -> Option<Ordering> {
- self.post_order_rank[rhs].partial_cmp(&self.post_order_rank[lhs])
+ pub fn cmp_in_dominator_order(&self, lhs: Node, rhs: Node) -> Ordering {
+ self.post_order_rank[rhs].cmp(&self.post_order_rank[lhs])
}
/// Returns true if `a` dominates `b`.
diff --git a/compiler/rustc_data_structures/src/graph/implementation/mod.rs b/compiler/rustc_data_structures/src/graph/implementation/mod.rs
index 9ff401c3c..3910c6fa4 100644
--- a/compiler/rustc_data_structures/src/graph/implementation/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/implementation/mod.rs
@@ -20,7 +20,6 @@
//! 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;
@@ -28,8 +27,8 @@ use std::fmt::Debug;
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> {
@@ -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);
@@ -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