Struct rustc_hir::definitions::Definitions [−][src]
pub struct Definitions {
table: DefPathTable,
pub(crate) def_id_to_hir_id: IndexVec<LocalDefId, Option<HirId>>,
pub(crate) hir_id_to_def_id: FxHashMap<HirId, LocalDefId>,
parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>,
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,
}Expand description
The definition table containing node definitions.
It holds the DefPathTable for LocalDefIds/DefPaths.
It also stores mappings to convert LocalDefIds to/from HirIds.
Fields
table: DefPathTabledef_id_to_hir_id: IndexVec<LocalDefId, Option<HirId>>hir_id_to_def_id: FxHashMap<HirId, LocalDefId>The reverse mapping of def_id_to_hir_id.
parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>If ExpnId is an ID of some macro expansion,
then DefId is the normal module (mod) in which the expanded macro was defined.
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>Item with a given LocalDefId was defined during macro expansion with ID ExpnId.
Implementations
Gets the number of definitions.
Returns the path from the crate root to index. The root
nodes are not included in the path (i.e., this will be an
empty vector for the crate root). For an inlined item, this
will be the path of the item in the external crate (but the
path will begin with the path to the external crate).
Adds a root definition (no parent) and a few other reserved definitions.
Retrieves the root definition.
pub fn create_def(
&mut self,
parent: LocalDefId,
data: DefPathData,
expn_id: ExpnId,
next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32
) -> LocalDefId
pub fn create_def(
&mut self,
parent: LocalDefId,
data: DefPathData,
expn_id: ExpnId,
next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32
) -> LocalDefIdAdds a definition with a parent definition.
Initializes the LocalDefId to HirId mapping once it has been generated during
AST to HIR lowering.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Definitionsimpl Send for Definitionsimpl Sync for Definitionsimpl Unpin for Definitionsimpl UnwindSafe for DefinitionsBlanket Implementations
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may be different between compiler versions and platforms. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 200 bytes