Skip to content

Commit 3f3c6fd

Browse files
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865
DepGraphQuery: correctly skip adding edges with not-yet-added nodes Fixes #142152. The current logic already skips some edges, so I'm not sure how critical it is to have *all* the edges recorded, the logic seems to only be used for debug dumping. Recording all edges requires supporting holes in the `LinkedGraph` data structure, to add nodes and edges out of order, #151821 implements that at cost of complicating the data structure.
2 parents 923fb76 + b0366ce commit 3f3c6fd

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

  • compiler/rustc_middle/src/dep_graph

compiler/rustc_middle/src/dep_graph/query.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ impl DepGraphQuery {
2828
self.indices.insert(node, source);
2929

3030
for &target in edges.iter() {
31-
let target = self.dep_index_to_index[target];
3231
// We may miss the edges that are pushed while the `DepGraphQuery` is being accessed.
3332
// Skip them to issues.
34-
if let Some(target) = target {
33+
if let Some(&Some(target)) = self.dep_index_to_index.get(target) {
3534
self.graph.add_edge(source, target, ());
3635
}
3736
}

0 commit comments

Comments
 (0)