aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r--crates/hir_ty/src/infer/expr.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 41ef45326..f73bf43b2 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -890,7 +890,7 @@ impl<'a> InferenceContext<'a> {
890 method_name, 890 method_name,
891 ) 891 )
892 }); 892 });
893 let (derefed_receiver_ty, method_ty, substs) = match resolved { 893 let (receiver_ty, method_ty, substs) = match resolved {
894 Some((ty, func)) => { 894 Some((ty, func)) => {
895 let ty = canonicalized_receiver.decanonicalize_ty(ty); 895 let ty = canonicalized_receiver.decanonicalize_ty(ty);
896 let generics = generics(self.db.upcast(), func.into()); 896 let generics = generics(self.db.upcast(), func.into());
@@ -916,16 +916,7 @@ impl<'a> InferenceContext<'a> {
916 } 916 }
917 None => (self.err_ty(), Vec::new(), self.err_ty()), 917 None => (self.err_ty(), Vec::new(), self.err_ty()),
918 }; 918 };
919 // Apply autoref so the below unification works correctly 919 self.unify(&expected_receiver_ty, &receiver_ty);
920 // FIXME: return correct autorefs from lookup_method
921 let actual_receiver_ty = match self.resolve_ty_shallow(&expected_receiver_ty).as_reference()
922 {
923 Some((_, lifetime, mutability)) => {
924 TyKind::Ref(mutability, lifetime, derefed_receiver_ty).intern(&Interner)
925 }
926 _ => derefed_receiver_ty,
927 };
928 self.unify(&expected_receiver_ty, &actual_receiver_ty);
929 920
930 self.check_call_arguments(args, &param_tys); 921 self.check_call_arguments(args, &param_tys);
931 self.normalize_associated_types_in(ret_ty) 922 self.normalize_associated_types_in(ret_ty)