1
Fork 0

Stop using BREAK & CONTINUE in compiler

Switching them to `Break(())` and `Continue(())` instead.

libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
This commit is contained in:
Scott McMurray 2023-01-17 23:17:13 -08:00
parent e08b379d5d
commit 925dc37313
31 changed files with 110 additions and 106 deletions

View file

@ -543,7 +543,7 @@ impl<'tcx> TypeVisitor<'tcx> for TraitObjectVisitor {
if let Some(def_id) = preds.principal_def_id() {
self.0.insert(def_id);
}
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
_ => t.super_visit_with(self),
}

View file

@ -849,7 +849,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
t.super_visit_with(self);
self.target_index.shift_out(1);
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
@ -863,7 +863,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
_ => {}
}
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
}

View file

@ -440,16 +440,16 @@ where
t: &ty::Binder<'tcx, T>,
) -> ControlFlow<Self::BreakTy> {
t.super_visit_with(self);
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
match *r {
// ignore bound regions, keep visiting
ty::ReLateBound(_, _) => ControlFlow::CONTINUE,
ty::ReLateBound(_, _) => ControlFlow::Continue(()),
_ => {
(self.op)(r);
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
}
}
@ -457,7 +457,7 @@ where
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
// We're only interested in types involving regions
if !ty.flags().intersects(ty::TypeFlags::HAS_FREE_REGIONS) {
return ControlFlow::CONTINUE;
return ControlFlow::Continue(());
}
match ty.kind() {
@ -507,7 +507,7 @@ where
}
}
ControlFlow::CONTINUE
ControlFlow::Continue(())
}
}

View file

@ -147,7 +147,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
} else if !t.has_non_region_infer() {
// All const/type variables in inference types must already be resolved,
// no need to visit the contents.
ControlFlow::CONTINUE
ControlFlow::Continue(())
} else {
// Otherwise, keep visiting.
t.super_visit_with(self)
@ -178,7 +178,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
} else if !ct.has_non_region_infer() {
// All const/type variables in inference types must already be resolved,
// no need to visit the contents.
ControlFlow::CONTINUE
ControlFlow::Continue(())
} else {
// Otherwise, keep visiting.
ct.super_visit_with(self)