From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs (limited to 'vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs') diff --git a/vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs b/vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs new file mode 100644 index 000000000..709f99044 --- /dev/null +++ b/vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs @@ -0,0 +1,47 @@ +//! This module contains impls of `TypeVisitable` for those types that +//! introduce binders. +//! +//! The more interesting impls of `TypeVisitable` remain in the `visit` module. + +use crate::interner::HasInterner; +use crate::{ + Binders, Canonical, ControlFlow, DebruijnIndex, FnPointer, Interner, TypeVisitable, TypeVisitor, +}; + +impl TypeVisitable for FnPointer { + fn visit_with( + &self, + visitor: &mut dyn TypeVisitor, + outer_binder: DebruijnIndex, + ) -> ControlFlow { + self.substitution + .visit_with(visitor, outer_binder.shifted_in()) + } +} + +impl TypeVisitable for Binders +where + T: HasInterner + TypeVisitable, +{ + fn visit_with( + &self, + visitor: &mut dyn TypeVisitor, + outer_binder: DebruijnIndex, + ) -> ControlFlow { + self.value.visit_with(visitor, outer_binder.shifted_in()) + } +} + +impl TypeVisitable for Canonical +where + I: Interner, + T: HasInterner + TypeVisitable, +{ + fn visit_with( + &self, + visitor: &mut dyn TypeVisitor, + outer_binder: DebruijnIndex, + ) -> ControlFlow { + self.value.visit_with(visitor, outer_binder.shifted_in()) + } +} -- cgit v1.2.3