Skip to content

Commit 9227452

Browse files
committed
Recover another check.
1 parent 3a8b357 commit 9227452

File tree

1 file changed

+18
-0
lines changed
  • compiler/rustc_query_system/src/dep_graph

1 file changed

+18
-0
lines changed

compiler/rustc_query_system/src/dep_graph/graph.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
13391339
prev_graph: &SerializedDepGraph<K>,
13401340
prev_index: SerializedDepNodeIndex,
13411341
) -> DepNodeIndex {
1342+
self.debug_assert_not_in_new_nodes(prev_graph, prev_index);
1343+
13421344
let mut prev_index_to_index = self.prev_index_to_index.lock();
13431345

13441346
match prev_index_to_index[prev_index] {
@@ -1359,6 +1361,22 @@ impl<K: DepKind> CurrentDepGraph<K> {
13591361
}
13601362
}
13611363
}
1364+
1365+
#[inline]
1366+
fn debug_assert_not_in_new_nodes(
1367+
&self,
1368+
prev_graph: &SerializedDepGraph<K>,
1369+
prev_index: SerializedDepNodeIndex,
1370+
) {
1371+
let node = &prev_graph.index_to_node(prev_index);
1372+
debug_assert!(
1373+
!self
1374+
.nodes_newly_allocated_in_current_session
1375+
.as_ref()
1376+
.map_or(false, |set| set.lock().contains(node)),
1377+
"node from previous graph present in new node collection"
1378+
);
1379+
}
13621380
}
13631381

13641382
/// The capacity of the `reads` field `SmallVec`

0 commit comments

Comments
 (0)