about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-18 00:26:32 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-19 20:12:37 +0100
commitbd8b62826267e9c2ce0669383ed0875b2a85cb9a (patch)
treea31ca649791da1c06db9669924d6d7ab3816c288 /compiler/rustc_query_system
parentcdbf19a6fbb4446fe4dea62187a0924318c7c2c8 (diff)
Check for duplicate dep nodes when creating the index
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/serialized.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs
index 2c6fd7d494f..8bd147c98fe 100644
--- a/compiler/rustc_query_system/src/dep_graph/serialized.rs
+++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs
@@ -252,7 +252,14 @@ impl SerializedDepGraph {
             .collect();
 
         for (idx, node) in nodes.iter_enumerated() {
-            index[node.kind.as_usize()].insert(node.hash, idx);
+            if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
+                panic!(
+                    "Error: A dep graph node does not have an unique index. \
+                     Running a clean build on a nightly compiler with `-Z incremental-verify-ich` \
+                     can help narrow down the issue for reporting. A clean build may also work around the issue.\n
+                     DepNode: {node:?}"
+                )
+            }
         }
 
         Arc::new(SerializedDepGraph {