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, 8 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 5f8ad2174..6966d26e7 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -419,7 +419,7 @@ impl<'a> InferenceContext<'a> { | |||
419 | self.result.record_field_resolutions.insert(field.expr, field_def); | 419 | self.result.record_field_resolutions.insert(field.expr, field_def); |
420 | } | 420 | } |
421 | let field_ty = field_def.map_or(self.err_ty(), |it| { | 421 | let field_ty = field_def.map_or(self.err_ty(), |it| { |
422 | field_types[it.local_id].clone().substitute(&substs) | 422 | field_types[it.local_id].clone().substitute(&Interner, &substs) |
423 | }); | 423 | }); |
424 | self.infer_expr_coerce(field.expr, &Expectation::has_type(field_ty)); | 424 | self.infer_expr_coerce(field.expr, &Expectation::has_type(field_ty)); |
425 | } | 425 | } |
@@ -462,7 +462,7 @@ impl<'a> InferenceContext<'a> { | |||
462 | Some( | 462 | Some( |
463 | self.db.field_types((*s).into())[field.local_id] | 463 | self.db.field_types((*s).into())[field.local_id] |
464 | .clone() | 464 | .clone() |
465 | .substitute(¶meters), | 465 | .substitute(&Interner, ¶meters), |
466 | ) | 466 | ) |
467 | } else { | 467 | } else { |
468 | None | 468 | None |
@@ -476,7 +476,7 @@ impl<'a> InferenceContext<'a> { | |||
476 | Some( | 476 | Some( |
477 | self.db.field_types((*u).into())[field.local_id] | 477 | self.db.field_types((*u).into())[field.local_id] |
478 | .clone() | 478 | .clone() |
479 | .substitute(¶meters), | 479 | .substitute(&Interner, ¶meters), |
480 | ) | 480 | ) |
481 | } else { | 481 | } else { |
482 | None | 482 | None |
@@ -852,7 +852,7 @@ impl<'a> InferenceContext<'a> { | |||
852 | None => (receiver_ty, Binders::empty(&Interner, self.err_ty()), None), | 852 | None => (receiver_ty, Binders::empty(&Interner, self.err_ty()), None), |
853 | }; | 853 | }; |
854 | let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty); | 854 | let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty); |
855 | let method_ty = method_ty.substitute(&substs); | 855 | let method_ty = method_ty.substitute(&Interner, &substs); |
856 | let method_ty = self.insert_type_vars(method_ty); | 856 | let method_ty = self.insert_type_vars(method_ty); |
857 | self.register_obligations_for_call(&method_ty); | 857 | self.register_obligations_for_call(&method_ty); |
858 | let (expected_receiver_ty, param_tys, ret_ty) = match method_ty.callable_sig(self.db) { | 858 | let (expected_receiver_ty, param_tys, ret_ty) = match method_ty.callable_sig(self.db) { |
@@ -949,8 +949,10 @@ impl<'a> InferenceContext<'a> { | |||
949 | let def: CallableDefId = from_chalk(self.db, *fn_def); | 949 | let def: CallableDefId = from_chalk(self.db, *fn_def); |
950 | let generic_predicates = self.db.generic_predicates(def.into()); | 950 | let generic_predicates = self.db.generic_predicates(def.into()); |
951 | for predicate in generic_predicates.iter() { | 951 | for predicate in generic_predicates.iter() { |
952 | let (predicate, binders) = | 952 | let (predicate, binders) = predicate |
953 | predicate.clone().substitute(parameters).into_value_and_skipped_binders(); | 953 | .clone() |
954 | .substitute(&Interner, parameters) | ||
955 | .into_value_and_skipped_binders(); | ||
954 | always!(binders.len(&Interner) == 0); // quantified where clauses not yet handled | 956 | always!(binders.len(&Interner) == 0); // quantified where clauses not yet handled |
955 | self.push_obligation(predicate.cast(&Interner)); | 957 | self.push_obligation(predicate.cast(&Interner)); |
956 | } | 958 | } |