diff options
author | Jonas Schievink <[email protected]> | 2021-03-09 17:27:16 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-09 17:27:23 +0000 |
commit | a430549aa6cb78e3a6c9258305b348743c4d7449 (patch) | |
tree | 0948c2f984b3f5ccca17f2307e730090d0a6b477 | |
parent | 12f6bdcfd9fe1393887b3be0d0329fcf11492e75 (diff) |
Stop using `ContainerId` in `AssocContainerId`
-rw-r--r-- | crates/hir/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/hir_def/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 6 | ||||
-rw-r--r-- | crates/hir_def/src/resolver.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/path.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/utils.rs | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 638398e29..c6d424c48 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1157,7 +1157,7 @@ where | |||
1157 | { | 1157 | { |
1158 | match id.lookup(db.upcast()).container { | 1158 | match id.lookup(db.upcast()).container { |
1159 | AssocContainerId::TraitId(_) | AssocContainerId::ImplId(_) => Some(ctor(DEF::from(id))), | 1159 | AssocContainerId::TraitId(_) | AssocContainerId::ImplId(_) => Some(ctor(DEF::from(id))), |
1160 | AssocContainerId::ContainerId(_) => None, | 1160 | AssocContainerId::ModuleId(_) => None, |
1161 | } | 1161 | } |
1162 | } | 1162 | } |
1163 | 1163 | ||
@@ -1185,7 +1185,7 @@ impl AssocItem { | |||
1185 | match container { | 1185 | match container { |
1186 | AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()), | 1186 | AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()), |
1187 | AssocContainerId::ImplId(id) => AssocItemContainer::Impl(id.into()), | 1187 | AssocContainerId::ImplId(id) => AssocItemContainer::Impl(id.into()), |
1188 | AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"), | 1188 | AssocContainerId::ModuleId(_) => panic!("invalid AssocItem"), |
1189 | } | 1189 | } |
1190 | } | 1190 | } |
1191 | 1191 | ||
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)] |
288 | pub enum AssocContainerId { | 288 | pub enum AssocContainerId { |
289 | ContainerId(ContainerId), | 289 | ModuleId(ModuleId), |
290 | ImplId(ImplId), | 290 | ImplId(ImplId), |
291 | TraitId(TraitId), | 291 | TraitId(TraitId), |
292 | } | 292 | } |
293 | impl_from!(ContainerId for AssocContainerId); | 293 | impl_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 { | |||
459 | impl HasModule for AssocContainerId { | 459 | impl 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 { | |||
700 | impl HasResolver for AssocContainerId { | 700 | impl 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 | } |
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 5d541104e..ae3554bac 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
@@ -260,7 +260,7 @@ impl<'a> InferenceContext<'a> { | |||
260 | })); | 260 | })); |
261 | Some(trait_substs) | 261 | Some(trait_substs) |
262 | } | 262 | } |
263 | AssocContainerId::ContainerId(_) => None, | 263 | AssocContainerId::ModuleId(_) => None, |
264 | }; | 264 | }; |
265 | 265 | ||
266 | self.write_assoc_resolution(id, item); | 266 | self.write_assoc_resolution(id, item); |
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 24db33c49..248367267 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -715,7 +715,7 @@ fn transform_receiver_ty( | |||
715 | .fill_with_unknown() | 715 | .fill_with_unknown() |
716 | .build() | 716 | .build() |
717 | } | 717 | } |
718 | AssocContainerId::ContainerId(_) => unreachable!(), | 718 | AssocContainerId::ModuleId(_) => unreachable!(), |
719 | }; | 719 | }; |
720 | let sig = db.callable_item_signature(function_id.into()); | 720 | let sig = db.callable_item_signature(function_id.into()); |
721 | Some(sig.value.params()[0].clone().subst_bound_vars(&substs)) | 721 | Some(sig.value.params()[0].clone().subst_bound_vars(&substs)) |
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index 65b79df0d..7351e4e54 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs | |||
@@ -259,6 +259,6 @@ fn parent_generic_def(db: &dyn DefDatabase, def: GenericDefId) -> Option<Generic | |||
259 | match container { | 259 | match container { |
260 | AssocContainerId::ImplId(it) => Some(it.into()), | 260 | AssocContainerId::ImplId(it) => Some(it.into()), |
261 | AssocContainerId::TraitId(it) => Some(it.into()), | 261 | AssocContainerId::TraitId(it) => Some(it.into()), |
262 | AssocContainerId::ContainerId(_) => None, | 262 | AssocContainerId::ModuleId(_) => None, |
263 | } | 263 | } |
264 | } | 264 | } |