aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-18 23:06:35 +0000
committerJonas Schievink <[email protected]>2021-03-18 23:06:35 +0000
commitfcbaf585cbac8e94dd6e6f9bfe9cca455e90fb3b (patch)
tree89e44f4bd6e02593bf159dba46107f55edfbaa46 /crates/hir_def/src
parent86878443b1789cac0e48177f5f2b95ad0d6e912c (diff)
Document fields of `ModuleId`
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),