@@ -140,7 +140,9 @@ pub struct ParentScope<'a> {
140140}
141141
142142impl < ' 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 > {
144146 ParentScope {
145147 module,
146148 expansion : ExpnId :: root ( ) ,
@@ -1017,7 +1019,7 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
10171019 segments,
10181020 } ;
10191021
1020- let parent_scope = & ParentScope :: default ( self . graph_root ) ;
1022+ let parent_scope = & ParentScope :: module ( self . graph_root ) ;
10211023 let res = match self . resolve_ast_path ( & path, ns, parent_scope) {
10221024 Ok ( res) => res,
10231025 Err ( ( span, error) ) => {
@@ -1090,7 +1092,7 @@ impl<'a> Resolver<'a> {
10901092 }
10911093
10921094 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) ) ;
10941096
10951097 let mut macro_defs = FxHashMap :: default ( ) ;
10961098 macro_defs. insert ( ExpnId :: root ( ) , root_def_id) ;
@@ -2671,7 +2673,7 @@ impl<'a> Resolver<'a> {
26712673 let def_id = self . definitions . local_def_id ( module_id) ;
26722674 self . module_map . get ( & def_id) . copied ( ) . unwrap_or ( self . graph_root )
26732675 } ) ;
2674- let parent_scope = & ParentScope :: default ( module) ;
2676+ let parent_scope = & ParentScope :: module ( module) ;
26752677 let res = self . resolve_ast_path ( & path, ns, parent_scope) . map_err ( |_| ( ) ) ?;
26762678 Ok ( ( path, res) )
26772679 }
0 commit comments