aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-05 17:39:53 +0100
committerFlorian Diebold <[email protected]>2021-04-05 18:20:28 +0100
commit05eba0db3dd76f016aabdd49af6211e70a1812ed (patch)
tree4e4cdc0d7acddd8feb04c064360e0a8e889e4957 /crates/hir_ty/src/infer
parentad20f00844cec9c794e34869be163673ebbed182 (diff)
Binders::subst -> substitute
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r--crates/hir_ty/src/infer/expr.rs10
-rw-r--r--crates/hir_ty/src/infer/pat.rs4
-rw-r--r--crates/hir_ty/src/infer/path.rs6
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index d61ef65f2..5f8ad2174 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(&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(&parameters), 465 .substitute(&parameters),
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(&parameters), 479 .substitute(&parameters),
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.subst(&substs); 855 let method_ty = method_ty.substitute(&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) {
@@ -950,7 +950,7 @@ impl<'a> InferenceContext<'a> {
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) =
953 predicate.clone().subst(parameters).into_value_and_skipped_binders(); 953 predicate.clone().substitute(parameters).into_value_and_skipped_binders();
954 always!(binders.len(&Interner) == 0); // quantified where clauses not yet handled 954 always!(binders.len(&Interner) == 0); // quantified where clauses not yet handled
955 self.push_obligation(predicate.cast(&Interner)); 955 self.push_obligation(predicate.cast(&Interner));
956 } 956 }
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
index 469f37dd9..b74f1f4f8 100644
--- a/crates/hir_ty/src/infer/pat.rs
+++ b/crates/hir_ty/src/infer/pat.rs
@@ -49,7 +49,7 @@ impl<'a> InferenceContext<'a> {
49 let expected_ty = var_data 49 let expected_ty = var_data
50 .as_ref() 50 .as_ref()
51 .and_then(|d| d.field(&Name::new_tuple_field(i))) 51 .and_then(|d| d.field(&Name::new_tuple_field(i)))
52 .map_or(self.err_ty(), |field| field_tys[field].clone().subst(&substs)); 52 .map_or(self.err_ty(), |field| field_tys[field].clone().substitute(&substs));
53 let expected_ty = self.normalize_associated_types_in(expected_ty); 53 let expected_ty = self.normalize_associated_types_in(expected_ty);
54 self.infer_pat(subpat, &expected_ty, default_bm); 54 self.infer_pat(subpat, &expected_ty, default_bm);
55 } 55 }
@@ -84,7 +84,7 @@ impl<'a> InferenceContext<'a> {
84 } 84 }
85 85
86 let expected_ty = matching_field 86 let expected_ty = matching_field
87 .map_or(self.err_ty(), |field| field_tys[field].clone().subst(&substs)); 87 .map_or(self.err_ty(), |field| field_tys[field].clone().substitute(&substs));
88 let expected_ty = self.normalize_associated_types_in(expected_ty); 88 let expected_ty = self.normalize_associated_types_in(expected_ty);
89 self.infer_pat(subpat.pat, &expected_ty, default_bm); 89 self.infer_pat(subpat.pat, &expected_ty, default_bm);
90 } 90 }
diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs
index 89d78e781..5e3a45766 100644
--- a/crates/hir_ty/src/infer/path.rs
+++ b/crates/hir_ty/src/infer/path.rs
@@ -81,9 +81,9 @@ impl<'a> InferenceContext<'a> {
81 ValueNs::ImplSelf(impl_id) => { 81 ValueNs::ImplSelf(impl_id) => {
82 let generics = crate::utils::generics(self.db.upcast(), impl_id.into()); 82 let generics = crate::utils::generics(self.db.upcast(), impl_id.into());
83 let substs = generics.type_params_subst(self.db); 83 let substs = generics.type_params_subst(self.db);
84 let ty = self.db.impl_self_ty(impl_id).subst(&substs); 84 let ty = self.db.impl_self_ty(impl_id).substitute(&substs);
85 if let Some((AdtId::StructId(struct_id), substs)) = ty.as_adt() { 85 if let Some((AdtId::StructId(struct_id), substs)) = ty.as_adt() {
86 let ty = self.db.value_ty(struct_id.into()).subst(&substs); 86 let ty = self.db.value_ty(struct_id.into()).substitute(&substs);
87 return Some(ty); 87 return Some(ty);
88 } else { 88 } else {
89 // FIXME: diagnostic, invalid Self reference 89 // FIXME: diagnostic, invalid Self reference
@@ -243,7 +243,7 @@ impl<'a> InferenceContext<'a> {
243 let impl_substs = TyBuilder::subst_for_def(self.db, impl_id) 243 let impl_substs = TyBuilder::subst_for_def(self.db, impl_id)
244 .fill(iter::repeat_with(|| self.table.new_type_var())) 244 .fill(iter::repeat_with(|| self.table.new_type_var()))
245 .build(); 245 .build();
246 let impl_self_ty = self.db.impl_self_ty(impl_id).subst(&impl_substs); 246 let impl_self_ty = self.db.impl_self_ty(impl_id).substitute(&impl_substs);
247 self.unify(&impl_self_ty, &ty); 247 self.unify(&impl_self_ty, &ty);
248 Some(impl_substs) 248 Some(impl_substs)
249 } 249 }