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:
parent
e08b379d5d
commit
925dc37313
31 changed files with 110 additions and 106 deletions
|
@ -93,7 +93,7 @@ macro_rules! TrivialTypeTraversalImpls {
|
|||
_: &mut F)
|
||||
-> ::std::ops::ControlFlow<F::BreakTy>
|
||||
{
|
||||
::std::ops::ControlFlow::CONTINUE
|
||||
::std::ops::ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
)+
|
||||
|
@ -219,7 +219,7 @@ macro_rules! EnumTypeTraversalImpl {
|
|||
$($crate::ty::visit::TypeVisitable::visit_with(
|
||||
$variant_arg, $visitor
|
||||
)?;)*
|
||||
::std::ops::ControlFlow::CONTINUE
|
||||
::std::ops::ControlFlow::Continue(())
|
||||
}
|
||||
$($output)*
|
||||
)
|
||||
|
@ -237,7 +237,7 @@ macro_rules! EnumTypeTraversalImpl {
|
|||
$($crate::ty::visit::TypeVisitable::visit_with(
|
||||
$variant_arg, $visitor
|
||||
)?;)*
|
||||
::std::ops::ControlFlow::CONTINUE
|
||||
::std::ops::ControlFlow::Continue(())
|
||||
}
|
||||
$($output)*
|
||||
)
|
||||
|
@ -251,7 +251,7 @@ macro_rules! EnumTypeTraversalImpl {
|
|||
@VisitVariants($this, $visitor)
|
||||
input($($input)*)
|
||||
output(
|
||||
$variant => { ::std::ops::ControlFlow::CONTINUE }
|
||||
$variant => { ::std::ops::ControlFlow::Continue(()) }
|
||||
$($output)*
|
||||
)
|
||||
)
|
||||
|
|
|
@ -4,6 +4,6 @@ use super::*;
|
|||
|
||||
impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2481,7 +2481,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
|||
if not_previously_inserted {
|
||||
ty.super_visit_with(self)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::AdtDef<'tcx> {
|
|||
|
||||
impl<'tcx> TypeVisitable<'tcx> for ty::AdtDef<'tcx> {
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> ControlFlow<V::BreakTy> {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ impl<'tcx> TypeSuperVisitable<'tcx> for Ty<'tcx> {
|
|||
| ty::Placeholder(..)
|
||||
| ty::Param(..)
|
||||
| ty::Never
|
||||
| ty::Foreign(..) => ControlFlow::CONTINUE,
|
||||
| ty::Foreign(..) => ControlFlow::Continue(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ty::Region<'tcx> {
|
|||
|
||||
impl<'tcx> TypeSuperVisitable<'tcx> for ty::Region<'tcx> {
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> ControlFlow<V::BreakTy> {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -844,7 +844,7 @@ impl<'tcx> TypeFoldable<'tcx> for InferConst<'tcx> {
|
|||
|
||||
impl<'tcx> TypeVisitable<'tcx> for InferConst<'tcx> {
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, _visitor: &mut V) -> ControlFlow<V::BreakTy> {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2015,7 +2015,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
type BreakTy = ();
|
||||
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
if self.0 == t { ControlFlow::BREAK } else { t.super_visit_with(self) }
|
||||
if self.0 == t { ControlFlow::Break(()) } else { t.super_visit_with(self) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -294,13 +294,13 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match *r {
|
||||
ty::ReLateBound(debruijn, _) if debruijn < self.outer_index => {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
_ => {
|
||||
if (self.callback)(r) {
|
||||
ControlFlow::BREAK
|
||||
ControlFlow::Break(())
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
if ty.flags().intersects(TypeFlags::HAS_FREE_REGIONS) {
|
||||
ty.super_visit_with(self)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ impl<'tcx> TypeVisitor<'tcx> for ValidateBoundVars<'tcx> {
|
|||
if t.outer_exclusive_binder() < self.binder_index
|
||||
|| !self.visited.insert((self.binder_index, t))
|
||||
{
|
||||
return ControlFlow::BREAK;
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
match *t.kind() {
|
||||
ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
|
||||
|
@ -512,7 +512,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
|
|||
if t.outer_exclusive_binder() > self.outer_index {
|
||||
ControlFlow::Break(FoundEscapingVars)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
|
|||
if r.bound_at_or_above_binder(self.outer_index) {
|
||||
ControlFlow::Break(FoundEscapingVars)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
|
|||
if predicate.outer_exclusive_binder() > self.outer_index {
|
||||
ControlFlow::Break(FoundEscapingVars)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||
if flags.intersects(self.flags) {
|
||||
ControlFlow::Break(FoundFlags)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||
if flags.intersects(self.flags) {
|
||||
ControlFlow::Break(FoundFlags)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||
if flags.intersects(self.flags) {
|
||||
ControlFlow::Break(FoundFlags)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||
if predicate.flags().intersects(self.flags) {
|
||||
ControlFlow::Break(FoundFlags)
|
||||
} else {
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
|||
// in the normalized form
|
||||
if self.just_constrained {
|
||||
if let ty::Alias(..) = t.kind() {
|
||||
return ControlFlow::CONTINUE;
|
||||
return ControlFlow::Continue(());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
|||
// in the normalized form
|
||||
if self.just_constrained {
|
||||
if let ty::ConstKind::Unevaluated(..) = c.kind() {
|
||||
return ControlFlow::CONTINUE;
|
||||
return ControlFlow::Continue(());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
|||
self.regions.insert(br.kind);
|
||||
}
|
||||
}
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -726,6 +726,6 @@ impl<'tcx> TypeVisitor<'tcx> for MaxUniverse {
|
|||
);
|
||||
}
|
||||
|
||||
ControlFlow::CONTINUE
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue