|
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. |
3 | 2 | //! |
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 |
7 | 7 | //! depends on the node's `DepKind`. Together, the kind and the fingerprint |
8 | 8 | //! fully identify a dependency node, even across multiple compilation sessions. |
9 | 9 | //! In other words, the value of the fingerprint does not depend on anything |
10 | 10 | //! 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 |
12 | 12 | //! 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: |
14 | 15 | //! |
15 | 16 | //! * A `DepNode` can simply be serialized to disk and loaded in another session |
16 | 17 | //! without the need to do any "rebasing" (like we have to do for Spans and |
|
51 | 52 | //! than a zeroed out fingerprint. More generally speaking, it relieves the |
52 | 53 | //! user of the `DepNode` API of having to know how to compute the expected |
53 | 54 | //! fingerprint for a given set of node parameters. |
| 55 | +//! |
| 56 | +//! [dependency graph]: https://rustc-dev-guide.rust-lang.org/query.html |
54 | 57 |
|
55 | 58 | use crate::ty::TyCtxt; |
56 | 59 |
|
|
0 commit comments