diff options
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index ccaae53e9..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().subst(&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 | .subst(¶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 | .subst(¶meters), | 479 | .substitute(&Interner, ¶meters), |
480 | ) | 480 | ) |
481 | } else { | 481 | } else { |
482 | None | 482 | None |
@@ -849,10 +849,10 @@ impl<'a> InferenceContext<'a> { | |||
849 | self.write_method_resolution(tgt_expr, func); | 849 | self.write_method_resolution(tgt_expr, func); |
850 | (ty, self.db.value_ty(func.into()), Some(generics(self.db.upcast(), func.into()))) | 850 | (ty, self.db.value_ty(func.into()), Some(generics(self.db.upcast(), func.into()))) |
851 | } | 851 | } |
852 | None => (receiver_ty, Binders::new(0, 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.subst(&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,9 +949,11 @@ 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().subst(parameters).into_value_and_skipped_binders(); | 953 | .clone() |
954 | always!(binders == 0); // quantified where clauses not yet handled | 954 | .substitute(&Interner, parameters) |
955 | .into_value_and_skipped_binders(); | ||
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 | } |
957 | // add obligation for trait implementation, if this is a trait method | 959 | // add obligation for trait implementation, if this is a trait method |