diff options
author | Florian Diebold <[email protected]> | 2021-04-05 17:49:26 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-05 18:21:01 +0100 |
commit | 30a339e038bfd94d8c91f79287be9b7db4f0cb4e (patch) | |
tree | 7e026ded541b94f2908d61a8037ed62f2df91625 /crates/hir_ty/src/lib.rs | |
parent | 05eba0db3dd76f016aabdd49af6211e70a1812ed (diff) |
Add Interner parameter to Binders::substitute
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index e15840c9a..827317fce 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -130,9 +130,9 @@ impl<T> Binders<T> { | |||
130 | 130 | ||
131 | impl<T: TypeWalk> Binders<T> { | 131 | impl<T: TypeWalk> Binders<T> { |
132 | /// Substitutes all variables. | 132 | /// Substitutes all variables. |
133 | pub fn substitute(self, subst: &Substitution) -> T { | 133 | pub fn substitute(self, interner: &Interner, 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) |
137 | } | 137 | } |
138 | } | 138 | } |
@@ -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.substitute(¶meters)) | 365 | Some(sig.substitute(&Interner, ¶meters)) |
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.substitute(&opaque_ty.substitution) | 439 | data.substitute(&Interner, &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().substitute(&substs)) | 458 | .map(|pred| pred.clone().substitute(&Interner, &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 |