Expand description
Library containing Id types from rustc_hir, split out so crates can use it without depending
on all of rustc_hir (which is large and depends on other large things like rustc_target).
Re-exportsΒ§
pub(crate) use self;πpub(crate) use Debug;πpub(crate) use Debug;πpub(crate) use StableHash;πpub(crate) use StableHashCtxt;πpub(crate) use StableHasher;πpub(crate) use StableOrd;πpub(crate) use ToStableHashKey;πpub(crate) use Decodable;πpub(crate) use Encodable;πpub(crate) use StableHash;πpub(crate) use rustc_serialize::ContextOrd;πpub(crate) use CRATE_DEF_ID;πpub(crate) use DefId;πpub(crate) use DefIndex;πpub(crate) use DefPathHash;πpub(crate) use LocalDefId;πpub(crate) use LocalModId;π
ModulesΒ§
- def_
path_ hash_ map - definitions
- 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Β§
- HirId
- Uniquely identifies a node in the HIR of the current crate. It is
composed of the
owner, which is theLocalDefIdof the directly enclosinghir::Item,hir::TraitItem, orhir::ImplItem(i.e., the closest βitem-likeβ), and thelocal_idwhich is unique within the given owner. - Item
Local Id - An
ItemLocalIduniquely identifies something within a given βitem-likeβ; that is, within ahir::Item,hir::TraitItem, orhir::ImplItem. There is no guarantee that the numerical value of a givenItemLocalIdcorresponds to the nodeβs position within the owning item in any way, but there is a guarantee that theItemLocalIds within an owner occupy a dense range of integers starting at zero, so a mapping that maps all or most nodes within an βitem-likeβ to something else can be implemented by aVecinstead of a tree or hash map. - OwnerId
ConstantsΒ§
- CRATE_
HIR_ ID - The
HirIdcorresponding toCRATE_NODE_IDandCRATE_DEF_ID. - CRATE_
OWNER_ ID