@@ -18,9 +18,7 @@ use crate::{
1818    db:: DefDatabase , 
1919    item_scope:: { ImportOrExternCrate ,  BUILTIN_SCOPE } , 
2020    item_tree:: Fields , 
21-     nameres:: { 
22-         sub_namespace_match,  BlockInfo ,  BuiltinShadowMode ,  DefMap ,  MacroSubNs ,  ModuleOrigin , 
23-     } , 
21+     nameres:: { sub_namespace_match,  BlockInfo ,  BuiltinShadowMode ,  DefMap ,  MacroSubNs } , 
2422    path:: { ModPath ,  PathKind } , 
2523    per_ns:: PerNs , 
2624    visibility:: { RawVisibility ,  Visibility } , 
@@ -472,7 +470,7 @@ impl DefMap {
472470        } ; 
473471
474472        let  extern_prelude = || { 
475-             if  matches ! ( self [ module ] . origin ,   ModuleOrigin :: BlockExpr   {  ..  } )  { 
473+             if  self . block . is_some ( )  && module ==  DefMap :: ROOT  { 
476474                // Don't resolve extern prelude in pseudo-modules of blocks, because 
477475                // they might been shadowed by local names. 
478476                return  PerNs :: none ( ) ; 
@@ -518,7 +516,7 @@ impl DefMap {
518516            None  => self [ Self :: ROOT ] . scope . get ( name) , 
519517        } ; 
520518        let  from_extern_prelude = || { 
521-             if  matches ! ( self [ module ] . origin ,   ModuleOrigin :: BlockExpr   {  ..  } )  { 
519+             if  self . block . is_some ( )  && module ==  DefMap :: ROOT  { 
522520                // Don't resolve extern prelude in pseudo-module of a block. 
523521                return  PerNs :: none ( ) ; 
524522            } 
0 commit comments