about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-04-29 11:01:51 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-05-17 20:42:03 +0000
commit3bb5d1dfc1a959d6eecc8c4025ffe96fc355af1b (patch)
tree6ecb8a485ea30961dc55d67e892ebf3594e5a52c /compiler/rustc_query_system
parent222acaa23e2c0e09687b04e3243fad18f4909f30 (diff)
downloadrust-3bb5d1dfc1a959d6eecc8c4025ffe96fc355af1b.tar.gz
rust-3bb5d1dfc1a959d6eecc8c4025ffe96fc355af1b.zip
Delay a bug when overwriting fed value.
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index dbfe62ae6e9..730e4c8d30d 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -433,16 +433,22 @@ where
                 (hasher(&mut hcx, &cached_result), hasher(&mut hcx, &result))
             });
             let formatter = query.format_value();
-            debug_assert_eq!(
-                old_hash,
-                new_hash,
-                "Computed query value for {:?}({:?}) is inconsistent with fed value,\n\
-                computed={:#?}\nfed={:#?}",
-                query.dep_kind(),
-                key,
-                formatter(&result),
-                formatter(&cached_result),
-            );
+            if old_hash != new_hash {
+                // We have an inconsistency. This can happen if one of the two
+                // results is tainted by errors. In this case, delay a bug to
+                // ensure compilation is doomed.
+                qcx.dep_context().sess().delay_span_bug(
+                    DUMMY_SP,
+                    format!(
+                        "Computed query value for {:?}({:?}) is inconsistent with fed value,\n\
+                        computed={:#?}\nfed={:#?}",
+                        query.dep_kind(),
+                        key,
+                        formatter(&result),
+                        formatter(&cached_result),
+                    ),
+                );
+            }
         }
     }
     job_owner.complete(cache, result, dep_node_index);