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-15 03:09:09 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-15 03:09:09 +0100
commitb43a29711e7ab50c1ee47a2d030273c83099b15e (patch)
tree47a43f9949c2b98ba192fc800452686d9051cfbe /compiler/rustc_query_system
parent9a847b1ea59090d9633a8dca75510cbe91589c00 (diff)
downloadrust-b43a29711e7ab50c1ee47a2d030273c83099b15e.tar.gz
rust-b43a29711e7ab50c1ee47a2d030273c83099b15e.zip
Fix `record_diagnostic`
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/graph.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs
index 985ca649034..bfd8b320715 100644
--- a/compiler/rustc_query_system/src/dep_graph/graph.rs
+++ b/compiler/rustc_query_system/src/dep_graph/graph.rs
@@ -538,10 +538,14 @@ impl<D: Deps> DepGraph<D> {
     #[inline]
     pub fn record_diagnostic<Qcx: QueryContext>(&self, qcx: Qcx, diagnostic: &DiagInner) {
         if let Some(ref data) = self.data {
-            self.read_index(data.encode_diagnostic(qcx, diagnostic));
+            D::read_deps(|task_deps| match task_deps {
+                TaskDepsRef::EvalAlways | TaskDepsRef::Ignore => return,
+                TaskDepsRef::Forbid | TaskDepsRef::Allow(..) => {
+                    self.read_index(data.encode_diagnostic(qcx, diagnostic));
+                }
+            })
         }
     }
-
     /// This forces a diagnostic node green by running its side effect. `prev_index` would
     /// refer to a node created used `encode_diagnostic` in the previous session.
     #[inline]