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_def/src/nameres/collector.rs | 2 +- crates/hir_def/src/nameres/path_resolution.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/nameres') diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index cd68efbe6..adfcf879a 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -578,7 +578,7 @@ impl DefCollector<'_> { } else if m.krate != self.def_map.krate { mark::hit!(glob_across_crates); // glob import from other crate => we can just import everything once - let item_map = self.db.crate_def_map(m.krate); + let item_map = m.def_map(self.db); let scope = &item_map[m.local_id].scope; // Module scoped macros is included diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index ec90f4e65..82528b792 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs @@ -243,7 +243,7 @@ impl DefMap { kind: PathKind::Super(0), }; log::debug!("resolving {:?} in other crate", path); - let defp_map = db.crate_def_map(module.krate); + let defp_map = module.def_map(db); let (def, s) = defp_map.resolve_path(db, module.local_id, &path, shadow); return ResolvePathResult::with( def, @@ -356,7 +356,7 @@ impl DefMap { self } else { // Extend lifetime - keep = db.crate_def_map(prelude.krate); + keep = prelude.def_map(db); &keep }; def_map[prelude.local_id].scope.get(name) -- cgit v1.2.3