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>Expand description
The reverse mapping of def_id_to_hir_id.
parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>Expand description
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>Expand description
Item with a given LocalDefId was defined during macro expansion with ID ExpnId.
Implementations
impl Definitions[src]
impl Definitions[src]pub fn def_path_table(&self) -> &DefPathTable[src]
pub fn def_index_count(&self) -> usize[src]
pub fn def_index_count(&self) -> usize[src]Gets the number of definitions.
pub fn def_key(&self, id: LocalDefId) -> DefKey[src]
pub fn def_path_hash(&self, id: LocalDefId) -> DefPathHash[src]
pub fn def_path(&self, id: LocalDefId) -> DefPath[src]
pub fn def_path(&self, id: LocalDefId) -> DefPath[src]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).
pub fn local_def_id_to_hir_id(&self, id: LocalDefId) -> HirId[src]
pub fn opt_hir_id_to_local_def_id(&self, hir_id: HirId) -> Option<LocalDefId>[src]
pub fn new(
crate_name: &str,
crate_disambiguator: CrateDisambiguator
) -> Definitions[src]
pub fn new(
crate_name: &str,
crate_disambiguator: CrateDisambiguator
) -> Definitions[src]Adds a root definition (no parent) and a few other reserved definitions.
pub fn get_root_def(&self) -> LocalDefId[src]
pub fn get_root_def(&self) -> LocalDefId[src]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[src]
pub fn create_def(
&mut self,
parent: LocalDefId,
data: DefPathData,
expn_id: ExpnId,
next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32
) -> LocalDefId[src]Adds a definition with a parent definition.
pub fn init_def_id_to_hir_id_mapping(
&mut self,
mapping: IndexVec<LocalDefId, Option<HirId>>
)[src]
pub fn init_def_id_to_hir_id_mapping(
&mut self,
mapping: IndexVec<LocalDefId, Option<HirId>>
)[src]Initializes the LocalDefId to HirId mapping once it has been generated during
AST to HIR lowering.
pub fn expansion_that_defined(&self, id: LocalDefId) -> ExpnId[src]
pub fn parent_module_of_macro_def(&self, expn_id: ExpnId) -> DefId[src]
pub fn add_parent_module_of_macro_def(&mut self, expn_id: ExpnId, module: DefId)[src]
pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_[src]
Trait Implementations
impl Clone for Definitions[src]
impl Clone for Definitions[src]fn clone(&self) -> Definitions[src]
fn clone(&self) -> Definitions[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
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
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more