aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r--crates/hir_def/src/nameres.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index c3d3efc6b..23f960ad4 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -77,12 +77,12 @@ use crate::{
77pub struct DefMap { 77pub struct DefMap {
78 root: LocalModuleId, 78 root: LocalModuleId,
79 modules: Arena<ModuleData>, 79 modules: Arena<ModuleData>,
80 pub(crate) krate: CrateId, 80 krate: CrateId,
81 /// The prelude module for this crate. This either comes from an import 81 /// The prelude module for this crate. This either comes from an import
82 /// marked with the `prelude_import` attribute, or (in the normal case) from 82 /// marked with the `prelude_import` attribute, or (in the normal case) from
83 /// a dependency (`std` or `core`). 83 /// a dependency (`std` or `core`).
84 pub(crate) prelude: Option<ModuleId>, 84 prelude: Option<ModuleId>,
85 pub(crate) extern_prelude: FxHashMap<Name, ModuleDefId>, 85 extern_prelude: FxHashMap<Name, ModuleDefId>,
86 86
87 edition: Edition, 87 edition: Edition,
88 diagnostics: Vec<DefDiagnostic>, 88 diagnostics: Vec<DefDiagnostic>,
@@ -216,6 +216,18 @@ impl DefMap {
216 self.root 216 self.root
217 } 217 }
218 218
219 pub(crate) fn krate(&self) -> CrateId {
220 self.krate
221 }
222
223 pub(crate) fn prelude(&self) -> Option<ModuleId> {
224 self.prelude
225 }
226
227 pub(crate) fn extern_prelude(&self) -> impl Iterator<Item = (&Name, &ModuleDefId)> + '_ {
228 self.extern_prelude.iter()
229 }
230
219 pub(crate) fn resolve_path( 231 pub(crate) fn resolve_path(
220 &self, 232 &self,
221 db: &dyn DefDatabase, 233 db: &dyn DefDatabase,