@@ -80,7 +80,7 @@ use std::mem::replace;
80
80
use rustc_data_structures:: sync:: Lrc ;
81
81
82
82
use resolve_imports:: { ImportDirective , ImportDirectiveSubclass , NameResolution , ImportResolver } ;
83
- use macros:: { InvocationData , LegacyBinding , LegacyScope } ;
83
+ use macros:: { InvocationData , LegacyBinding , ParentScope } ;
84
84
85
85
// NB: This module needs to be declared first so diagnostics are
86
86
// registered before they are used.
@@ -1009,9 +1009,9 @@ pub struct ModuleData<'a> {
1009
1009
normal_ancestor_id : DefId ,
1010
1010
1011
1011
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 > ) > > ,
1013
1013
macro_resolutions : RefCell < Vec < ( Box < [ Ident ] > , Span ) > > ,
1014
- builtin_attrs : RefCell < Vec < ( Ident , Mark , LegacyScope < ' a > ) > > ,
1014
+ builtin_attrs : RefCell < Vec < ( Ident , ParentScope < ' a > ) > > ,
1015
1015
1016
1016
// Macro invocations that can expand into items in this module.
1017
1017
unresolved_invocations : RefCell < FxHashSet < Mark > > ,
@@ -3494,23 +3494,25 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
3494
3494
path_span : Span ,
3495
3495
crate_lint : CrateLint ,
3496
3496
) -> 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)
3499
3500
}
3500
3501
3501
- fn resolve_path_with_parent_expansion (
3502
+ fn resolve_path_with_parent_scope (
3502
3503
& mut self ,
3503
3504
base_module : Option < ModuleOrUniformRoot < ' a > > ,
3504
3505
path : & [ Ident ] ,
3505
3506
opt_ns : Option < Namespace > , // `None` indicates a module path
3506
- parent_expansion : Mark ,
3507
+ parent_scope : & ParentScope < ' a > ,
3507
3508
record_used : bool ,
3508
3509
path_span : Span ,
3509
3510
crate_lint : CrateLint ,
3510
3511
) -> PathResult < ' a > {
3511
3512
let mut module = base_module;
3512
3513
let mut allow_super = true ;
3513
3514
let mut second_binding = None ;
3515
+ self . current_module = parent_scope. module ;
3514
3516
3515
3517
debug ! (
3516
3518
"resolve_path(path={:?}, opt_ns={:?}, record_used={:?}, \
@@ -3596,9 +3598,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
3596
3598
self . resolve_ident_in_module ( module, ident, ns, record_used, path_span)
3597
3599
} else if opt_ns == Some ( MacroNS ) {
3598
3600
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)
3602
3603
} else {
3603
3604
let record_used_id =
3604
3605
if record_used { crate_lint. node_id ( ) . or ( Some ( CRATE_NODE_ID ) ) } else { None } ;
0 commit comments