incr.comp.: Build DepGraphQuery from new dep-graph impl.
This commit is contained in:
parent
e6badfd449
commit
272c324b25
@ -14,7 +14,7 @@ use rustc_data_structures::stable_hasher::StableHasher;
|
||||
use std::env;
|
||||
use std::hash::Hash;
|
||||
use std::mem;
|
||||
use super::{DepGraphQuery, DepKind, DepNode};
|
||||
use super::{DepKind, DepNode};
|
||||
use super::debug::EdgeFilter;
|
||||
|
||||
pub(super) struct DepGraphEdges {
|
||||
@ -89,10 +89,6 @@ impl DepGraphEdges {
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self, index: DepNodeIndex) -> DepNode {
|
||||
self.nodes[index.index()]
|
||||
}
|
||||
|
||||
pub fn push_ignore(&mut self) {
|
||||
self.task_stack.push(OpenTask::Ignore);
|
||||
}
|
||||
@ -231,13 +227,6 @@ impl DepGraphEdges {
|
||||
self.read(dep_node);
|
||||
}
|
||||
|
||||
pub fn query(&self) -> DepGraphQuery {
|
||||
let edges: Vec<_> = self.edges.iter()
|
||||
.map(|&(i, j)| (self.id(i), self.id(j)))
|
||||
.collect();
|
||||
DepGraphQuery::new(&self.nodes, &edges)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn add_edge(&mut self, source: DepNode, target: DepNode) {
|
||||
let source = self.get_or_create_node(source);
|
||||
|
@ -140,7 +140,18 @@ impl DepGraph {
|
||||
}
|
||||
|
||||
pub fn query(&self) -> DepGraphQuery {
|
||||
self.data.as_ref().unwrap().edges.borrow().query()
|
||||
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
|
||||
let nodes: Vec<_> = current_dep_graph.nodes.iter().cloned().collect();
|
||||
let mut edges = Vec::new();
|
||||
for (index, edge_targets) in current_dep_graph.edges.iter_enumerated() {
|
||||
let from = current_dep_graph.nodes[index];
|
||||
for &edge_target in edge_targets {
|
||||
let to = current_dep_graph.nodes[edge_target];
|
||||
edges.push((from, to));
|
||||
}
|
||||
}
|
||||
|
||||
DepGraphQuery::new(&nodes[..], &edges[..])
|
||||
}
|
||||
|
||||
pub fn in_ignore<'graph>(&'graph self) -> Option<raii::IgnoreTask<'graph>> {
|
||||
|
@ -209,7 +209,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
let query = tcx.dep_graph.query();
|
||||
for &(_, source_def_id, ref source_dep_node) in if_this_changed {
|
||||
let dependents = query.transitive_successors(source_dep_node);
|
||||
let dependents = query.transitive_predecessors(source_dep_node);
|
||||
for &(target_span, ref target_pass, _, ref target_dep_node) in then_this_would_need {
|
||||
if !dependents.contains(&target_dep_node) {
|
||||
tcx.sess.span_err(
|
||||
|
Loading…
Reference in New Issue
Block a user