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>,
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,
def_id_to_span: IndexVec<LocalDefId, Span>,
stable_crate_id: StableCrateId,
}
Expand description
The definition table containing node definitions.
It holds the DefPathTable
for LocalDefId
s/DefPath
s.
It also stores mappings to convert LocalDefId
s to/from HirId
s.
Fields
table: DefPathTable
def_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
.
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>
Item with a given LocalDefId
was defined during macro expansion with ID ExpnId
.
def_id_to_span: IndexVec<LocalDefId, Span>
stable_crate_id: StableCrateId
The StableCrateId of the local crate.
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,
span: Span
) -> LocalDefId
pub fn create_def(
&mut self,
parent: LocalDefId,
data: DefPathData,
expn_id: ExpnId,
next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32,
span: Span
) -> LocalDefId
Adds a definition with a parent definition.
Initializes the LocalDefId
to HirId
mapping once it has been generated during
AST to HIR lowering.
Retrieves the span of the given DefId
if DefId
is in the local crate.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Definitions
impl !Send for Definitions
impl !Sync for Definitions
impl Unpin for Definitions
impl UnwindSafe for Definitions
Blanket Implementations
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. 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: 184 bytes