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 22:26:44 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-19 20:12:37 +0100
commit68fd771bc1f186bfa7e825d8a87ac8f06a6efced (patch)
tree73838df3071dbb5d8db54fc689b8719c80413ae1 /compiler/rustc_query_system
parentf5dc674bf898cbd1ee8e206a55450b0b2132c0c0 (diff)
downloadrust-68fd771bc1f186bfa7e825d8a87ac8f06a6efced.tar.gz
rust-68fd771bc1f186bfa7e825d8a87ac8f06a6efced.zip
Pass in dep kind names to the duplicate dep node check
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/mod.rs4
-rw-r--r--compiler/rustc_query_system/src/dep_graph/serialized.rs7
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/mod.rs b/compiler/rustc_query_system/src/dep_graph/mod.rs
index e3d64d1c0f8..4eeb6078d14 100644
--- a/compiler/rustc_query_system/src/dep_graph/mod.rs
+++ b/compiler/rustc_query_system/src/dep_graph/mod.rs
@@ -100,6 +100,8 @@ pub trait Deps {
     where
         OP: for<'a> FnOnce(TaskDepsRef<'a>);
 
+    fn name(&self, dep_kind: DepKind) -> &'static str;
+
     /// We use this for most things when incr. comp. is turned off.
     const DEP_KIND_NULL: DepKind;
 
@@ -154,7 +156,7 @@ pub enum FingerprintStyle {
 
 impl FingerprintStyle {
     #[inline]
-    pub fn reconstructible(self) -> bool {
+    pub const fn reconstructible(self) -> bool {
         match self {
             FingerprintStyle::DefPathHash | FingerprintStyle::Unit | FingerprintStyle::HirId => {
                 true
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs
index 8bd147c98fe..c96a5804772 100644
--- a/compiler/rustc_query_system/src/dep_graph/serialized.rs
+++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs
@@ -179,8 +179,8 @@ fn mask(bits: usize) -> usize {
 }
 
 impl SerializedDepGraph {
-    #[instrument(level = "debug", skip(d))]
-    pub fn decode<D: Deps>(d: &mut MemDecoder<'_>) -> Arc<SerializedDepGraph> {
+    #[instrument(level = "debug", skip(d, deps))]
+    pub fn decode<D: Deps>(d: &mut MemDecoder<'_>, deps: &D) -> Arc<SerializedDepGraph> {
         // The last 16 bytes are the node count and edge count.
         debug!("position: {:?}", d.position());
         let (node_count, edge_count) =
@@ -253,8 +253,9 @@ impl SerializedDepGraph {
 
         for (idx, node) in nodes.iter_enumerated() {
             if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
+                let name = deps.name(node.kind);
                 panic!(
-                    "Error: A dep graph node does not have an unique index. \
+                    "Error: A dep graph node ({name}) 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:?}"