Skip to content

Commit b29353a

Browse files
pierwillJoshua Nelsoncamelid
committed
Edit rustc_middle::dep_graph module documentation
Co-authored-by: Joshua Nelson <[email protected]> Co-authored-by: Camelid <[email protected]>
1 parent edeb631 commit b29353a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
//! This module defines the `DepNode` type which the compiler uses to represent
2-
//! nodes in the dependency graph.
1+
//! Nodes in the dependency graph.
32
//!
4-
//! A `DepNode` consists of a `DepKind` (which
5-
//! specifies the kind of thing it represents, like a piece of HIR, MIR, etc)
6-
//! and a `Fingerprint`, a 128-bit hash value the exact meaning of which
3+
//! A node in the [dependency graph] is represented by a [`DepNode`].
4+
//! A `DepNode` consists of a [`DepKind`] (which
5+
//! specifies the kind of thing it represents, like a piece of HIR, MIR, etc.)
6+
//! and a [`Fingerprint`], a 128-bit hash value, the exact meaning of which
77
//! depends on the node's `DepKind`. Together, the kind and the fingerprint
88
//! fully identify a dependency node, even across multiple compilation sessions.
99
//! In other words, the value of the fingerprint does not depend on anything
1010
//! that is specific to a given compilation session, like an unpredictable
11-
//! interning key (e.g., NodeId, DefId, Symbol) or the numeric value of a
11+
//! interning key (e.g., `NodeId`, `DefId`, `Symbol`) or the numeric value of a
1212
//! pointer. The concept behind this could be compared to how git commit hashes
13-
//! uniquely identify a given commit and has a few advantages:
13+
//! uniquely identify a given commit. The fingerprinting approach has
14+
//! a few advantages:
1415
//!
1516
//! * A `DepNode` can simply be serialized to disk and loaded in another session
1617
//! without the need to do any "rebasing" (like we have to do for Spans and
@@ -51,6 +52,8 @@
5152
//! than a zeroed out fingerprint. More generally speaking, it relieves the
5253
//! user of the `DepNode` API of having to know how to compute the expected
5354
//! fingerprint for a given set of node parameters.
55+
//!
56+
//! [dependency graph]: https://rustc-dev-guide.rust-lang.org/query.html
5457
5558
use crate::ty::TyCtxt;
5659

0 commit comments

Comments
 (0)