mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Rename ContainerId -> AssocContainerId
This commit is contained in:
parent
67c2aea182
commit
8fc20b6503
11 changed files with 51 additions and 51 deletions
|
@ -8,7 +8,7 @@ use hir_def::{
|
|||
expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
|
||||
path::{GenericArg, GenericArgs},
|
||||
resolver::resolver_for_expr,
|
||||
AdtId, ContainerId, Lookup, StructFieldId,
|
||||
AdtId, AssocContainerId, Lookup, StructFieldId,
|
||||
};
|
||||
use hir_expand::name::{name, Name};
|
||||
use ra_syntax::ast::RangeOp;
|
||||
|
@ -672,7 +672,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||
// add obligation for trait implementation, if this is a trait method
|
||||
match def {
|
||||
CallableDef::FunctionId(f) => {
|
||||
if let ContainerId::TraitId(trait_) = f.lookup(self.db).container {
|
||||
if let AssocContainerId::TraitId(trait_) = f.lookup(self.db).container {
|
||||
// construct a TraitDef
|
||||
let substs =
|
||||
a_ty.parameters.prefix(generics(self.db, trait_.into()).len());
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::iter;
|
|||
use hir_def::{
|
||||
path::{Path, PathSegment},
|
||||
resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs},
|
||||
AssocItemId, ContainerId, Lookup,
|
||||
AssocContainerId, AssocItemId, Lookup,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
|
||||
|
@ -209,7 +209,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||
AssocItemId::TypeAliasId(_) => unreachable!(),
|
||||
};
|
||||
let substs = match container {
|
||||
ContainerId::ImplId(impl_id) => {
|
||||
AssocContainerId::ImplId(impl_id) => {
|
||||
let impl_substs = Substs::build_for_def(self.db, impl_id)
|
||||
.fill(iter::repeat_with(|| self.table.new_type_var()))
|
||||
.build();
|
||||
|
@ -221,7 +221,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||
self.unify(&impl_self_ty, &ty);
|
||||
Some(substs)
|
||||
}
|
||||
ContainerId::TraitId(trait_) => {
|
||||
AssocContainerId::TraitId(trait_) => {
|
||||
// we're picking this method
|
||||
let trait_substs = Substs::build_for_def(self.db, trait_)
|
||||
.push(ty.clone())
|
||||
|
@ -237,7 +237,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||
}));
|
||||
Some(substs)
|
||||
}
|
||||
ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => None,
|
||||
AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => None,
|
||||
};
|
||||
|
||||
self.write_assoc_resolution(id, item.into());
|
||||
|
|
|
@ -44,8 +44,8 @@ use std::sync::Arc;
|
|||
use std::{fmt, iter, mem};
|
||||
|
||||
use hir_def::{
|
||||
expr::ExprId, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId, GenericDefId, HasModule,
|
||||
Lookup, TraitId, TypeAliasId,
|
||||
expr::ExprId, type_ref::Mutability, AdtId, AssocContainerId, DefWithBodyId, GenericDefId,
|
||||
HasModule, Lookup, TraitId, TypeAliasId,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
use ra_db::{impl_intern_key, salsa, CrateId};
|
||||
|
@ -251,7 +251,7 @@ impl ProjectionTy {
|
|||
|
||||
fn trait_(&self, db: &impl HirDatabase) -> TraitId {
|
||||
match self.associated_ty.lookup(db).container {
|
||||
ContainerId::TraitId(it) => it,
|
||||
AssocContainerId::TraitId(it) => it,
|
||||
_ => panic!("projection ty without parent trait"),
|
||||
}
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ impl HirDisplay for ApplicationTy {
|
|||
}
|
||||
TypeCtor::AssociatedType(type_alias) => {
|
||||
let trait_ = match type_alias.lookup(f.db).container {
|
||||
ContainerId::TraitId(it) => it,
|
||||
AssocContainerId::TraitId(it) => it,
|
||||
_ => panic!("not an associated type"),
|
||||
};
|
||||
let trait_name = f.db.trait_data(trait_).name.clone();
|
||||
|
|
|
@ -6,8 +6,8 @@ use std::sync::Arc;
|
|||
|
||||
use arrayvec::ArrayVec;
|
||||
use hir_def::{
|
||||
lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocItemId, ContainerId,
|
||||
FunctionId, HasModule, ImplId, Lookup, TraitId,
|
||||
lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocContainerId,
|
||||
AssocItemId, FunctionId, HasModule, ImplId, Lookup, TraitId,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
use ra_db::CrateId;
|
||||
|
@ -451,12 +451,12 @@ fn transform_receiver_ty(
|
|||
self_ty: &Canonical<Ty>,
|
||||
) -> Option<Ty> {
|
||||
let substs = match function_id.lookup(db).container {
|
||||
ContainerId::TraitId(_) => Substs::build_for_def(db, function_id)
|
||||
AssocContainerId::TraitId(_) => Substs::build_for_def(db, function_id)
|
||||
.push(self_ty.value.clone())
|
||||
.fill_with_unknown()
|
||||
.build(),
|
||||
ContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?,
|
||||
ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => unreachable!(),
|
||||
AssocContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?,
|
||||
AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => unreachable!(),
|
||||
};
|
||||
let sig = db.callable_item_signature(function_id.into());
|
||||
Some(sig.params()[0].clone().subst(&substs))
|
||||
|
|
|
@ -9,7 +9,7 @@ use chalk_ir::{
|
|||
};
|
||||
use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum};
|
||||
|
||||
use hir_def::{AssocItemId, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId};
|
||||
use hir_def::{AssocContainerId, AssocItemId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId};
|
||||
use ra_db::{
|
||||
salsa::{InternId, InternKey},
|
||||
CrateId,
|
||||
|
@ -542,7 +542,7 @@ pub(crate) fn associated_ty_data_query(
|
|||
debug!("associated_ty_data {:?}", id);
|
||||
let type_alias: TypeAliasId = from_chalk(db, id);
|
||||
let trait_ = match type_alias.lookup(db).container {
|
||||
ContainerId::TraitId(t) => t,
|
||||
AssocContainerId::TraitId(t) => t,
|
||||
_ => panic!("associated type not in trait"),
|
||||
};
|
||||
let generic_params = generics(db, type_alias.into());
|
||||
|
@ -755,7 +755,7 @@ fn type_alias_associated_ty_value(
|
|||
) -> Arc<AssociatedTyValue<ChalkIr>> {
|
||||
let type_alias_data = db.type_alias_data(type_alias);
|
||||
let impl_id = match type_alias.lookup(db).container {
|
||||
ContainerId::ImplId(it) => it,
|
||||
AssocContainerId::ImplId(it) => it,
|
||||
_ => panic!("assoc ty value should be in impl"),
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use hir_def::{
|
|||
path::Path,
|
||||
resolver::{HasResolver, TypeNs},
|
||||
type_ref::TypeRef,
|
||||
ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId,
|
||||
AssocContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId,
|
||||
};
|
||||
use hir_expand::name::{name, Name};
|
||||
|
||||
|
@ -155,8 +155,8 @@ fn parent_generic_def(db: &impl DefDatabase, def: GenericDefId) -> Option<Generi
|
|||
};
|
||||
|
||||
match container {
|
||||
ContainerId::ImplId(it) => Some(it.into()),
|
||||
ContainerId::TraitId(it) => Some(it.into()),
|
||||
ContainerId::ModuleId(_) | ContainerId::DefWithBodyId(_) => None,
|
||||
AssocContainerId::ImplId(it) => Some(it.into()),
|
||||
AssocContainerId::TraitId(it) => Some(it.into()),
|
||||
AssocContainerId::ModuleId(_) | AssocContainerId::DefWithBodyId(_) => None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue