diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index 419e465ed8f..2a0f8ec2bc8 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, } }