aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index a88a78b38..274dd1467 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -489,6 +489,16 @@ impl HasModule for AdtId {
489 } 489 }
490} 490}
491 491
492impl HasModule for DefWithBodyId {
493 fn module(&self, db: &impl db::DefDatabase) -> ModuleId {
494 match self {
495 DefWithBodyId::FunctionId(it) => it.lookup(db).module(db),
496 DefWithBodyId::StaticId(it) => it.lookup(db).module(db),
497 DefWithBodyId::ConstId(it) => it.lookup(db).module(db),
498 }
499 }
500}
501
492impl HasModule for StaticLoc { 502impl HasModule for StaticLoc {
493 fn module(&self, _db: &impl db::DefDatabase) -> ModuleId { 503 fn module(&self, _db: &impl db::DefDatabase) -> ModuleId {
494 self.container 504 self.container