aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-20 10:59:50 +0000
committerAleksey Kladov <[email protected]>2019-12-20 11:00:05 +0000
commit8fc20b65035d93bcc1b3a89127916bd165a8d938 (patch)
tree7e95963bb359eb6eeda8f6aba564fd3eaf7030d2 /crates/ra_hir_ty
parent67c2aea182c375108ebb8b923f5679e4f7fef1df (diff)
Rename ContainerId -> AssocContainerId
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs4
-rw-r--r--crates/ra_hir_ty/src/infer/path.rs8
-rw-r--r--crates/ra_hir_ty/src/lib.rs8
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs10
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs6
-rw-r--r--crates/ra_hir_ty/src/utils.rs8
6 files changed, 22 insertions, 22 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 924ad3e81..6917c183b 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -8,7 +8,7 @@ use hir_def::{
8 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, 8 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
9 path::{GenericArg, GenericArgs}, 9 path::{GenericArg, GenericArgs},
10 resolver::resolver_for_expr, 10 resolver::resolver_for_expr,
11 AdtId, ContainerId, Lookup, StructFieldId, 11 AdtId, AssocContainerId, Lookup, StructFieldId,
12}; 12};
13use hir_expand::name::{name, Name}; 13use hir_expand::name::{name, Name};
14use ra_syntax::ast::RangeOp; 14use ra_syntax::ast::RangeOp;
@@ -672,7 +672,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
672 // add obligation for trait implementation, if this is a trait method 672 // add obligation for trait implementation, if this is a trait method
673 match def { 673 match def {
674 CallableDef::FunctionId(f) => { 674 CallableDef::FunctionId(f) => {
675 if let ContainerId::TraitId(trait_) = f.lookup(self.db).container { 675 if let AssocContainerId::TraitId(trait_) = f.lookup(self.db).container {
676 // construct a TraitDef 676 // construct a TraitDef
677 let substs = 677 let substs =
678 a_ty.parameters.prefix(generics(self.db, trait_.into()).len()); 678 a_ty.parameters.prefix(generics(self.db, trait_.into()).len());
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/ra_hir_ty/src/infer/path.rs
index 31c90ea1e..a96ab75d1 100644
--- a/crates/ra_hir_ty/src/infer/path.rs
+++ b/crates/ra_hir_ty/src/infer/path.rs
@@ -5,7 +5,7 @@ use std::iter;
5use hir_def::{ 5use hir_def::{
6 path::{Path, PathSegment}, 6 path::{Path, PathSegment},
7 resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, 7 resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs},
8 AssocItemId, ContainerId, Lookup, 8 AssocContainerId, AssocItemId, Lookup,
9}; 9};
10use hir_expand::name::Name; 10use hir_expand::name::Name;
11 11
@@ -209,7 +209,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
209 AssocItemId::TypeAliasId(_) => unreachable!(), 209 AssocItemId::TypeAliasId(_) => unreachable!(),
210 }; 210 };
211 let substs = match container { 211 let substs = match container {
212 ContainerId::ImplId(impl_id) => { 212 AssocContainerId::ImplId(impl_id) => {
213 let impl_substs = Substs::build_for_def(self.db, impl_id) 213 let impl_substs = Substs::build_for_def(self.db, impl_id)
214 .fill(iter::repeat_with(|| self.table.new_type_var())) 214 .fill(iter::repeat_with(|| self.table.new_type_var()))
215 .build(); 215 .build();
@@ -221,7 +221,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
221 self.unify(&impl_self_ty, &ty); 221 self.unify(&impl_self_ty, &ty);
222 Some(substs) 222 Some(substs)
223 } 223 }
224 ContainerId::TraitId(trait_) => { 224 AssocContainerId::TraitId(trait_) => {
225 // we're picking this method 225 // we're picking this method
226 let trait_substs = Substs::build_for_def(self.db, trait_) 226 let trait_substs = Substs::build_for_def(self.db, trait_)
227 .push(ty.clone()) 227 .push(ty.clone())
@@ -237,7 +237,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
237 })); 237 }));
238 Some(substs) 238 Some(substs)
239 } 239 }
240 ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => None, 240 AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => None,
241 }; 241 };
242 242
243 self.write_assoc_resolution(id, item.into()); 243 self.write_assoc_resolution(id, item.into());
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 7ca9e6b8a..7310ef10d 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -44,8 +44,8 @@ use std::sync::Arc;
44use std::{fmt, iter, mem}; 44use std::{fmt, iter, mem};
45 45
46use hir_def::{ 46use hir_def::{
47 expr::ExprId, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId, GenericDefId, HasModule, 47 expr::ExprId, type_ref::Mutability, AdtId, AssocContainerId, DefWithBodyId, GenericDefId,
48 Lookup, TraitId, TypeAliasId, 48 HasModule, Lookup, TraitId, TypeAliasId,
49}; 49};
50use hir_expand::name::Name; 50use hir_expand::name::Name;
51use ra_db::{impl_intern_key, salsa, CrateId}; 51use ra_db::{impl_intern_key, salsa, CrateId};
@@ -251,7 +251,7 @@ impl ProjectionTy {
251 251
252 fn trait_(&self, db: &impl HirDatabase) -> TraitId { 252 fn trait_(&self, db: &impl HirDatabase) -> TraitId {
253 match self.associated_ty.lookup(db).container { 253 match self.associated_ty.lookup(db).container {
254 ContainerId::TraitId(it) => it, 254 AssocContainerId::TraitId(it) => it,
255 _ => panic!("projection ty without parent trait"), 255 _ => panic!("projection ty without parent trait"),
256 } 256 }
257 } 257 }
@@ -943,7 +943,7 @@ impl HirDisplay for ApplicationTy {
943 } 943 }
944 TypeCtor::AssociatedType(type_alias) => { 944 TypeCtor::AssociatedType(type_alias) => {
945 let trait_ = match type_alias.lookup(f.db).container { 945 let trait_ = match type_alias.lookup(f.db).container {
946 ContainerId::TraitId(it) => it, 946 AssocContainerId::TraitId(it) => it,
947 _ => panic!("not an associated type"), 947 _ => panic!("not an associated type"),
948 }; 948 };
949 let trait_name = f.db.trait_data(trait_).name.clone(); 949 let trait_name = f.db.trait_data(trait_).name.clone();
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs
index d0b2b016d..1c2e7b934 100644
--- a/crates/ra_hir_ty/src/method_resolution.rs
+++ b/crates/ra_hir_ty/src/method_resolution.rs
@@ -6,8 +6,8 @@ use std::sync::Arc;
6 6
7use arrayvec::ArrayVec; 7use arrayvec::ArrayVec;
8use hir_def::{ 8use hir_def::{
9 lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocItemId, ContainerId, 9 lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocContainerId,
10 FunctionId, HasModule, ImplId, Lookup, TraitId, 10 AssocItemId, FunctionId, HasModule, ImplId, Lookup, TraitId,
11}; 11};
12use hir_expand::name::Name; 12use hir_expand::name::Name;
13use ra_db::CrateId; 13use ra_db::CrateId;
@@ -451,12 +451,12 @@ fn transform_receiver_ty(
451 self_ty: &Canonical<Ty>, 451 self_ty: &Canonical<Ty>,
452) -> Option<Ty> { 452) -> Option<Ty> {
453 let substs = match function_id.lookup(db).container { 453 let substs = match function_id.lookup(db).container {
454 ContainerId::TraitId(_) => Substs::build_for_def(db, function_id) 454 AssocContainerId::TraitId(_) => Substs::build_for_def(db, function_id)
455 .push(self_ty.value.clone()) 455 .push(self_ty.value.clone())
456 .fill_with_unknown() 456 .fill_with_unknown()
457 .build(), 457 .build(),
458 ContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?, 458 AssocContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?,
459 ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => unreachable!(), 459 AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => unreachable!(),
460 }; 460 };
461 let sig = db.callable_item_signature(function_id.into()); 461 let sig = db.callable_item_signature(function_id.into());
462 Some(sig.params()[0].clone().subst(&substs)) 462 Some(sig.params()[0].clone().subst(&substs))
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index fc21872b2..6a31014d8 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -9,7 +9,7 @@ use chalk_ir::{
9}; 9};
10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; 10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum};
11 11
12use hir_def::{AssocItemId, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId}; 12use hir_def::{AssocContainerId, AssocItemId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId};
13use ra_db::{ 13use ra_db::{
14 salsa::{InternId, InternKey}, 14 salsa::{InternId, InternKey},
15 CrateId, 15 CrateId,
@@ -542,7 +542,7 @@ pub(crate) fn associated_ty_data_query(
542 debug!("associated_ty_data {:?}", id); 542 debug!("associated_ty_data {:?}", id);
543 let type_alias: TypeAliasId = from_chalk(db, id); 543 let type_alias: TypeAliasId = from_chalk(db, id);
544 let trait_ = match type_alias.lookup(db).container { 544 let trait_ = match type_alias.lookup(db).container {
545 ContainerId::TraitId(t) => t, 545 AssocContainerId::TraitId(t) => t,
546 _ => panic!("associated type not in trait"), 546 _ => panic!("associated type not in trait"),
547 }; 547 };
548 let generic_params = generics(db, type_alias.into()); 548 let generic_params = generics(db, type_alias.into());
@@ -755,7 +755,7 @@ fn type_alias_associated_ty_value(
755) -> Arc<AssociatedTyValue<ChalkIr>> { 755) -> Arc<AssociatedTyValue<ChalkIr>> {
756 let type_alias_data = db.type_alias_data(type_alias); 756 let type_alias_data = db.type_alias_data(type_alias);
757 let impl_id = match type_alias.lookup(db).container { 757 let impl_id = match type_alias.lookup(db).container {
758 ContainerId::ImplId(it) => it, 758 AssocContainerId::ImplId(it) => it,
759 _ => panic!("assoc ty value should be in impl"), 759 _ => panic!("assoc ty value should be in impl"),
760 }; 760 };
761 761
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs
index 34defc1a2..8b5b611ec 100644
--- a/crates/ra_hir_ty/src/utils.rs
+++ b/crates/ra_hir_ty/src/utils.rs
@@ -9,7 +9,7 @@ use hir_def::{
9 path::Path, 9 path::Path,
10 resolver::{HasResolver, TypeNs}, 10 resolver::{HasResolver, TypeNs},
11 type_ref::TypeRef, 11 type_ref::TypeRef,
12 ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId, 12 AssocContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId,
13}; 13};
14use hir_expand::name::{name, Name}; 14use hir_expand::name::{name, Name};
15 15
@@ -155,8 +155,8 @@ fn parent_generic_def(db: &impl DefDatabase, def: GenericDefId) -> Option<Generi
155 }; 155 };
156 156
157 match container { 157 match container {
158 ContainerId::ImplId(it) => Some(it.into()), 158 AssocContainerId::ImplId(it) => Some(it.into()),
159 ContainerId::TraitId(it) => Some(it.into()), 159 AssocContainerId::TraitId(it) => Some(it.into()),
160 ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => None, 160 AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => None,
161 } 161 }
162} 162}