@@ -97,7 +97,7 @@ impl<'a> base::Resolver for Resolver<'a> {
9797 }
9898
9999 fn get_module_scope ( & mut self , id : ast:: NodeId ) -> ExpnId {
100- let expn_id = ExpnId :: fresh ( ExpnId :: root ( ) , Some ( ExpnInfo :: default (
100+ let expn_id = ExpnId :: fresh ( Some ( ExpnInfo :: default (
101101 ExpnKind :: Macro ( MacroKind :: Attr , sym:: test_case) , DUMMY_SP , self . session . edition ( )
102102 ) ) ) ;
103103 let module = self . module_map [ & self . definitions . local_def_id ( id) ] ;
@@ -120,7 +120,8 @@ impl<'a> base::Resolver for Resolver<'a> {
120120 & mut self , expansion : ExpnId , fragment : & AstFragment , derives : & [ ExpnId ]
121121 ) {
122122 // Fill in some data for derives if the fragment is from a derive container.
123- let parent_scope = self . invocation_parent_scopes [ & expansion] ;
123+ // We are inside the `expansion` now, but other parent scope components are still the same.
124+ let parent_scope = ParentScope { expansion, ..self . invocation_parent_scopes [ & expansion] } ;
124125 let parent_def = self . definitions . invocation_parent ( expansion) ;
125126 self . invocation_parent_scopes . extend ( derives. iter ( ) . map ( |& derive| ( derive, parent_scope) ) ) ;
126127 for & derive_invoc_id in derives {
@@ -130,9 +131,7 @@ impl<'a> base::Resolver for Resolver<'a> {
130131 parent_scope. module . unresolved_invocations . borrow_mut ( ) . extend ( derives) ;
131132
132133 // Integrate the new AST fragment into all the definition and module structures.
133- // We are inside the `expansion` new, but other parent scope components are still the same.
134134 fragment. visit_with ( & mut DefCollector :: new ( & mut self . definitions , expansion) ) ;
135- let parent_scope = ParentScope { expansion, ..parent_scope } ;
136135 let output_legacy_scope = self . build_reduced_graph ( fragment, parent_scope) ;
137136 self . output_legacy_scopes . insert ( expansion, output_legacy_scope) ;
138137 }
@@ -186,7 +185,9 @@ impl<'a> base::Resolver for Resolver<'a> {
186185 let ( ext, res) = self . smart_resolve_macro_path ( path, kind, parent_scope, force) ?;
187186
188187 let span = invoc. span ( ) ;
189- invoc. expansion_data . id . set_expn_info ( ext. expn_info ( span, fast_print_path ( path) ) ) ;
188+ invoc. expansion_data . id . set_expn_info (
189+ ext. expn_info ( parent_scope. expansion , span, fast_print_path ( path) )
190+ ) ;
190191
191192 if let Res :: Def ( _, def_id) = res {
192193 if after_derive {
0 commit comments