aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 140b3a87f..cf3b04511 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -123,7 +123,7 @@ impl_froms!(
123); 123);
124 124
125pub use hir_def::{ 125pub use hir_def::{
126 attr::Attrs, item_scope::ItemInNs, visibility::Visibility, AssocContainerId, AssocItemId, 126 attr::Attrs, item_scope::ItemInNs, visibility::Visibility, AssocItemId, AssocItemLoc,
127}; 127};
128use rustc_hash::FxHashSet; 128use rustc_hash::FxHashSet;
129 129
@@ -548,10 +548,6 @@ impl Function {
548 let mut validator = ExprValidator::new(self.id, infer, sink); 548 let mut validator = ExprValidator::new(self.id, infer, sink);
549 validator.validate_body(db); 549 validator.validate_body(db);
550 } 550 }
551
552 pub fn container(self, db: &impl DefDatabase) -> AssocContainerId {
553 self.id.lookup(db).container
554 }
555} 551}
556 552
557#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 553#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -701,11 +697,16 @@ impl AssocItem {
701 } 697 }
702 } 698 }
703 699
704 pub fn container(self, db: &impl DefDatabase) -> AssocContainerId { 700 pub fn container(self, db: &impl DefDatabase) -> AssocItemContainer {
705 match self { 701 let container = match self {
706 AssocItem::Function(f) => f.container(db), 702 AssocItem::Function(it) => it.id.lookup(db).container,
707 AssocItem::Const(c) => c.id.lookup(db).container, 703 AssocItem::Const(it) => it.id.lookup(db).container,
708 AssocItem::TypeAlias(t) => t.id.lookup(db).container, 704 AssocItem::TypeAlias(it) => it.id.lookup(db).container,
705 };
706 match container {
707 AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()),
708 AssocContainerId::ImplId(id) => AssocItemContainer::ImplBlock(id.into()),
709 AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"),
709 } 710 }
710 } 711 }
711} 712}
@@ -818,7 +819,7 @@ impl TypeParam {
818 } 819 }
819} 820}
820 821
821// FIXME: rename to `ImplBlock` 822// FIXME: rename from `ImplBlock` to `Impl`
822#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 823#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
823pub struct ImplBlock { 824pub struct ImplBlock {
824 pub(crate) id: ImplId, 825 pub(crate) id: ImplId,