@@ -80,7 +80,7 @@ use std::mem::replace;
8080use rustc_data_structures:: sync:: Lrc ;
8181
8282use resolve_imports:: { ImportDirective , ImportDirectiveSubclass , NameResolution , ImportResolver } ;
83- use macros:: { InvocationData , LegacyBinding , LegacyScope } ;
83+ use macros:: { InvocationData , LegacyBinding , ParentScope } ;
8484
8585// NB: This module needs to be declared first so diagnostics are
8686// registered before they are used.
@@ -1009,9 +1009,9 @@ pub struct ModuleData<'a> {
10091009 normal_ancestor_id : DefId ,
10101010
10111011 resolutions : RefCell < FxHashMap < ( Ident , Namespace ) , & ' a RefCell < NameResolution < ' a > > > > ,
1012- legacy_macro_resolutions : RefCell < Vec < ( Ident , MacroKind , Mark , LegacyScope < ' a > , Option < Def > ) > > ,
1012+ legacy_macro_resolutions : RefCell < Vec < ( Ident , MacroKind , ParentScope < ' a > , Option < Def > ) > > ,
10131013 macro_resolutions : RefCell < Vec < ( Box < [ Ident ] > , Span ) > > ,
1014- builtin_attrs : RefCell < Vec < ( Ident , Mark , LegacyScope < ' a > ) > > ,
1014+ builtin_attrs : RefCell < Vec < ( Ident , ParentScope < ' a > ) > > ,
10151015
10161016 // Macro invocations that can expand into items in this module.
10171017 unresolved_invocations : RefCell < FxHashSet < Mark > > ,
@@ -3494,23 +3494,25 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
34943494 path_span : Span ,
34953495 crate_lint : CrateLint ,
34963496 ) -> PathResult < ' a > {
3497- self . resolve_path_with_parent_expansion ( base_module, path, opt_ns, Mark :: root ( ) ,
3498- record_used, path_span, crate_lint)
3497+ let parent_scope = ParentScope { module : self . current_module , ..self . dummy_parent_scope ( ) } ;
3498+ self . resolve_path_with_parent_scope ( base_module, path, opt_ns, & parent_scope,
3499+ record_used, path_span, crate_lint)
34993500 }
35003501
3501- fn resolve_path_with_parent_expansion (
3502+ fn resolve_path_with_parent_scope (
35023503 & mut self ,
35033504 base_module : Option < ModuleOrUniformRoot < ' a > > ,
35043505 path : & [ Ident ] ,
35053506 opt_ns : Option < Namespace > , // `None` indicates a module path
3506- parent_expansion : Mark ,
3507+ parent_scope : & ParentScope < ' a > ,
35073508 record_used : bool ,
35083509 path_span : Span ,
35093510 crate_lint : CrateLint ,
35103511 ) -> PathResult < ' a > {
35113512 let mut module = base_module;
35123513 let mut allow_super = true ;
35133514 let mut second_binding = None ;
3515+ self . current_module = parent_scope. module ;
35143516
35153517 debug ! (
35163518 "resolve_path(path={:?}, opt_ns={:?}, record_used={:?}, \
@@ -3596,9 +3598,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
35963598 self . resolve_ident_in_module ( module, ident, ns, record_used, path_span)
35973599 } else if opt_ns == Some ( MacroNS ) {
35983600 assert ! ( ns == TypeNS ) ;
3599- self . resolve_lexical_macro_path_segment ( ident, ns, None , parent_expansion,
3600- record_used, record_used, path_span)
3601- . map ( |( binding, _) | binding)
3601+ self . resolve_lexical_macro_path_segment ( ident, ns, None , parent_scope, record_used,
3602+ record_used, path_span) . map ( |( b, _) | b)
36023603 } else {
36033604 let record_used_id =
36043605 if record_used { crate_lint. node_id ( ) . or ( Some ( CRATE_NODE_ID ) ) } else { None } ;
0 commit comments