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_span/src | |
| parent | 969a6c2481c41cea793708f7fdd2f96a3397143f (diff) | |
| download | rust-3162c37b59009f17d92aeb8affc64d33c2d34acb.tar.gz rust-3162c37b59009f17d92aeb8affc64d33c2d34acb.zip | |
Store macro parent module in ExpnData.
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/hygiene.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 23efaf6f4f3..913aeeca78b 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -181,6 +181,7 @@ impl HygieneData { DUMMY_SP, edition, Some(DefId::local(CRATE_DEF_INDEX)), + None, ); root_data.orig_id = Some(0); @@ -687,7 +688,7 @@ impl Span { ) -> Span { self.fresh_expansion(ExpnData { allow_internal_unstable, - ..ExpnData::default(ExpnKind::Desugaring(reason), self, edition, None) + ..ExpnData::default(ExpnKind::Desugaring(reason), self, edition, None, None) }) } } @@ -734,6 +735,8 @@ pub struct ExpnData { /// The `DefId` of the macro being invoked, /// if this `ExpnData` corresponds to a macro invocation pub macro_def_id: Option<DefId>, + /// The normal module (`mod`) in which the expanded macro was defined. + pub parent_module: Option<DefId>, /// The crate that originally created this `ExpnData`. During /// metadata serialization, we only encode `ExpnData`s that were /// created locally - when our serialized metadata is decoded, @@ -777,6 +780,7 @@ impl ExpnData { local_inner_macros: bool, edition: Edition, macro_def_id: Option<DefId>, + parent_module: Option<DefId>, ) -> ExpnData { ExpnData { kind, @@ -788,6 +792,7 @@ impl ExpnData { local_inner_macros, edition, macro_def_id, + parent_module, krate: LOCAL_CRATE, orig_id: None, disambiguator: 0, @@ -800,6 +805,7 @@ impl ExpnData { call_site: Span, edition: Edition, macro_def_id: Option<DefId>, + parent_module: Option<DefId>, ) -> ExpnData { ExpnData { kind, @@ -811,6 +817,7 @@ impl ExpnData { local_inner_macros: false, edition, macro_def_id, + parent_module, krate: LOCAL_CRATE, orig_id: None, disambiguator: 0, @@ -823,10 +830,11 @@ impl ExpnData { edition: Edition, allow_internal_unstable: Lrc<[Symbol]>, macro_def_id: Option<DefId>, + parent_module: Option<DefId>, ) -> ExpnData { ExpnData { allow_internal_unstable: Some(allow_internal_unstable), - ..ExpnData::default(kind, call_site, edition, macro_def_id) + ..ExpnData::default(kind, call_site, edition, macro_def_id, parent_module) } } |
