Skip to content

Commit 36d09e3

Browse files
committed
Split TypeVisitableExt from TypeVisitable
1 parent ba55a45 commit 36d09e3

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

compiler/rustc_middle/src/ty/structural_impls.rs

-10
Original file line numberDiff line numberDiff line change
@@ -764,16 +764,6 @@ impl<'tcx> ir::TypeVisitable<'tcx> for ty::Predicate<'tcx> {
764764
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
765765
visitor.visit_predicate(*self)
766766
}
767-
768-
#[inline]
769-
fn has_vars_bound_at_or_above(&self, binder: ty::DebruijnIndex) -> bool {
770-
self.outer_exclusive_binder() > binder
771-
}
772-
773-
#[inline]
774-
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
775-
self.flags().intersects(flags)
776-
}
777767
}
778768

779769
impl<'tcx> TypeSuperFoldable<'tcx> for ty::Predicate<'tcx> {

compiler/rustc_middle/src/ty/visit.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use rustc_data_structures::fx::FxHashSet;
4444
use rustc_data_structures::sso::SsoHashSet;
4545
use std::ops::ControlFlow;
4646

47-
pub trait TypeVisitable<'tcx> = ir::TypeVisitable<'tcx>;
47+
pub trait TypeVisitable<'tcx> = ir::TypeVisitable<'tcx> + ir::TypeVisitableExt<'tcx>;
4848
pub trait TypeSuperVisitable<'tcx> = ir::TypeSuperVisitable<'tcx>;
4949
pub trait TypeVisitor<'tcx> = ir::TypeVisitor<'tcx>;
5050

@@ -74,7 +74,9 @@ pub mod ir {
7474
/// `V::visit_ty`). This is where control transfers from `TypeFoldable` to
7575
/// `TypeVisitor`.
7676
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy>;
77+
}
7778

79+
pub trait TypeVisitableExt<'tcx>: TypeVisitable<'tcx> {
7880
/// Returns `true` if `self` has any late-bound regions that are either
7981
/// bound by `binder` or bound by some binder outside of `binder`.
8082
/// If `binder` is `ty::INNERMOST`, this indicates whether
@@ -197,6 +199,8 @@ pub mod ir {
197199
}
198200
}
199201

202+
impl<'tcx, T: TypeVisitable<'tcx>> TypeVisitableExt<'tcx> for T {}
203+
200204
pub trait TypeSuperVisitable<'tcx>: TypeVisitable<'tcx> {
201205
/// Provides a default visit for a type of interest. This should only be
202206
/// called within `TypeVisitor` methods, when a non-custom traversal is

0 commit comments

Comments
 (0)