Skip to content

Commit 272c324

Browse files
incr.comp.: Build DepGraphQuery from new dep-graph impl.
1 parent e6badfd commit 272c324

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/librustc/dep_graph/edges.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_data_structures::stable_hasher::StableHasher;
1414
use std::env;
1515
use std::hash::Hash;
1616
use std::mem;
17-
use super::{DepGraphQuery, DepKind, DepNode};
17+
use super::{DepKind, DepNode};
1818
use super::debug::EdgeFilter;
1919

2020
pub(super) struct DepGraphEdges {
@@ -89,10 +89,6 @@ impl DepGraphEdges {
8989
}
9090
}
9191

92-
fn id(&self, index: DepNodeIndex) -> DepNode {
93-
self.nodes[index.index()]
94-
}
95-
9692
pub fn push_ignore(&mut self) {
9793
self.task_stack.push(OpenTask::Ignore);
9894
}
@@ -231,13 +227,6 @@ impl DepGraphEdges {
231227
self.read(dep_node);
232228
}
233229

234-
pub fn query(&self) -> DepGraphQuery {
235-
let edges: Vec<_> = self.edges.iter()
236-
.map(|&(i, j)| (self.id(i), self.id(j)))
237-
.collect();
238-
DepGraphQuery::new(&self.nodes, &edges)
239-
}
240-
241230
#[inline]
242231
pub fn add_edge(&mut self, source: DepNode, target: DepNode) {
243232
let source = self.get_or_create_node(source);

src/librustc/dep_graph/graph.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,18 @@ impl DepGraph {
140140
}
141141

142142
pub fn query(&self) -> DepGraphQuery {
143-
self.data.as_ref().unwrap().edges.borrow().query()
143+
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
144+
let nodes: Vec<_> = current_dep_graph.nodes.iter().cloned().collect();
145+
let mut edges = Vec::new();
146+
for (index, edge_targets) in current_dep_graph.edges.iter_enumerated() {
147+
let from = current_dep_graph.nodes[index];
148+
for &edge_target in edge_targets {
149+
let to = current_dep_graph.nodes[edge_target];
150+
edges.push((from, to));
151+
}
152+
}
153+
154+
DepGraphQuery::new(&nodes[..], &edges[..])
144155
}
145156

146157
pub fn in_ignore<'graph>(&'graph self) -> Option<raii::IgnoreTask<'graph>> {

src/librustc_incremental/assert_dep_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
209209
}
210210
let query = tcx.dep_graph.query();
211211
for &(_, source_def_id, ref source_dep_node) in if_this_changed {
212-
let dependents = query.transitive_successors(source_dep_node);
212+
let dependents = query.transitive_predecessors(source_dep_node);
213213
for &(target_span, ref target_pass, _, ref target_dep_node) in then_this_would_need {
214214
if !dependents.contains(&target_dep_node) {
215215
tcx.sess.span_err(

0 commit comments

Comments
 (0)