[][src]Struct rustc_hir::definitions::Definitions

pub struct Definitions {
    table: DefPathTable,
    pub(super) def_id_to_hir_id: IndexVec<LocalDefId, Option<HirId>>,
    pub(super) hir_id_to_def_id: FxHashMap<HirId, LocalDefId>,
    parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>,
    expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,

The definition table containing node definitions. It holds the DefPathTable for LocalDefIds/DefPaths. It also stores mappings to convert LocalDefIds to/from HirIds.


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.


impl Definitions[src]

pub fn def_path_table(&self) -> &DefPathTable[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]

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_local_def_id_to_hir_id(&self, id: LocalDefId) -> Option<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

Adds a root definition (no parent) and a few other reserved definitions.

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

Adds a definition with a parent definition.

pub fn init_def_id_to_hir_id_mapping(
    &mut self,
    mapping: IndexVec<LocalDefId, Option<HirId>>

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]

Trait Implementations

impl Clone for Definitions[src]

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> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.