@@ -181,6 +181,7 @@ impl HygieneData {
181181 DUMMY_SP ,
182182 edition,
183183 Some ( DefId :: local ( CRATE_DEF_INDEX ) ) ,
184+ None ,
184185 ) ;
185186 root_data. orig_id = Some ( 0 ) ;
186187
@@ -687,7 +688,7 @@ impl Span {
687688 ) -> Span {
688689 self . fresh_expansion ( ExpnData {
689690 allow_internal_unstable,
690- ..ExpnData :: default ( ExpnKind :: Desugaring ( reason) , self , edition, None )
691+ ..ExpnData :: default ( ExpnKind :: Desugaring ( reason) , self , edition, None , None )
691692 } )
692693 }
693694}
@@ -734,6 +735,8 @@ pub struct ExpnData {
734735 /// The `DefId` of the macro being invoked,
735736 /// if this `ExpnData` corresponds to a macro invocation
736737 pub macro_def_id : Option < DefId > ,
738+ /// The normal module (`mod`) in which the expanded macro was defined.
739+ pub parent_module : Option < DefId > ,
737740 /// The crate that originally created this `ExpnData`. During
738741 /// metadata serialization, we only encode `ExpnData`s that were
739742 /// created locally - when our serialized metadata is decoded,
@@ -777,6 +780,7 @@ impl ExpnData {
777780 local_inner_macros : bool ,
778781 edition : Edition ,
779782 macro_def_id : Option < DefId > ,
783+ parent_module : Option < DefId > ,
780784 ) -> ExpnData {
781785 ExpnData {
782786 kind,
@@ -788,6 +792,7 @@ impl ExpnData {
788792 local_inner_macros,
789793 edition,
790794 macro_def_id,
795+ parent_module,
791796 krate : LOCAL_CRATE ,
792797 orig_id : None ,
793798 disambiguator : 0 ,
@@ -800,6 +805,7 @@ impl ExpnData {
800805 call_site : Span ,
801806 edition : Edition ,
802807 macro_def_id : Option < DefId > ,
808+ parent_module : Option < DefId > ,
803809 ) -> ExpnData {
804810 ExpnData {
805811 kind,
@@ -811,6 +817,7 @@ impl ExpnData {
811817 local_inner_macros : false ,
812818 edition,
813819 macro_def_id,
820+ parent_module,
814821 krate : LOCAL_CRATE ,
815822 orig_id : None ,
816823 disambiguator : 0 ,
@@ -823,10 +830,11 @@ impl ExpnData {
823830 edition : Edition ,
824831 allow_internal_unstable : Lrc < [ Symbol ] > ,
825832 macro_def_id : Option < DefId > ,
833+ parent_module : Option < DefId > ,
826834 ) -> ExpnData {
827835 ExpnData {
828836 allow_internal_unstable : Some ( allow_internal_unstable) ,
829- ..ExpnData :: default ( kind, call_site, edition, macro_def_id)
837+ ..ExpnData :: default ( kind, call_site, edition, macro_def_id, parent_module )
830838 }
831839 }
832840
0 commit comments