Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9a847b1

Browse files
committedMar 14, 2025
Add comments
1 parent 453b51a commit 9a847b1

File tree

1 file changed

+9
-0
lines changed
  • compiler/rustc_query_system/src/dep_graph

1 file changed

+9
-0
lines changed
 

‎compiler/rustc_query_system/src/dep_graph/graph.rs

+9
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,17 @@ impl<D: Deps> DepGraph<D> {
533533
}
534534
}
535535

536+
/// This encodes a diagnostic by creating a node with an unique index and assoicating
537+
/// `diagnostic` with it, for use in the next session.
536538
#[inline]
537539
pub fn record_diagnostic<Qcx: QueryContext>(&self, qcx: Qcx, diagnostic: &DiagInner) {
538540
if let Some(ref data) = self.data {
539541
self.read_index(data.encode_diagnostic(qcx, diagnostic));
540542
}
541543
}
542544

545+
/// This forces a diagnostic node green by running its side effect. `prev_index` would
546+
/// refer to a node created used `encode_diagnostic` in the previous session.
543547
#[inline]
544548
pub fn force_diagnostic_node<Qcx: QueryContext>(
545549
&self,
@@ -673,12 +677,15 @@ impl<D: Deps> DepGraphData<D> {
673677
self.debug_loaded_from_disk.lock().insert(dep_node);
674678
}
675679

680+
/// This encodes a diagnostic by creating a node with an unique index and assoicating
681+
/// `diagnostic` with it, for use in the next session.
676682
#[inline]
677683
fn encode_diagnostic<Qcx: QueryContext>(
678684
&self,
679685
qcx: Qcx,
680686
diagnostic: &DiagInner,
681687
) -> DepNodeIndex {
688+
// Use `send` so we get an unique index, even though the dep node is not.
682689
let dep_node_index = self.current.encoder.send(
683690
DepNode {
684691
kind: D::DEP_KIND_SIDE_EFFECT,
@@ -694,6 +701,8 @@ impl<D: Deps> DepGraphData<D> {
694701
dep_node_index
695702
}
696703

704+
/// This forces a diagnostic node green by running its side effect. `prev_index` would
705+
/// refer to a node created used `encode_diagnostic` in the previous session.
697706
#[inline]
698707
fn force_diagnostic_node<Qcx: QueryContext>(
699708
&self,

0 commit comments

Comments
 (0)
Failed to load comments.