Skip to content

Commit

Permalink
Recover another check.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jul 14, 2023
1 parent 3a8b357 commit 9227452
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
prev_graph: &SerializedDepGraph<K>,
prev_index: SerializedDepNodeIndex,
) -> DepNodeIndex {
self.debug_assert_not_in_new_nodes(prev_graph, prev_index);

let mut prev_index_to_index = self.prev_index_to_index.lock();

match prev_index_to_index[prev_index] {
Expand All @@ -1359,6 +1361,22 @@ impl<K: DepKind> CurrentDepGraph<K> {
}
}
}

#[inline]
fn debug_assert_not_in_new_nodes(
&self,
prev_graph: &SerializedDepGraph<K>,
prev_index: SerializedDepNodeIndex,
) {
let node = &prev_graph.index_to_node(prev_index);
debug_assert!(
!self
.nodes_newly_allocated_in_current_session
.as_ref()
.map_or(false, |set| set.lock().contains(node)),
"node from previous graph present in new node collection"
);
}
}

/// The capacity of the `reads` field `SmallVec`
Expand Down

0 comments on commit 9227452

Please sign in to comment.