aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/walk.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-04 19:27:40 +0100
committerFlorian Diebold <[email protected]>2021-04-04 19:27:40 +0100
commit645a9c3a274109512839b79d8e86a805a39cd6e1 (patch)
tree30cce00086913ec4682db4d9704b6c609811de6b /crates/hir_ty/src/walk.rs
parent508a1ecad3cf9c9f01022b3e95f9d6a7ad7a4cd5 (diff)
Move things from `traits` module to `types` as well
Diffstat (limited to 'crates/hir_ty/src/walk.rs')
-rw-r--r--crates/hir_ty/src/walk.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/crates/hir_ty/src/walk.rs b/crates/hir_ty/src/walk.rs
index fec5c2f42..bfb3f1041 100644
--- a/crates/hir_ty/src/walk.rs
+++ b/crates/hir_ty/src/walk.rs
@@ -6,8 +6,8 @@ use std::mem;
6use chalk_ir::DebruijnIndex; 6use chalk_ir::DebruijnIndex;
7 7
8use crate::{ 8use crate::{
9 utils::make_mut_slice, AliasTy, Binders, CallableSig, GenericArg, GenericArgData, Interner, 9 utils::make_mut_slice, AliasEq, AliasTy, Binders, CallableSig, GenericArg, GenericArgData,
10 OpaqueTy, ProjectionTy, Substitution, TraitRef, Ty, TyKind, WhereClause, 10 Interner, OpaqueTy, ProjectionTy, Substitution, TraitRef, Ty, TyKind, WhereClause,
11}; 11};
12 12
13/// This allows walking structures that contain types to do something with those 13/// This allows walking structures that contain types to do something with those
@@ -357,3 +357,25 @@ impl TypeWalk for CallableSig {
357 } 357 }
358 } 358 }
359} 359}
360
361impl TypeWalk for AliasEq {
362 fn walk(&self, f: &mut impl FnMut(&Ty)) {
363 self.ty.walk(f);
364 match &self.alias {
365 AliasTy::Projection(projection_ty) => projection_ty.walk(f),
366 AliasTy::Opaque(opaque) => opaque.walk(f),
367 }
368 }
369
370 fn walk_mut_binders(
371 &mut self,
372 f: &mut impl FnMut(&mut Ty, DebruijnIndex),
373 binders: DebruijnIndex,
374 ) {
375 self.ty.walk_mut_binders(f, binders);
376 match &mut self.alias {
377 AliasTy::Projection(projection_ty) => projection_ty.walk_mut_binders(f, binders),
378 AliasTy::Opaque(opaque) => opaque.walk_mut_binders(f, binders),
379 }
380 }
381}