Convert TypeVisitor
and DefIdVisitor
to use VisitorResult
This commit is contained in:
parent
ae710de635
commit
0901b9fecf
@ -22,9 +22,9 @@ fn get_enum_ty(enum_ty: Ty<'_>) -> Option<Ty<'_>> {
|
||||
}
|
||||
|
||||
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ContainsTyVisitor {
|
||||
type BreakTy = Ty<'tcx>;
|
||||
type Result = ControlFlow<Ty<'tcx>>;
|
||||
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> Self::Result {
|
||||
self.level += 1;
|
||||
if self.level == 1 {
|
||||
t.super_visit_with(self)
|
||||
|
@ -141,9 +141,9 @@ impl<'a, 'b, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'b,
|
||||
struct ContainsRegion;
|
||||
|
||||
impl TypeVisitor<TyCtxt<'_>> for ContainsRegion {
|
||||
type BreakTy = ();
|
||||
type Result = ControlFlow<()>;
|
||||
|
||||
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {
|
||||
fn visit_region(&mut self, _: ty::Region<'_>) -> Self::Result {
|
||||
ControlFlow::Break(())
|
||||
}
|
||||
}
|
||||
|
@ -916,8 +916,8 @@ pub fn for_each_top_level_late_bound_region<B>(
|
||||
f: F,
|
||||
}
|
||||
impl<'tcx, B, F: FnMut(BoundRegion) -> ControlFlow<B>> TypeVisitor<TyCtxt<'tcx>> for V<F> {
|
||||
type BreakTy = B;
|
||||
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
type Result = ControlFlow<B>;
|
||||
fn visit_region(&mut self, r: Region<'tcx>) -> Self::Result {
|
||||
if let RegionKind::ReBound(idx, bound) = r.kind()
|
||||
&& idx.as_u32() == self.index
|
||||
{
|
||||
@ -926,7 +926,7 @@ pub fn for_each_top_level_late_bound_region<B>(
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) -> ControlFlow<Self::BreakTy> {
|
||||
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) -> Self::Result {
|
||||
self.index += 1;
|
||||
let res = t.super_visit_with(self);
|
||||
self.index -= 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user