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> {
|
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
|
||||||
visitor.visit_predicate(*self)
|
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> {
|
impl<'tcx> TypeSuperFoldable<'tcx> for ty::Predicate<'tcx> {
|
||||||
|
@ -44,7 +44,7 @@ use rustc_data_structures::fx::FxHashSet;
|
|||||||
use rustc_data_structures::sso::SsoHashSet;
|
use rustc_data_structures::sso::SsoHashSet;
|
||||||
use std::ops::ControlFlow;
|
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 TypeSuperVisitable<'tcx> = ir::TypeSuperVisitable<'tcx>;
|
||||||
pub trait TypeVisitor<'tcx> = ir::TypeVisitor<'tcx>;
|
pub trait TypeVisitor<'tcx> = ir::TypeVisitor<'tcx>;
|
||||||
|
|
||||||
@ -74,7 +74,9 @@ pub mod ir {
|
|||||||
/// `V::visit_ty`). This is where control transfers from `TypeFoldable` to
|
/// `V::visit_ty`). This is where control transfers from `TypeFoldable` to
|
||||||
/// `TypeVisitor`.
|
/// `TypeVisitor`.
|
||||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy>;
|
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
|
/// Returns `true` if `self` has any late-bound regions that are either
|
||||||
/// bound by `binder` or bound by some binder outside of `binder`.
|
/// bound by `binder` or bound by some binder outside of `binder`.
|
||||||
/// If `binder` is `ty::INNERMOST`, this indicates whether
|
/// If `binder` is `ty::INNERMOST`, this indicates whether
|
||||||
@ -197,6 +199,8 @@ pub mod ir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'tcx, T: TypeVisitable<'tcx>> TypeVisitableExt<'tcx> for T {}
|
||||||
|
|
||||||
pub trait TypeSuperVisitable<'tcx>: TypeVisitable<'tcx> {
|
pub trait TypeSuperVisitable<'tcx>: TypeVisitable<'tcx> {
|
||||||
/// Provides a default visit for a type of interest. This should only be
|
/// Provides a default visit for a type of interest. This should only be
|
||||||
/// called within `TypeVisitor` methods, when a non-custom traversal is
|
/// called within `TypeVisitor` methods, when a non-custom traversal is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user