aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/path_resolution.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-02 11:37:45 +0000
committerGitHub <[email protected]>2021-02-02 11:37:45 +0000
commit8720f7f14688257d320de44e1354c62fce1a6bcf (patch)
treed5cbb565fbcdb5378ab4dbc4cf885933eb39eedd /crates/hir_def/src/nameres/path_resolution.rs
parent157156276b32c4edca337e6389dc70a203c7c681 (diff)
parentcd9659ffcee35ade2148162a9b77f8d74656d43e (diff)
Merge #7518
7518: Use the right `DefMap` when looking up modules r=jonas-schievink a=jonas-schievink Fixes the bugs encountered in https://github.com/rust-analyzer/rust-analyzer/pull/7506#issuecomment-771417467 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/nameres/path_resolution.rs')
-rw-r--r--crates/hir_def/src/nameres/path_resolution.rs10
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