@@ -140,7 +140,9 @@ pub struct ParentScope<'a> {
140
140
}
141
141
142
142
impl < ' a > ParentScope < ' a > {
143
- pub fn default ( module : Module < ' a > ) -> ParentScope < ' a > {
143
+ /// Creates a parent scope with the passed argument used as the module scope component,
144
+ /// and other scope components set to default empty values.
145
+ pub fn module ( module : Module < ' a > ) -> ParentScope < ' a > {
144
146
ParentScope {
145
147
module,
146
148
expansion : ExpnId :: root ( ) ,
@@ -1017,7 +1019,7 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
1017
1019
segments,
1018
1020
} ;
1019
1021
1020
- let parent_scope = & ParentScope :: default ( self . graph_root ) ;
1022
+ let parent_scope = & ParentScope :: module ( self . graph_root ) ;
1021
1023
let res = match self . resolve_ast_path ( & path, ns, parent_scope) {
1022
1024
Ok ( res) => res,
1023
1025
Err ( ( span, error) ) => {
@@ -1090,7 +1092,7 @@ impl<'a> Resolver<'a> {
1090
1092
}
1091
1093
1092
1094
let mut invocation_parent_scopes = FxHashMap :: default ( ) ;
1093
- invocation_parent_scopes. insert ( ExpnId :: root ( ) , ParentScope :: default ( graph_root) ) ;
1095
+ invocation_parent_scopes. insert ( ExpnId :: root ( ) , ParentScope :: module ( graph_root) ) ;
1094
1096
1095
1097
let mut macro_defs = FxHashMap :: default ( ) ;
1096
1098
macro_defs. insert ( ExpnId :: root ( ) , root_def_id) ;
@@ -2671,7 +2673,7 @@ impl<'a> Resolver<'a> {
2671
2673
let def_id = self . definitions . local_def_id ( module_id) ;
2672
2674
self . module_map . get ( & def_id) . copied ( ) . unwrap_or ( self . graph_root )
2673
2675
} ) ;
2674
- let parent_scope = & ParentScope :: default ( module) ;
2676
+ let parent_scope = & ParentScope :: module ( module) ;
2675
2677
let res = self . resolve_ast_path ( & path, ns, parent_scope) . map_err ( |_| ( ) ) ?;
2676
2678
Ok ( ( path, res) )
2677
2679
}
0 commit comments