summaryrefslogtreecommitdiffstats
path: root/vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs')
-rw-r--r--vendor/chalk-ir-0.87.0/src/visit/binder_impls.rs47
1 files changed, 47 insertions, 0 deletions
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<I: Interner> TypeVisitable<I> for FnPointer<I> {
+ fn visit_with<B>(
+ &self,
+ visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
+ outer_binder: DebruijnIndex,
+ ) -> ControlFlow<B> {
+ self.substitution
+ .visit_with(visitor, outer_binder.shifted_in())
+ }
+}
+
+impl<T, I: Interner> TypeVisitable<I> for Binders<T>
+where
+ T: HasInterner + TypeVisitable<I>,
+{
+ fn visit_with<B>(
+ &self,
+ visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
+ outer_binder: DebruijnIndex,
+ ) -> ControlFlow<B> {
+ self.value.visit_with(visitor, outer_binder.shifted_in())
+ }
+}
+
+impl<I, T> TypeVisitable<I> for Canonical<T>
+where
+ I: Interner,
+ T: HasInterner<Interner = I> + TypeVisitable<I>,
+{
+ fn visit_with<B>(
+ &self,
+ visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
+ outer_binder: DebruijnIndex,
+ ) -> ControlFlow<B> {
+ self.value.visit_with(visitor, outer_binder.shifted_in())
+ }
+}