aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/walk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/walk.rs')
-rw-r--r--crates/hir_ty/src/walk.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir_ty/src/walk.rs b/crates/hir_ty/src/walk.rs
index 963eb12c8..e1e77ba37 100644
--- a/crates/hir_ty/src/walk.rs
+++ b/crates/hir_ty/src/walk.rs
@@ -92,6 +92,13 @@ pub trait TypeWalk {
92 self 92 self
93 } 93 }
94 94
95 fn shifted_in(self, _interner: &Interner) -> Self
96 where
97 Self: Sized,
98 {
99 self.shifted_in_from(DebruijnIndex::ONE)
100 }
101
95 /// Shifts up debruijn indices of `TyKind::Bound` vars by `n`. 102 /// Shifts up debruijn indices of `TyKind::Bound` vars by `n`.
96 fn shifted_in_from(self, n: DebruijnIndex) -> Self 103 fn shifted_in_from(self, n: DebruijnIndex) -> Self
97 where 104 where
@@ -149,6 +156,9 @@ impl TypeWalk for Ty {
149 TyKind::Slice(ty) | TyKind::Array(ty) | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) => { 156 TyKind::Slice(ty) | TyKind::Array(ty) | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) => {
150 ty.walk(f); 157 ty.walk(f);
151 } 158 }
159 TyKind::Function(fn_pointer) => {
160 fn_pointer.substitution.0.walk(f);
161 }
152 _ => { 162 _ => {
153 if let Some(substs) = self.substs() { 163 if let Some(substs) = self.substs() {
154 for t in substs.iter(&Interner) { 164 for t in substs.iter(&Interner) {
@@ -180,6 +190,9 @@ impl TypeWalk for Ty {
180 TyKind::Slice(ty) | TyKind::Array(ty) | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) => { 190 TyKind::Slice(ty) | TyKind::Array(ty) | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) => {
181 ty.walk_mut_binders(f, binders); 191 ty.walk_mut_binders(f, binders);
182 } 192 }
193 TyKind::Function(fn_pointer) => {
194 fn_pointer.substitution.0.walk_mut_binders(f, binders.shifted_in());
195 }
183 _ => { 196 _ => {
184 if let Some(substs) = self.substs_mut() { 197 if let Some(substs) = self.substs_mut() {
185 substs.walk_mut_binders(f, binders); 198 substs.walk_mut_binders(f, binders);