From bb6e1bf811bce09fdab115a4257e47cc0d5ddc82 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 24 Mar 2021 17:00:29 +0100 Subject: Lower traits to TraitRef instead of TypeRef --- crates/hir/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 4ee08ef21..99d858eb3 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -44,6 +44,7 @@ use hir_def::{ per_ns::PerNs, resolver::{HasResolver, Resolver}, src::HasSource as _, + type_ref::TraitRef, AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, ConstParamId, DefWithBodyId, EnumId, FunctionId, GenericDefId, HasModule, ImplId, LifetimeParamId, LocalEnumVariantId, LocalFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, @@ -1613,7 +1614,7 @@ impl Impl { // FIXME: the return type is wrong. This should be a hir version of // `TraitRef` (ie, resolved `TypeRef`). - pub fn target_trait(self, db: &dyn HirDatabase) -> Option { + pub fn target_trait(self, db: &dyn HirDatabase) -> Option { db.impl_data(self.id).target_trait.clone() } -- cgit v1.2.3 From c2a63b97a80cb738f800da61c64e748994709c31 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 29 Mar 2021 17:46:33 +0200 Subject: Rename target_ty to self_ty --- crates/hir/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 99d858eb3..97f162315 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1574,9 +1574,9 @@ impl Impl { }; let filter = |impl_def: &Impl| { - let target_ty = impl_def.target_ty(db); - let rref = target_ty.remove_ref(); - ty.equals_ctor(rref.as_ref().map_or(&target_ty.ty, |it| &it.ty)) + let self_ty = impl_def.self_ty(db); + let rref = self_ty.remove_ref(); + ty.equals_ctor(rref.as_ref().map_or(&self_ty.ty, |it| &it.ty)) }; let mut all = Vec::new(); @@ -1614,16 +1614,16 @@ impl Impl { // FIXME: the return type is wrong. This should be a hir version of // `TraitRef` (ie, resolved `TypeRef`). - pub fn target_trait(self, db: &dyn HirDatabase) -> Option { + pub fn trait_(self, db: &dyn HirDatabase) -> Option { db.impl_data(self.id).target_trait.clone() } - pub fn target_ty(self, db: &dyn HirDatabase) -> Type { + pub fn self_ty(self, db: &dyn HirDatabase) -> Type { let impl_data = db.impl_data(self.id); let resolver = self.id.resolver(db.upcast()); let krate = self.id.lookup(db.upcast()).container.krate(); let ctx = hir_ty::TyLoweringContext::new(db, &resolver); - let ty = ctx.lower_ty(&impl_data.target_type); + let ty = ctx.lower_ty(&impl_data.self_ty); Type::new_with_resolver_inner(db, krate, &resolver, ty) } -- cgit v1.2.3