From ce29730bc773a27eaeaae7fa4122563df3b253b6 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 22 Jan 2021 16:31:40 +0100 Subject: Obtain `ModuleId`'s `DefMap` through a method --- crates/hir/src/semantics/source_to_def.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/hir/src/semantics') diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index 9bf60c72a..775f7ec8b 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -31,6 +31,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn file_to_def(&mut self, file: FileId) -> Option { let _p = profile::span("SourceBinder::to_module_def"); let (krate, local_id) = self.db.relevant_crates(file).iter().find_map(|&crate_id| { + // FIXME: inner items let crate_def_map = self.db.crate_def_map(crate_id); let local_id = crate_def_map.modules_for_file(file).next()?; Some((crate_id, local_id)) @@ -60,7 +61,7 @@ impl SourceToDefCtx<'_, '_> { }?; let child_name = src.value.name()?.as_name(); - let def_map = self.db.crate_def_map(parent_module.krate); + let def_map = parent_module.def_map(self.db.upcast()); let child_id = *def_map[parent_module.local_id].children.get(&child_name)?; Some(ModuleId { krate: parent_module.krate, local_id: child_id }) } -- cgit v1.2.3