From 19664e276aba21a42cad5351a2c91995d1ce5d52 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 13 Mar 2021 17:36:07 +0100 Subject: Use chalk_ir::AssocTypeId --- crates/hir/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 7b9de11ed..f15fb1a82 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -51,7 +51,7 @@ use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind}; use hir_ty::{ autoderef, display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter}, - method_resolution, + method_resolution, to_assoc_type_id, traits::{FnTrait, Solution, SolutionVariables}, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, @@ -1683,7 +1683,10 @@ impl Type { .fill(args.iter().map(|t| t.ty.value.clone())) .build(); let predicate = ProjectionPredicate { - projection_ty: ProjectionTy { associated_ty: alias.id, parameters: subst }, + projection_ty: ProjectionTy { + associated_ty: to_assoc_type_id(alias.id), + parameters: subst, + }, ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)).intern(&Interner), }; let goal = Canonical { -- cgit v1.2.3 From 9719ce9fc731a400c9744ba1a6569e978c1a97e7 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 13 Mar 2021 17:55:50 +0100 Subject: Use chalk_ir::FnDefId --- crates/hir/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f15fb1a82..7f8f936d3 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1715,10 +1715,7 @@ impl Type { } pub fn as_callable(&self, db: &dyn HirDatabase) -> Option { - let def = match self.ty.value.interned(&Interner) { - &TyKind::FnDef(def, _) => Some(def), - _ => None, - }; + let def = self.ty.value.callable_def(db); let sig = self.ty.value.callable_sig(db)?; Some(Callable { ty: self.clone(), sig, def, is_bound_method: false }) -- cgit v1.2.3