use rustc_target::spec::abi::Abi as SpecAbi;
use std::cmp;
+use std::ops::ControlFlow;
use tracing::debug;
declare_lint! {
};
impl<'a, 'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueTypes<'a, 'tcx> {
- fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
+ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<(), ()> {
match ty.kind() {
ty::Opaque(..) => {
self.ty = Some(ty);
- true
+ ControlFlow::BREAK
}
// Consider opaque types within projections FFI-safe if they do not normalize
// to more opaque types.
// If `ty` is a opaque type directly then `super_visit_with` won't invoke
// this function again.
- if ty.has_opaque_types() { self.visit_ty(ty) } else { false }
+ if ty.has_opaque_types() {
+ self.visit_ty(ty)
+ } else {
+ ControlFlow::CONTINUE
+ }
}
_ => ty.super_visit_with(self),
}