From b43a29711e7ab50c1ee47a2d030273c83099b15e Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Sat, 15 Mar 2025 03:09:09 +0100 Subject: Fix `record_diagnostic` --- compiler/rustc_query_system/src/dep_graph/graph.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_query_system') 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 DepGraph { #[inline] pub fn record_diagnostic(&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] -- cgit 1.4.1-3-g733a5