aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir/src/display.rs2
-rw-r--r--crates/hir/src/lib.rs6
-rw-r--r--crates/hir/src/source_analyzer.rs2
-rw-r--r--crates/hir_ty/src/builder.rs4
-rw-r--r--crates/hir_ty/src/display.rs12
-rw-r--r--crates/hir_ty/src/infer.rs8
-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
-rw-r--r--crates/hir_ty/src/lib.rs8
-rw-r--r--crates/hir_ty/src/lower.rs8
-rw-r--r--crates/hir_ty/src/method_resolution.rs4
-rw-r--r--crates/hir_ty/src/traits/chalk/mapping.rs2
-rw-r--r--crates/hir_ty/src/utils.rs2
14 files changed, 39 insertions, 39 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs
index 993772aac..d4e477a85 100644
--- a/crates/hir/src/display.rs
+++ b/crates/hir/src/display.rs
@@ -235,7 +235,7 @@ impl HirDisplay for TypeParam {
235 write!(f, "{}", self.name(f.db))?; 235 write!(f, "{}", self.name(f.db))?;
236 let bounds = f.db.generic_predicates_for_param(self.id); 236 let bounds = f.db.generic_predicates_for_param(self.id);
237 let substs = TyBuilder::type_params_subst(f.db, self.id.parent); 237 let substs = TyBuilder::type_params_subst(f.db, self.id.parent);
238 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); 238 let predicates = bounds.iter().cloned().map(|b| b.substitute(&substs)).collect::<Vec<_>>();
239 if !(predicates.is_empty() || f.omit_verbose_types()) { 239 if !(predicates.is_empty() || f.omit_verbose_types()) {
240 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; 240 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?;
241 } 241 }
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index ccfe348a4..add1b55c2 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -516,7 +516,7 @@ impl Field {
516 VariantDef::Variant(it) => it.parent.id.into(), 516 VariantDef::Variant(it) => it.parent.id.into(),
517 }; 517 };
518 let substs = TyBuilder::type_params_subst(db, generic_def_id); 518 let substs = TyBuilder::type_params_subst(db, generic_def_id);
519 let ty = db.field_types(var_id)[self.id].clone().subst(&substs); 519 let ty = db.field_types(var_id)[self.id].clone().substitute(&substs);
520 Type::new(db, self.parent.module(db).id.krate(), var_id, ty) 520 Type::new(db, self.parent.module(db).id.krate(), var_id, ty)
521 } 521 }
522 522
@@ -1503,7 +1503,7 @@ impl TypeParam {
1503 let krate = self.id.parent.module(db.upcast()).krate(); 1503 let krate = self.id.parent.module(db.upcast()).krate();
1504 let ty = params.get(local_idx)?.clone(); 1504 let ty = params.get(local_idx)?.clone();
1505 let subst = TyBuilder::type_params_subst(db, self.id.parent); 1505 let subst = TyBuilder::type_params_subst(db, self.id.parent);
1506 let ty = ty.subst(&subst.prefix(local_idx)); 1506 let ty = ty.substitute(&subst.prefix(local_idx));
1507 Some(Type::new_with_resolver_inner(db, krate, &resolver, ty)) 1507 Some(Type::new_with_resolver_inner(db, krate, &resolver, ty))
1508 } 1508 }
1509} 1509}
@@ -1916,7 +1916,7 @@ impl Type {
1916 .iter() 1916 .iter()
1917 .map(|(local_id, ty)| { 1917 .map(|(local_id, ty)| {
1918 let def = Field { parent: variant_id.into(), id: local_id }; 1918 let def = Field { parent: variant_id.into(), id: local_id };
1919 let ty = ty.clone().subst(substs); 1919 let ty = ty.clone().substitute(substs);
1920 (def, self.derived(ty)) 1920 (def, self.derived(ty))
1921 }) 1921 })
1922 .collect() 1922 .collect()
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 8e9ea0a03..82807ea09 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -339,7 +339,7 @@ impl SourceAnalyzer {
339 .into_iter() 339 .into_iter()
340 .map(|local_id| { 340 .map(|local_id| {
341 let field = FieldId { parent: variant, local_id }; 341 let field = FieldId { parent: variant, local_id };
342 let ty = field_types[local_id].clone().subst(substs); 342 let ty = field_types[local_id].clone().substitute(substs);
343 (field.into(), Type::new_with_resolver_inner(db, krate, &self.resolver, ty)) 343 (field.into(), Type::new_with_resolver_inner(db, krate, &self.resolver, ty))
344 }) 344 })
345 .collect() 345 .collect()
diff --git a/crates/hir_ty/src/builder.rs b/crates/hir_ty/src/builder.rs
index 7b8603fd7..c5196200c 100644
--- a/crates/hir_ty/src/builder.rs
+++ b/crates/hir_ty/src/builder.rs
@@ -139,7 +139,7 @@ impl TyBuilder<hir_def::AdtId> {
139 } else { 139 } else {
140 // each default can depend on the previous parameters 140 // each default can depend on the previous parameters
141 let subst_so_far = Substitution::intern(self.vec.clone()); 141 let subst_so_far = Substitution::intern(self.vec.clone());
142 self.vec.push(default_ty.clone().subst(&subst_so_far).cast(&Interner)); 142 self.vec.push(default_ty.clone().substitute(&subst_so_far).cast(&Interner));
143 } 143 }
144 } 144 }
145 self 145 self
@@ -200,7 +200,7 @@ impl<T: TypeWalk + HasInterner<Interner = Interner>> TyBuilder<Binders<T>> {
200 200
201 pub fn build(self) -> T { 201 pub fn build(self) -> T {
202 let (b, subst) = self.build_internal(); 202 let (b, subst) = self.build_internal();
203 b.subst(&subst) 203 b.substitute(&subst)
204 } 204 }
205} 205}
206 206
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 2e178e5a8..704504b02 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -352,7 +352,7 @@ impl HirDisplay for Ty {
352 let data = (*datas) 352 let data = (*datas)
353 .as_ref() 353 .as_ref()
354 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 354 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
355 let bounds = data.subst(parameters); 355 let bounds = data.substitute(parameters);
356 bounds.into_value_and_skipped_binders().0 356 bounds.into_value_and_skipped_binders().0
357 } else { 357 } else {
358 Vec::new() 358 Vec::new()
@@ -397,7 +397,7 @@ impl HirDisplay for Ty {
397 } 397 }
398 TyKind::FnDef(def, parameters) => { 398 TyKind::FnDef(def, parameters) => {
399 let def = from_chalk(f.db, *def); 399 let def = from_chalk(f.db, *def);
400 let sig = f.db.callable_item_signature(def).subst(parameters); 400 let sig = f.db.callable_item_signature(def).substitute(parameters);
401 match def { 401 match def {
402 CallableDefId::FunctionId(ff) => { 402 CallableDefId::FunctionId(ff) => {
403 write!(f, "fn {}", f.db.function_data(ff).name)? 403 write!(f, "fn {}", f.db.function_data(ff).name)?
@@ -482,7 +482,7 @@ impl HirDisplay for Ty {
482 (_, Some(default_parameter)) => { 482 (_, Some(default_parameter)) => {
483 let actual_default = default_parameter 483 let actual_default = default_parameter
484 .clone() 484 .clone()
485 .subst(&parameters.prefix(i)); 485 .substitute(&parameters.prefix(i));
486 if parameter.assert_ty_ref(&Interner) != &actual_default 486 if parameter.assert_ty_ref(&Interner) != &actual_default
487 { 487 {
488 default_from = i + 1; 488 default_from = i + 1;
@@ -542,7 +542,7 @@ impl HirDisplay for Ty {
542 let data = (*datas) 542 let data = (*datas)
543 .as_ref() 543 .as_ref()
544 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 544 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
545 let bounds = data.subst(&parameters); 545 let bounds = data.substitute(&parameters);
546 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; 546 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?;
547 // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution 547 // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution
548 } 548 }
@@ -595,7 +595,7 @@ impl HirDisplay for Ty {
595 let bounds = 595 let bounds =
596 f.db.generic_predicates(id.parent) 596 f.db.generic_predicates(id.parent)
597 .into_iter() 597 .into_iter()
598 .map(|pred| pred.clone().subst(&substs)) 598 .map(|pred| pred.clone().substitute(&substs))
599 .filter(|wc| match &wc.skip_binders() { 599 .filter(|wc| match &wc.skip_binders() {
600 WhereClause::Implemented(tr) => { 600 WhereClause::Implemented(tr) => {
601 tr.self_type_parameter(&Interner) == self 601 tr.self_type_parameter(&Interner) == self
@@ -629,7 +629,7 @@ impl HirDisplay for Ty {
629 let data = (*datas) 629 let data = (*datas)
630 .as_ref() 630 .as_ref()
631 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 631 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
632 let bounds = data.subst(&opaque_ty.substitution); 632 let bounds = data.substitute(&opaque_ty.substitution);
633 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; 633 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?;
634 } 634 }
635 ImplTraitId::AsyncBlockTypeImplTrait(..) => { 635 ImplTraitId::AsyncBlockTypeImplTrait(..) => {
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index 6151e48cd..a87037344 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -470,25 +470,25 @@ impl<'a> InferenceContext<'a> {
470 TypeNs::AdtId(AdtId::StructId(strukt)) => { 470 TypeNs::AdtId(AdtId::StructId(strukt)) => {
471 let substs = ctx.substs_from_path(path, strukt.into(), true); 471 let substs = ctx.substs_from_path(path, strukt.into(), true);
472 let ty = self.db.ty(strukt.into()); 472 let ty = self.db.ty(strukt.into());
473 let ty = self.insert_type_vars(ty.subst(&substs)); 473 let ty = self.insert_type_vars(ty.substitute(&substs));
474 forbid_unresolved_segments((ty, Some(strukt.into())), unresolved) 474 forbid_unresolved_segments((ty, Some(strukt.into())), unresolved)
475 } 475 }
476 TypeNs::AdtId(AdtId::UnionId(u)) => { 476 TypeNs::AdtId(AdtId::UnionId(u)) => {
477 let substs = ctx.substs_from_path(path, u.into(), true); 477 let substs = ctx.substs_from_path(path, u.into(), true);
478 let ty = self.db.ty(u.into()); 478 let ty = self.db.ty(u.into());
479 let ty = self.insert_type_vars(ty.subst(&substs)); 479 let ty = self.insert_type_vars(ty.substitute(&substs));
480 forbid_unresolved_segments((ty, Some(u.into())), unresolved) 480 forbid_unresolved_segments((ty, Some(u.into())), unresolved)
481 } 481 }
482 TypeNs::EnumVariantId(var) => { 482 TypeNs::EnumVariantId(var) => {
483 let substs = ctx.substs_from_path(path, var.into(), true); 483 let substs = ctx.substs_from_path(path, var.into(), true);
484 let ty = self.db.ty(var.parent.into()); 484 let ty = self.db.ty(var.parent.into());
485 let ty = self.insert_type_vars(ty.subst(&substs)); 485 let ty = self.insert_type_vars(ty.substitute(&substs));
486 forbid_unresolved_segments((ty, Some(var.into())), unresolved) 486 forbid_unresolved_segments((ty, Some(var.into())), unresolved)
487 } 487 }
488 TypeNs::SelfType(impl_id) => { 488 TypeNs::SelfType(impl_id) => {
489 let generics = crate::utils::generics(self.db.upcast(), impl_id.into()); 489 let generics = crate::utils::generics(self.db.upcast(), impl_id.into());
490 let substs = generics.type_params_subst(self.db); 490 let substs = generics.type_params_subst(self.db);
491 let ty = self.db.impl_self_ty(impl_id).subst(&substs); 491 let ty = self.db.impl_self_ty(impl_id).substitute(&substs);
492 match unresolved { 492 match unresolved {
493 None => { 493 None => {
494 let variant = ty_variant(&ty); 494 let variant = ty_variant(&ty);
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 }
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 86973c7ed..e15840c9a 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -130,7 +130,7 @@ impl<T> Binders<T> {
130 130
131impl<T: TypeWalk> Binders<T> { 131impl<T: TypeWalk> Binders<T> {
132 /// Substitutes all variables. 132 /// Substitutes all variables.
133 pub fn subst(self, subst: &Substitution) -> T { 133 pub fn substitute(self, subst: &Substitution) -> T {
134 let (value, binders) = self.into_value_and_skipped_binders(); 134 let (value, binders) = self.into_value_and_skipped_binders();
135 assert_eq!(subst.len(&Interner), binders.len(&Interner)); 135 assert_eq!(subst.len(&Interner), binders.len(&Interner));
136 value.subst_bound_vars(subst) 136 value.subst_bound_vars(subst)
@@ -362,7 +362,7 @@ impl Ty {
362 TyKind::FnDef(def, parameters) => { 362 TyKind::FnDef(def, parameters) => {
363 let callable_def = db.lookup_intern_callable_def((*def).into()); 363 let callable_def = db.lookup_intern_callable_def((*def).into());
364 let sig = db.callable_item_signature(callable_def); 364 let sig = db.callable_item_signature(callable_def);
365 Some(sig.subst(&parameters)) 365 Some(sig.substitute(&parameters))
366 } 366 }
367 TyKind::Closure(.., substs) => { 367 TyKind::Closure(.., substs) => {
368 let sig_param = substs.at(&Interner, 0).assert_ty_ref(&Interner); 368 let sig_param = substs.at(&Interner, 0).assert_ty_ref(&Interner);
@@ -436,7 +436,7 @@ impl Ty {
436 let data = (*it) 436 let data = (*it)
437 .as_ref() 437 .as_ref()
438 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 438 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
439 data.subst(&opaque_ty.substitution) 439 data.substitute(&opaque_ty.substitution)
440 }) 440 })
441 } 441 }
442 // It always has an parameter for Future::Output type. 442 // It always has an parameter for Future::Output type.
@@ -455,7 +455,7 @@ impl Ty {
455 let predicates = db 455 let predicates = db
456 .generic_predicates(id.parent) 456 .generic_predicates(id.parent)
457 .into_iter() 457 .into_iter()
458 .map(|pred| pred.clone().subst(&substs)) 458 .map(|pred| pred.clone().substitute(&substs))
459 .filter(|wc| match &wc.skip_binders() { 459 .filter(|wc| match &wc.skip_binders() {
460 WhereClause::Implemented(tr) => { 460 WhereClause::Implemented(tr) => {
461 tr.self_type_parameter(&Interner) == self 461 tr.self_type_parameter(&Interner) == self
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 59d2a157f..6a3a880e0 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -414,7 +414,7 @@ impl<'a> TyLoweringContext<'a> {
414 TypeParamLoweringMode::Placeholder => generics.type_params_subst(self.db), 414 TypeParamLoweringMode::Placeholder => generics.type_params_subst(self.db),
415 TypeParamLoweringMode::Variable => generics.bound_vars_subst(self.in_binders), 415 TypeParamLoweringMode::Variable => generics.bound_vars_subst(self.in_binders),
416 }; 416 };
417 self.db.impl_self_ty(impl_id).subst(&substs) 417 self.db.impl_self_ty(impl_id).substitute(&substs)
418 } 418 }
419 TypeNs::AdtSelfType(adt) => { 419 TypeNs::AdtSelfType(adt) => {
420 let generics = generics(self.db.upcast(), adt.into()); 420 let generics = generics(self.db.upcast(), adt.into());
@@ -422,7 +422,7 @@ impl<'a> TyLoweringContext<'a> {
422 TypeParamLoweringMode::Placeholder => generics.type_params_subst(self.db), 422 TypeParamLoweringMode::Placeholder => generics.type_params_subst(self.db),
423 TypeParamLoweringMode::Variable => generics.bound_vars_subst(self.in_binders), 423 TypeParamLoweringMode::Variable => generics.bound_vars_subst(self.in_binders),
424 }; 424 };
425 self.db.ty(adt.into()).subst(&substs) 425 self.db.ty(adt.into()).substitute(&substs)
426 } 426 }
427 427
428 TypeNs::AdtId(it) => self.lower_path_inner(resolved_segment, it.into(), infer_args), 428 TypeNs::AdtId(it) => self.lower_path_inner(resolved_segment, it.into(), infer_args),
@@ -516,7 +516,7 @@ impl<'a> TyLoweringContext<'a> {
516 TyDefId::TypeAliasId(it) => Some(it.into()), 516 TyDefId::TypeAliasId(it) => Some(it.into()),
517 }; 517 };
518 let substs = self.substs_from_path_segment(segment, generic_def, infer_args, None); 518 let substs = self.substs_from_path_segment(segment, generic_def, infer_args, None);
519 self.db.ty(typeable).subst(&substs) 519 self.db.ty(typeable).substitute(&substs)
520 } 520 }
521 521
522 /// Collect generic arguments from a path into a `Substs`. See also 522 /// Collect generic arguments from a path into a `Substs`. See also
@@ -620,7 +620,7 @@ impl<'a> TyLoweringContext<'a> {
620 for default_ty in defaults.iter().skip(substs.len()) { 620 for default_ty in defaults.iter().skip(substs.len()) {
621 // each default can depend on the previous parameters 621 // each default can depend on the previous parameters
622 let substs_so_far = Substitution::from_iter(&Interner, substs.clone()); 622 let substs_so_far = Substitution::from_iter(&Interner, substs.clone());
623 substs.push(default_ty.clone().subst(&substs_so_far)); 623 substs.push(default_ty.clone().substitute(&substs_so_far));
624 } 624 }
625 } 625 }
626 } 626 }
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index ad5022808..88750acf3 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -712,7 +712,7 @@ pub(crate) fn inherent_impl_substs(
712 let vars = TyBuilder::subst_for_def(db, impl_id) 712 let vars = TyBuilder::subst_for_def(db, impl_id)
713 .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner)) 713 .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner))
714 .build(); 714 .build();
715 let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars); 715 let self_ty_with_vars = db.impl_self_ty(impl_id).substitute(&vars);
716 let mut kinds = self_ty.binders.interned().to_vec(); 716 let mut kinds = self_ty.binders.interned().to_vec();
717 kinds.extend( 717 kinds.extend(
718 iter::repeat(chalk_ir::WithKind::new( 718 iter::repeat(chalk_ir::WithKind::new(
@@ -774,7 +774,7 @@ fn transform_receiver_ty(
774 AssocContainerId::ModuleId(_) => unreachable!(), 774 AssocContainerId::ModuleId(_) => unreachable!(),
775 }; 775 };
776 let sig = db.callable_item_signature(function_id.into()); 776 let sig = db.callable_item_signature(function_id.into());
777 Some(sig.map(|s| s.params()[0].clone()).subst(&substs)) 777 Some(sig.map(|s| s.params()[0].clone()).substitute(&substs))
778} 778}
779 779
780pub fn implements_trait( 780pub fn implements_trait(
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
index 2c7407c7c..481b0bb10 100644
--- a/crates/hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/hir_ty/src/traits/chalk/mapping.rs
@@ -519,7 +519,7 @@ pub(super) fn convert_where_clauses(
519 let generic_predicates = db.generic_predicates(def); 519 let generic_predicates = db.generic_predicates(def);
520 let mut result = Vec::with_capacity(generic_predicates.len()); 520 let mut result = Vec::with_capacity(generic_predicates.len());
521 for pred in generic_predicates.iter() { 521 for pred in generic_predicates.iter() {
522 result.push(pred.clone().subst(substs).to_chalk(db)); 522 result.push(pred.clone().substitute(substs).to_chalk(db));
523 } 523 }
524 result 524 result
525} 525}
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs
index df0ea4368..a63075a19 100644
--- a/crates/hir_ty/src/utils.rs
+++ b/crates/hir_ty/src/utils.rs
@@ -72,7 +72,7 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec<Tr
72 _ => None, 72 _ => None,
73 }) 73 })
74 }) 74 })
75 .map(|pred| pred.subst(&trait_ref.substitution)) 75 .map(|pred| pred.substitute(&trait_ref.substitution))
76 .collect() 76 .collect()
77} 77}
78 78