//! expressions) that are mostly just leftovers.
pub use crate::def_id::DefPathHash;
-use crate::def_id::{
- CrateNum, DefId, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE,
-};
+use crate::def_id::{CrateNum, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::hir;
use rustc_data_structures::fx::FxHashMap;
/// The reverse mapping of `def_id_to_hir_id`.
pub(super) hir_id_to_def_id: FxHashMap<hir::HirId, LocalDefId>,
- /// If `ExpnId` is an ID of some macro expansion,
- /// then `DefId` is the normal module (`mod`) in which the expanded macro was defined.
- parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>,
/// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`.
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,
}
def_id_to_hir_id: Default::default(),
hir_id_to_def_id: Default::default(),
expansions_that_defined: Default::default(),
- parent_modules_of_macro_defs: Default::default(),
}
}
self.expansions_that_defined.get(&id).copied().unwrap_or_else(ExpnId::root)
}
- pub fn parent_module_of_macro_def(&self, expn_id: ExpnId) -> DefId {
- self.parent_modules_of_macro_defs[&expn_id]
- }
-
- pub fn add_parent_module_of_macro_def(&mut self, expn_id: ExpnId, module: DefId) {
- self.parent_modules_of_macro_defs.insert(expn_id, module);
- }
-
pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_ {
self.def_id_to_hir_id.iter_enumerated().map(|(k, _)| k)
}