@@ -18,9 +18,7 @@ use crate::{
18
18
db:: DefDatabase ,
19
19
item_scope:: { ImportOrExternCrate , BUILTIN_SCOPE } ,
20
20
item_tree:: Fields ,
21
- nameres:: {
22
- sub_namespace_match, BlockInfo , BuiltinShadowMode , DefMap , MacroSubNs , ModuleOrigin ,
23
- } ,
21
+ nameres:: { sub_namespace_match, BlockInfo , BuiltinShadowMode , DefMap , MacroSubNs } ,
24
22
path:: { ModPath , PathKind } ,
25
23
per_ns:: PerNs ,
26
24
visibility:: { RawVisibility , Visibility } ,
@@ -472,7 +470,7 @@ impl DefMap {
472
470
} ;
473
471
474
472
let extern_prelude = || {
475
- if matches ! ( self [ module ] . origin , ModuleOrigin :: BlockExpr { .. } ) {
473
+ if self . block . is_some ( ) && module == DefMap :: ROOT {
476
474
// Don't resolve extern prelude in pseudo-modules of blocks, because
477
475
// they might been shadowed by local names.
478
476
return PerNs :: none ( ) ;
@@ -518,7 +516,7 @@ impl DefMap {
518
516
None => self [ Self :: ROOT ] . scope . get ( name) ,
519
517
} ;
520
518
let from_extern_prelude = || {
521
- if matches ! ( self [ module ] . origin , ModuleOrigin :: BlockExpr { .. } ) {
519
+ if self . block . is_some ( ) && module == DefMap :: ROOT {
522
520
// Don't resolve extern prelude in pseudo-module of a block.
523
521
return PerNs :: none ( ) ;
524
522
}
0 commit comments