From 9a847b1ea59090d9633a8dca75510cbe91589c00 Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Fri, 14 Mar 2025 18:55:02 +0100 Subject: Add comments --- compiler/rustc_query_system/src/dep_graph/graph.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (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 dbc7f034a6e..985ca649034 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -533,6 +533,8 @@ impl DepGraph { } } + /// This encodes a diagnostic by creating a node with an unique index and assoicating + /// `diagnostic` with it, for use in the next session. #[inline] pub fn record_diagnostic(&self, qcx: Qcx, diagnostic: &DiagInner) { if let Some(ref data) = self.data { @@ -540,6 +542,8 @@ impl DepGraph { } } + /// 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] pub fn force_diagnostic_node( &self, @@ -673,12 +677,15 @@ impl DepGraphData { self.debug_loaded_from_disk.lock().insert(dep_node); } + /// This encodes a diagnostic by creating a node with an unique index and assoicating + /// `diagnostic` with it, for use in the next session. #[inline] fn encode_diagnostic( &self, qcx: Qcx, diagnostic: &DiagInner, ) -> DepNodeIndex { + // Use `send` so we get an unique index, even though the dep node is not. let dep_node_index = self.current.encoder.send( DepNode { kind: D::DEP_KIND_SIDE_EFFECT, @@ -694,6 +701,8 @@ impl DepGraphData { dep_node_index } + /// 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] fn force_diagnostic_node( &self, -- cgit 1.4.1-3-g733a5