use hir_def::{
path::{Path, PathSegment},
resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs},
- AdtId, AssocContainerId, AssocItemId, EnumVariantId, Lookup,
+ AdtId, AssocItemId, EnumVariantId, ItemContainerId, Lookup,
};
use hir_expand::name::Name;
ValueNs::ImplSelf(impl_id) => {
let generics = crate::utils::generics(self.db.upcast(), impl_id.into());
let substs = generics.type_params_subst(self.db);
- let ty = self.db.impl_self_ty(impl_id).substitute(&Interner, &substs);
+ let ty = self.db.impl_self_ty(impl_id).substitute(Interner, &substs);
if let Some((AdtId::StructId(struct_id), substs)) = ty.as_adt() {
- let ty = self.db.value_ty(struct_id.into()).substitute(&Interner, &substs);
+ let ty = self.db.value_ty(struct_id.into()).substitute(Interner, &substs);
return Some(ty);
} else {
// FIXME: diagnostic, invalid Self reference
ValueNs::GenericParam(it) => return Some(self.db.const_param_ty(it)),
};
- let parent_substs = self_subst.unwrap_or_else(|| Substitution::empty(&Interner));
+ let parent_substs = self_subst.unwrap_or_else(|| Substitution::empty(Interner));
let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver);
let substs = ctx.substs_from_path(path, typable, true);
let ty = TyBuilder::value_ty(self.db, typable)
.use_parent_substs(&parent_substs)
- .fill(substs.as_slice(&Interner)[parent_substs.len(&Interner)..].iter().cloned())
+ .fill(substs.as_slice(Interner)[parent_substs.len(Interner)..].iter().cloned())
.build();
Some(ty)
}
remaining_segments_for_ty,
true,
);
- if let TyKind::Error = ty.kind(&Interner) {
+ if let TyKind::Error = ty.kind(Interner) {
return None;
}
name: &Name,
id: ExprOrPatId,
) -> Option<(ValueNs, Option<Substitution>)> {
- if let TyKind::Error = ty.kind(&Interner) {
+ if let TyKind::Error = ty.kind(Interner) {
return None;
}
self.table.trait_env.clone(),
krate,
&traits_in_scope,
- None,
+ self.resolver.module().into(),
Some(name),
method_resolution::LookupMode::Path,
move |_ty, item| {
AssocItemId::TypeAliasId(_) => unreachable!(),
};
let substs = match container {
- AssocContainerId::ImplId(impl_id) => {
+ ItemContainerId::ImplId(impl_id) => {
let impl_substs = TyBuilder::subst_for_def(self.db, impl_id)
.fill(iter::repeat_with(|| self.table.new_type_var()))
.build();
let impl_self_ty =
- self.db.impl_self_ty(impl_id).substitute(&Interner, &impl_substs);
+ self.db.impl_self_ty(impl_id).substitute(Interner, &impl_substs);
self.unify(&impl_self_ty, &ty);
Some(impl_substs)
}
- AssocContainerId::TraitId(trait_) => {
+ ItemContainerId::TraitId(trait_) => {
// we're picking this method
let trait_ref = TyBuilder::trait_ref(self.db, trait_)
.push(ty.clone())
.fill(std::iter::repeat_with(|| self.table.new_type_var()))
.build();
- self.push_obligation(trait_ref.clone().cast(&Interner));
+ self.push_obligation(trait_ref.clone().cast(Interner));
Some(trait_ref.substitution)
}
- AssocContainerId::ModuleId(_) => None,
+ ItemContainerId::ModuleId(_) | ItemContainerId::ExternBlockId(_) => None,
};
self.write_assoc_resolution(id, item);