summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_query_system/src/dep_graph/query.rs
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_query_system/src/dep_graph/query.rs
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_query_system/src/dep_graph/query.rs')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/query.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/query.rs b/compiler/rustc_query_system/src/dep_graph/query.rs
index 5cbc6bf8f..5969e5fbe 100644
--- a/compiler/rustc_query_system/src/dep_graph/query.rs
+++ b/compiler/rustc_query_system/src/dep_graph/query.rs
@@ -2,16 +2,16 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::graph::implementation::{Direction, Graph, NodeIndex, INCOMING};
use rustc_index::IndexVec;
-use super::{DepKind, DepNode, DepNodeIndex};
+use super::{DepNode, DepNodeIndex};
-pub struct DepGraphQuery<K> {
- pub graph: Graph<DepNode<K>, ()>,
- pub indices: FxHashMap<DepNode<K>, NodeIndex>,
+pub struct DepGraphQuery {
+ pub graph: Graph<DepNode, ()>,
+ pub indices: FxHashMap<DepNode, NodeIndex>,
pub dep_index_to_index: IndexVec<DepNodeIndex, Option<NodeIndex>>,
}
-impl<K: DepKind> DepGraphQuery<K> {
- pub fn new(prev_node_count: usize) -> DepGraphQuery<K> {
+impl DepGraphQuery {
+ pub fn new(prev_node_count: usize) -> DepGraphQuery {
let node_count = prev_node_count + prev_node_count / 4;
let edge_count = 6 * node_count;
@@ -22,7 +22,7 @@ impl<K: DepKind> DepGraphQuery<K> {
DepGraphQuery { graph, indices, dep_index_to_index }
}
- pub fn push(&mut self, index: DepNodeIndex, node: DepNode<K>, edges: &[DepNodeIndex]) {
+ pub fn push(&mut self, index: DepNodeIndex, node: DepNode, edges: &[DepNodeIndex]) {
let source = self.graph.add_node(node);
self.dep_index_to_index.insert(index, source);
self.indices.insert(node, source);
@@ -37,11 +37,11 @@ impl<K: DepKind> DepGraphQuery<K> {
}
}
- pub fn nodes(&self) -> Vec<&DepNode<K>> {
+ pub fn nodes(&self) -> Vec<&DepNode> {
self.graph.all_nodes().iter().map(|n| &n.data).collect()
}
- pub fn edges(&self) -> Vec<(&DepNode<K>, &DepNode<K>)> {
+ pub fn edges(&self) -> Vec<(&DepNode, &DepNode)> {
self.graph
.all_edges()
.iter()
@@ -50,7 +50,7 @@ impl<K: DepKind> DepGraphQuery<K> {
.collect()
}
- fn reachable_nodes(&self, node: &DepNode<K>, direction: Direction) -> Vec<&DepNode<K>> {
+ fn reachable_nodes(&self, node: &DepNode, direction: Direction) -> Vec<&DepNode> {
if let Some(&index) = self.indices.get(node) {
self.graph.depth_traverse(index, direction).map(|s| self.graph.node_data(s)).collect()
} else {
@@ -59,7 +59,7 @@ impl<K: DepKind> DepGraphQuery<K> {
}
/// All nodes that can reach `node`.
- pub fn transitive_predecessors(&self, node: &DepNode<K>) -> Vec<&DepNode<K>> {
+ pub fn transitive_predecessors(&self, node: &DepNode) -> Vec<&DepNode> {
self.reachable_nodes(node, INCOMING)
}
}