aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-09 17:27:16 +0000
committerJonas Schievink <[email protected]>2021-03-09 17:27:23 +0000
commita430549aa6cb78e3a6c9258305b348743c4d7449 (patch)
tree0948c2f984b3f5ccca17f2307e730090d0a6b477 /crates/hir_def/src
parent12f6bdcfd9fe1393887b3be0d0329fcf11492e75 (diff)
Stop using `ContainerId` in `AssocContainerId`
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/lib.rs6
-rw-r--r--crates/hir_def/src/nameres/collector.rs6
-rw-r--r--crates/hir_def/src/resolver.rs2
3 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index 4498d94bb..ab3b17f6c 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -286,11 +286,11 @@ pub enum ContainerId {
286 286
287#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 287#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
288pub enum AssocContainerId { 288pub enum AssocContainerId {
289 ContainerId(ContainerId), 289 ModuleId(ModuleId),
290 ImplId(ImplId), 290 ImplId(ImplId),
291 TraitId(TraitId), 291 TraitId(TraitId),
292} 292}
293impl_from!(ContainerId for AssocContainerId); 293impl_from!(ModuleId for AssocContainerId);
294 294
295/// A Data Type 295/// A Data Type
296#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] 296#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
@@ -459,7 +459,7 @@ impl HasModule for ContainerId {
459impl HasModule for AssocContainerId { 459impl HasModule for AssocContainerId {
460 fn module(&self, db: &dyn db::DefDatabase) -> ModuleId { 460 fn module(&self, db: &dyn db::DefDatabase) -> ModuleId {
461 match *self { 461 match *self {
462 AssocContainerId::ContainerId(it) => it.module(db), 462 AssocContainerId::ModuleId(it) => it,
463 AssocContainerId::ImplId(it) => it.lookup(db).container.module(db), 463 AssocContainerId::ImplId(it) => it.lookup(db).container.module(db),
464 AssocContainerId::TraitId(it) => it.lookup(db).container.module(db), 464 AssocContainerId::TraitId(it) => it.lookup(db).container.module(db),
465 } 465 }
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 3bb69d935..5bf2ba721 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1121,7 +1121,7 @@ impl ModCollector<'_, '_> {
1121 1121
1122 def = Some(DefData { 1122 def = Some(DefData {
1123 id: FunctionLoc { 1123 id: FunctionLoc {
1124 container: container.into(), 1124 container: module.into(),
1125 id: ItemTreeId::new(self.file_id, id), 1125 id: ItemTreeId::new(self.file_id, id),
1126 } 1126 }
1127 .intern(self.def_collector.db) 1127 .intern(self.def_collector.db)
@@ -1188,7 +1188,7 @@ impl ModCollector<'_, '_> {
1188 if let Some(name) = &it.name { 1188 if let Some(name) = &it.name {
1189 def = Some(DefData { 1189 def = Some(DefData {
1190 id: ConstLoc { 1190 id: ConstLoc {
1191 container: container.into(), 1191 container: module.into(),
1192 id: ItemTreeId::new(self.file_id, id), 1192 id: ItemTreeId::new(self.file_id, id),
1193 } 1193 }
1194 .intern(self.def_collector.db) 1194 .intern(self.def_collector.db)
@@ -1228,7 +1228,7 @@ impl ModCollector<'_, '_> {
1228 1228
1229 def = Some(DefData { 1229 def = Some(DefData {
1230 id: TypeAliasLoc { 1230 id: TypeAliasLoc {
1231 container: container.into(), 1231 container: module.into(),
1232 id: ItemTreeId::new(self.file_id, id), 1232 id: ItemTreeId::new(self.file_id, id),
1233 } 1233 }
1234 .intern(self.def_collector.db) 1234 .intern(self.def_collector.db)
diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs
index 28b184f7c..6f036c8c4 100644
--- a/crates/hir_def/src/resolver.rs
+++ b/crates/hir_def/src/resolver.rs
@@ -700,7 +700,7 @@ impl HasResolver for ContainerId {
700impl HasResolver for AssocContainerId { 700impl HasResolver for AssocContainerId {
701 fn resolver(self, db: &dyn DefDatabase) -> Resolver { 701 fn resolver(self, db: &dyn DefDatabase) -> Resolver {
702 match self { 702 match self {
703 AssocContainerId::ContainerId(it) => it.resolver(db), 703 AssocContainerId::ModuleId(it) => it.resolver(db),
704 AssocContainerId::TraitId(it) => it.resolver(db), 704 AssocContainerId::TraitId(it) => it.resolver(db),
705 AssocContainerId::ImplId(it) => it.resolver(db), 705 AssocContainerId::ImplId(it) => it.resolver(db),
706 } 706 }