diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-06-28 19:29:55 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-07-06 08:07:06 +0200 |
| commit | 3162c37b59009f17d92aeb8affc64d33c2d34acb (patch) | |
| tree | 34336a113e2526cabd3780c9360afadde7cd1b55 /compiler/rustc_hir/src | |
| parent | 969a6c2481c41cea793708f7fdd2f96a3397143f (diff) | |
| download | rust-3162c37b59009f17d92aeb8affc64d33c2d34acb.tar.gz rust-3162c37b59009f17d92aeb8affc64d33c2d34acb.zip | |
Store macro parent module in ExpnData.
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/definitions.rs | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs index 753b8c85670..325bec309af 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir/src/definitions.rs @@ -5,9 +5,7 @@ //! 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; @@ -108,9 +106,6 @@ pub struct Definitions { /// 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>, } @@ -353,7 +348,6 @@ impl Definitions { 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(), } } @@ -420,14 +414,6 @@ impl Definitions { 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) } |
