diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index b61f924b7..853e17bae 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -26,7 +26,7 @@ use crate::{ | |||
26 | path::Path, | 26 | path::Path, |
27 | type_ref::{Mutability, TypeRef}, | 27 | type_ref::{Mutability, TypeRef}, |
28 | ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId, StaticLoc, | 28 | ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId, StaticLoc, |
29 | StructLoc, TypeAliasLoc, UnionLoc, | 29 | StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, |
30 | }; | 30 | }; |
31 | 31 | ||
32 | pub(super) fn lower( | 32 | pub(super) fn lower( |
@@ -522,7 +522,14 @@ where | |||
522 | let ast_id = self.expander.ast_id(&def); | 522 | let ast_id = self.expander.ast_id(&def); |
523 | UnionLoc { container, ast_id }.intern(self.db).into() | 523 | UnionLoc { container, ast_id }.intern(self.db).into() |
524 | } | 524 | } |
525 | _ => continue, | 525 | ast::ModuleItem::TraitDef(def) => { |
526 | let ast_id = self.expander.ast_id(&def); | ||
527 | TraitLoc { container, ast_id }.intern(self.db).into() | ||
528 | } | ||
529 | ast::ModuleItem::ImplBlock(_) | ||
530 | | ast::ModuleItem::UseItem(_) | ||
531 | | ast::ModuleItem::ExternCrateItem(_) | ||
532 | | ast::ModuleItem::Module(_) => continue, | ||
526 | }; | 533 | }; |
527 | self.body.defs.push(def) | 534 | self.body.defs.push(def) |
528 | } | 535 | } |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 9b192b597..140eccf26 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -235,7 +235,7 @@ impl_intern_key!(TraitId); | |||
235 | 235 | ||
236 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 236 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
237 | pub struct TraitLoc { | 237 | pub struct TraitLoc { |
238 | pub container: ModuleId, | 238 | pub container: ContainerId, |
239 | pub ast_id: AstId<ast::TraitDef>, | 239 | pub ast_id: AstId<ast::TraitDef>, |
240 | } | 240 | } |
241 | 241 | ||
@@ -499,7 +499,7 @@ impl HasModule for AssocContainerId { | |||
499 | match *self { | 499 | match *self { |
500 | AssocContainerId::ContainerId(it) => it.module(db), | 500 | AssocContainerId::ContainerId(it) => it.module(db), |
501 | AssocContainerId::ImplId(it) => it.lookup(db).container, | 501 | AssocContainerId::ImplId(it) => it.lookup(db).container, |
502 | AssocContainerId::TraitId(it) => it.lookup(db).container, | 502 | AssocContainerId::TraitId(it) => it.lookup(db).container.module(db), |
503 | } | 503 | } |
504 | } | 504 | } |
505 | } | 505 | } |
@@ -548,7 +548,7 @@ impl HasModule for GenericDefId { | |||
548 | match self { | 548 | match self { |
549 | GenericDefId::FunctionId(it) => it.lookup(db).module(db), | 549 | GenericDefId::FunctionId(it) => it.lookup(db).module(db), |
550 | GenericDefId::AdtId(it) => it.module(db), | 550 | GenericDefId::AdtId(it) => it.module(db), |
551 | GenericDefId::TraitId(it) => it.lookup(db).container, | 551 | GenericDefId::TraitId(it) => it.lookup(db).container.module(db), |
552 | GenericDefId::TypeAliasId(it) => it.lookup(db).module(db), | 552 | GenericDefId::TypeAliasId(it) => it.lookup(db).module(db), |
553 | GenericDefId::ImplId(it) => it.lookup(db).container, | 553 | GenericDefId::ImplId(it) => it.lookup(db).container, |
554 | GenericDefId::EnumVariantId(it) => it.parent.lookup(db).container.module(db), | 554 | GenericDefId::EnumVariantId(it) => it.parent.lookup(db).container.module(db), |
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 74c3d4670..a1ea130e0 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -802,7 +802,7 @@ where | |||
802 | PerNs::values(def.into()) | 802 | PerNs::values(def.into()) |
803 | } | 803 | } |
804 | raw::DefKind::Trait(ast_id) => { | 804 | raw::DefKind::Trait(ast_id) => { |
805 | let def = TraitLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) } | 805 | let def = TraitLoc { container, ast_id: AstId::new(self.file_id, ast_id) } |
806 | .intern(self.def_collector.db); | 806 | .intern(self.def_collector.db); |
807 | 807 | ||
808 | PerNs::types(def.into()) | 808 | PerNs::types(def.into()) |