From 232b75394e253aeb1fa448b586a2e1ab1e083aa1 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 28 Jan 2021 18:27:27 +0100 Subject: Update `original_module` when ascending `DefMap`s --- crates/hir_def/src/nameres/path_resolution.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/hir_def/src/nameres') diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index 419e465ed..2a0f8ec2b 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs @@ -103,7 +103,7 @@ impl DefMap { &self, db: &dyn DefDatabase, mode: ResolveMode, - original_module: LocalModuleId, + mut original_module: LocalModuleId, path: &ModPath, shadow: BuiltinShadowMode, ) -> ResolvePathResult { @@ -130,7 +130,10 @@ impl DefMap { result.segment_index = result.segment_index.min(new.segment_index); match ¤t_map.block { - Some(block) => current_map = &block.parent, + Some(block) => { + current_map = &block.parent; + original_module = block.parent_module; + } None => return result, } } -- cgit v1.2.3