Module rustc_hir::source ·
For each definition, we track the following data. A definition
here is defined somewhat circularly as “something with a
but it generally corresponds to things like structs, enums, etc.
There are also some rather random cases (like const initializer
expressions) that are mostly just leftovers.
- A unique identifier that we can use to lookup a definition precisely. It combines the index of the definition’s parent (if any) with a
DefPathHashis a fixed-size representation of a
DefPaththat is stable across crate and compilation session boundaries. It consists of two separate 64-bit hashes. The first uniquely identifies the crate this
DefPathHashoriginates from (see StableCrateId), and the second uniquely identifies the corresponding
DefPathwithin that crate. Together they form a unique identifier within an entire crate graph.
DefKeys and vice versa. Internally the
DefPathTableholds a tree of
DefKeys, where each
DefIndexof its parent. There is one
DefPathTablefor each crate.
- The definition table containing node definitions. It holds the
DefPaths. It also stores mappings to convert
- A pair of
DefPathDataand an integer disambiguator. The integer is normally
0, but in the event that there are multiple defs with the same
data, we use this field to disambiguate between them. This introduces some artificial ordering dependency but means that if you have, e.g., two impls for the same type in the same module, they do get distinct