diff options
Diffstat (limited to 'crates/ra_hir_def/src/lib.rs')
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index b8dfc0ab1..6dfb3c03d 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -525,6 +525,20 @@ impl HasModule for DefWithBodyId { | |||
525 | } | 525 | } |
526 | } | 526 | } |
527 | 527 | ||
528 | impl HasModule for GenericDefId { | ||
529 | fn module(&self, db: &impl db::DefDatabase) -> ModuleId { | ||
530 | match self { | ||
531 | GenericDefId::FunctionId(it) => it.lookup(db).module(db), | ||
532 | GenericDefId::AdtId(it) => it.module(db), | ||
533 | GenericDefId::TraitId(it) => it.module(db), | ||
534 | GenericDefId::TypeAliasId(it) => it.lookup(db).module(db), | ||
535 | GenericDefId::ImplId(it) => it.module(db), | ||
536 | GenericDefId::EnumVariantId(it) => it.parent.module(db), | ||
537 | GenericDefId::ConstId(it) => it.lookup(db).module(db), | ||
538 | } | ||
539 | } | ||
540 | } | ||
541 | |||
528 | impl HasModule for StaticLoc { | 542 | impl HasModule for StaticLoc { |
529 | fn module(&self, _db: &impl db::DefDatabase) -> ModuleId { | 543 | fn module(&self, _db: &impl db::DefDatabase) -> ModuleId { |
530 | self.container | 544 | self.container |