diff options
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 4e77f22fd..153f22f25 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -18,7 +18,8 @@ use crate::{ | |||
18 | lower::lower_to_chalk_mutability, | 18 | lower::lower_to_chalk_mutability, |
19 | method_resolution, op, | 19 | method_resolution, op, |
20 | primitive::{self, UintTy}, | 20 | primitive::{self, UintTy}, |
21 | traits::{FnTrait, InEnvironment}, | 21 | to_assoc_type_id, |
22 | traits::{chalk::from_chalk, FnTrait, InEnvironment}, | ||
22 | utils::{generics, variant_data, Generics}, | 23 | utils::{generics, variant_data, Generics}, |
23 | AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, OpaqueTyId, Rawness, | 24 | AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, OpaqueTyId, Rawness, |
24 | Scalar, Substs, TraitRef, Ty, TyKind, | 25 | Scalar, Substs, TraitRef, Ty, TyKind, |
@@ -97,8 +98,10 @@ impl<'a> InferenceContext<'a> { | |||
97 | }); | 98 | }); |
98 | if self.db.trait_solve(krate, goal.value).is_some() { | 99 | if self.db.trait_solve(krate, goal.value).is_some() { |
99 | self.obligations.push(implements_fn_trait); | 100 | self.obligations.push(implements_fn_trait); |
100 | let output_proj_ty = | 101 | let output_proj_ty = crate::ProjectionTy { |
101 | crate::ProjectionTy { associated_ty: output_assoc_type, parameters: substs }; | 102 | associated_ty: to_assoc_type_id(output_assoc_type), |
103 | parameters: substs, | ||
104 | }; | ||
102 | let return_ty = self.normalize_projection_ty(output_proj_ty); | 105 | let return_ty = self.normalize_projection_ty(output_proj_ty); |
103 | Some((arg_tys, return_ty)) | 106 | Some((arg_tys, return_ty)) |
104 | } else { | 107 | } else { |
@@ -929,8 +932,9 @@ impl<'a> InferenceContext<'a> { | |||
929 | } | 932 | } |
930 | 933 | ||
931 | fn register_obligations_for_call(&mut self, callable_ty: &Ty) { | 934 | fn register_obligations_for_call(&mut self, callable_ty: &Ty) { |
932 | if let TyKind::FnDef(def, parameters) = callable_ty.interned(&Interner) { | 935 | if let TyKind::FnDef(fn_def, parameters) = callable_ty.interned(&Interner) { |
933 | let generic_predicates = self.db.generic_predicates((*def).into()); | 936 | let def: CallableDefId = from_chalk(self.db, *fn_def); |
937 | let generic_predicates = self.db.generic_predicates(def.into()); | ||
934 | for predicate in generic_predicates.iter() { | 938 | for predicate in generic_predicates.iter() { |
935 | let predicate = predicate.clone().subst(parameters); | 939 | let predicate = predicate.clone().subst(parameters); |
936 | if let Some(obligation) = Obligation::from_predicate(predicate) { | 940 | if let Some(obligation) = Obligation::from_predicate(predicate) { |