diff options
Diffstat (limited to 'crates/hir_def/src/nameres/path_resolution.rs')
-rw-r--r-- | crates/hir_def/src/nameres/path_resolution.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index 2a0f8ec2b..2d1477160 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs | |||
@@ -271,8 +271,16 @@ impl DefMap { | |||
271 | ); | 271 | ); |
272 | } | 272 | } |
273 | 273 | ||
274 | let def_map; | ||
275 | let module_data = if module.block == self.block_id() { | ||
276 | &self[module.local_id] | ||
277 | } else { | ||
278 | def_map = module.def_map(db); | ||
279 | &def_map[module.local_id] | ||
280 | }; | ||
281 | |||
274 | // Since it is a qualified path here, it should not contains legacy macros | 282 | // Since it is a qualified path here, it should not contains legacy macros |
275 | self[module.local_id].scope.get(&segment) | 283 | module_data.scope.get(&segment) |
276 | } | 284 | } |
277 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { | 285 | ModuleDefId::AdtId(AdtId::EnumId(e)) => { |
278 | // enum variant | 286 | // enum variant |