diff options
author | Jonas Schievink <[email protected]> | 2021-02-02 11:25:13 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-02-02 11:36:38 +0000 |
commit | cd9659ffcee35ade2148162a9b77f8d74656d43e (patch) | |
tree | d5cbb565fbcdb5378ab4dbc4cf885933eb39eedd /crates/hir_def/src/nameres/path_resolution.rs | |
parent | 157156276b32c4edca337e6389dc70a203c7c681 (diff) |
Use the right `DefMap` when looking up modules
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 |