diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:32 +0000 |
commit | 4547b622d8d29df964fa2914213088b148c498fc (patch) | |
tree | 9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/chalk-ir-0.80.0/src/visit/visitors.rs | |
parent | Releasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz rustc-4547b622d8d29df964fa2914213088b148c498fc.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/chalk-ir-0.80.0/src/visit/visitors.rs')
-rw-r--r-- | vendor/chalk-ir-0.80.0/src/visit/visitors.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/vendor/chalk-ir-0.80.0/src/visit/visitors.rs b/vendor/chalk-ir-0.80.0/src/visit/visitors.rs deleted file mode 100644 index 486b51d86..000000000 --- a/vendor/chalk-ir-0.80.0/src/visit/visitors.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Visitor helpers - -use crate::{BoundVar, ControlFlow, DebruijnIndex, Interner, Visit, Visitor}; - -/// Visitor extensions. -pub trait VisitExt<I: Interner>: Visit<I> { - /// Check whether there are free (non-bound) variables. - fn has_free_vars(&self, interner: I) -> bool { - let flow = self.visit_with( - &mut FindFreeVarsVisitor { interner }, - DebruijnIndex::INNERMOST, - ); - matches!(flow, ControlFlow::Break(_)) - } -} - -impl<T, I: Interner> VisitExt<I> for T where T: Visit<I> {} - -struct FindFreeVarsVisitor<I: Interner> { - interner: I, -} - -impl<I: Interner> Visitor<I> for FindFreeVarsVisitor<I> { - type BreakTy = (); - - fn as_dyn(&mut self) -> &mut dyn Visitor<I, BreakTy = Self::BreakTy> { - self - } - - fn interner(&self) -> I { - self.interner - } - - fn visit_free_var( - &mut self, - _bound_var: BoundVar, - _outer_binder: DebruijnIndex, - ) -> ControlFlow<()> { - ControlFlow::Break(()) - } -} |