aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index 21add086d..50e730444 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -76,7 +76,11 @@ use stdx::impl_from;
76#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 76#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
77pub struct ModuleId { 77pub struct ModuleId {
78 krate: CrateId, 78 krate: CrateId,
79 /// If this `ModuleId` was derived from a `DefMap` for a block expression, this stores the
80 /// `BlockId` of that block expression. If `None`, this module is part of the crate-level
81 /// `DefMap` of `krate`.
79 block: Option<BlockId>, 82 block: Option<BlockId>,
83 /// The module's ID in its originating `DefMap`.
80 pub local_id: LocalModuleId, 84 pub local_id: LocalModuleId,
81} 85}
82 86
@@ -87,7 +91,7 @@ impl ModuleId {
87 db.block_def_map(block).unwrap_or_else(|| { 91 db.block_def_map(block).unwrap_or_else(|| {
88 // NOTE: This should be unreachable - all `ModuleId`s come from their `DefMap`s, 92 // NOTE: This should be unreachable - all `ModuleId`s come from their `DefMap`s,
89 // so the `DefMap` here must exist. 93 // so the `DefMap` here must exist.
90 panic!("no `block_def_map` for `ModuleId` {:?}", self); 94 unreachable!("no `block_def_map` for `ModuleId` {:?}", self);
91 }) 95 })
92 } 96 }
93 None => db.crate_def_map(self.krate), 97 None => db.crate_def_map(self.krate),