Split TypeVisitableExt from TypeVisitable
This commit is contained in:
parent
ba55a453eb
commit
36d09e3906
@ -764,16 +764,6 @@ impl<'tcx> ir::TypeVisitable<'tcx> for ty::Predicate<'tcx> {
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
|
||||
visitor.visit_predicate(*self)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_vars_bound_at_or_above(&self, binder: ty::DebruijnIndex) -> bool {
|
||||
self.outer_exclusive_binder() > binder
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
|
||||
self.flags().intersects(flags)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeSuperFoldable<'tcx> for ty::Predicate<'tcx> {
|
||||
|
@ -44,7 +44,7 @@
|
||||
use rustc_data_structures::sso::SsoHashSet;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
pub trait TypeVisitable<'tcx> = ir::TypeVisitable<'tcx>;
|
||||
pub trait TypeVisitable<'tcx> = ir::TypeVisitable<'tcx> + ir::TypeVisitableExt<'tcx>;
|
||||
pub trait TypeSuperVisitable<'tcx> = ir::TypeSuperVisitable<'tcx>;
|
||||
pub trait TypeVisitor<'tcx> = ir::TypeVisitor<'tcx>;
|
||||
|
||||
@ -74,7 +74,9 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
|
||||
/// `V::visit_ty`). This is where control transfers from `TypeFoldable` to
|
||||
/// `TypeVisitor`.
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy>;
|
||||
}
|
||||
|
||||
pub trait TypeVisitableExt<'tcx>: TypeVisitable<'tcx> {
|
||||
/// Returns `true` if `self` has any late-bound regions that are either
|
||||
/// bound by `binder` or bound by some binder outside of `binder`.
|
||||
/// If `binder` is `ty::INNERMOST`, this indicates whether
|
||||
@ -197,6 +199,8 @@ fn still_further_specializable(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeVisitable<'tcx>> TypeVisitableExt<'tcx> for T {}
|
||||
|
||||
pub trait TypeSuperVisitable<'tcx>: TypeVisitable<'tcx> {
|
||||
/// Provides a default visit for a type of interest. This should only be
|
||||
/// called within `TypeVisitor` methods, when a non-custom traversal is
|
||||
|
Loading…
Reference in New Issue
Block a user