Expand description
For each definition, we track the following data. A definition
here is defined somewhat circularly as “something with a DefId”,
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.
Structs§
- DefKey
- 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
DisambiguatedDefPathData. - DefPath
- DefPath
Hash - A
DefPathHashis a fixed-size representation of aDefPaththat is stable across crate and compilation session boundaries. It consists of two separate 64-bit hashes. The first uniquely identifies the crate thisDefPathHashoriginates from (see StableCrateId), and the second uniquely identifies the correspondingDefPathwithin that crate. Together they form a unique identifier within an entire crate graph. - DefPath
Table - The
DefPathTablemapsDefIndexes toDefKeys and vice versa. Internally theDefPathTableholds a tree ofDefKeys, where eachDefKeystores theDefIndexof its parent. There is oneDefPathTablefor each crate. - Definitions
- The definition table containing node definitions.
It holds the
DefPathTableforLocalDefIds/DefPaths. It also stores mappings to convertLocalDefIds to/fromHirIds. - Disambiguated
DefPath Data - A pair of
DefPathDataand an integer disambiguator. The integer is normally0, but in the event that there are multiple defs with the sameparentanddata, 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 distinctDefIds. - Disambiguator
State
Enums§
- DefPath
Data - New variants should only be added in synchronization with
enum DefKind. - DefPath
Data Name