Set the default BreakTy
to !
This commit is contained in:
parent
df6e87cc85
commit
65cdc21f06
7 changed files with 16 additions and 1 deletions
|
@ -1135,6 +1135,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<'a, 'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueTypes<'a, 'tcx> {
|
impl<'a, 'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueTypes<'a, 'tcx> {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Opaque(..) => {
|
ty::Opaque(..) => {
|
||||||
|
|
|
@ -148,6 +148,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
|
||||||
pub struct Visitor<F>(F);
|
pub struct Visitor<F>(F);
|
||||||
|
|
||||||
impl<'tcx, F: FnMut(Ty<'tcx>) -> ControlFlow<()>> TypeVisitor<'tcx> for Visitor<F> {
|
impl<'tcx, F: FnMut(Ty<'tcx>) -> ControlFlow<()>> TypeVisitor<'tcx> for Visitor<F> {
|
||||||
|
type BreakTy = ();
|
||||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<()> {
|
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<()> {
|
||||||
self.0(ty)
|
self.0(ty)
|
||||||
}
|
}
|
||||||
|
@ -195,7 +196,7 @@ pub trait TypeFolder<'tcx>: Sized {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TypeVisitor<'tcx>: Sized {
|
pub trait TypeVisitor<'tcx>: Sized {
|
||||||
type BreakTy = ();
|
type BreakTy = !;
|
||||||
|
|
||||||
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &Binder<T>) -> ControlFlow<Self::BreakTy> {
|
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &Binder<T>) -> ControlFlow<Self::BreakTy> {
|
||||||
t.super_visit_with(self)
|
t.super_visit_with(self)
|
||||||
|
@ -331,6 +332,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
where
|
where
|
||||||
F: FnMut(ty::Region<'tcx>) -> bool,
|
F: FnMut(ty::Region<'tcx>) -> bool,
|
||||||
{
|
{
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_binder<T: TypeFoldable<'tcx>>(
|
fn visit_binder<T: TypeFoldable<'tcx>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
t: &Binder<T>,
|
t: &Binder<T>,
|
||||||
|
|
|
@ -18,6 +18,8 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<'tcx> TypeVisitor<'tcx> for UsedParamsNeedSubstVisitor<'tcx> {
|
impl<'tcx> TypeVisitor<'tcx> for UsedParamsNeedSubstVisitor<'tcx> {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
if !c.needs_subst() {
|
if !c.needs_subst() {
|
||||||
return ControlFlow::CONTINUE;
|
return ControlFlow::CONTINUE;
|
||||||
|
|
|
@ -318,6 +318,8 @@ struct HasUsedGenericParams<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> TypeVisitor<'tcx> for HasUsedGenericParams<'a> {
|
impl<'a, 'tcx> TypeVisitor<'tcx> for HasUsedGenericParams<'a> {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_const(&mut self, c: &'tcx Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_const(&mut self, c: &'tcx Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
debug!("visit_const: c={:?}", c);
|
debug!("visit_const: c={:?}", c);
|
||||||
if !c.has_param_types_or_consts() {
|
if !c.has_param_types_or_consts() {
|
||||||
|
|
|
@ -771,6 +771,8 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeVisitor<'tcx> for IllegalSelfTypeVisitor<'tcx> {
|
impl<'tcx> TypeVisitor<'tcx> for IllegalSelfTypeVisitor<'tcx> {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
match t.kind() {
|
match t.kind() {
|
||||||
ty::Param(_) => {
|
ty::Param(_) => {
|
||||||
|
|
|
@ -800,6 +800,8 @@ fn check_where_clauses<'tcx, 'fcx>(
|
||||||
params: FxHashSet<u32>,
|
params: FxHashSet<u32>,
|
||||||
}
|
}
|
||||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
|
impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
if let ty::Param(param) = t.kind() {
|
if let ty::Param(param) = t.kind() {
|
||||||
self.params.insert(param.index);
|
self.params.insert(param.index);
|
||||||
|
|
|
@ -563,6 +563,8 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
|
||||||
struct ContainsRegion;
|
struct ContainsRegion;
|
||||||
|
|
||||||
impl TypeVisitor<'_> for ContainsRegion {
|
impl TypeVisitor<'_> for ContainsRegion {
|
||||||
|
type BreakTy = ();
|
||||||
|
|
||||||
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {
|
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {
|
||||||
ControlFlow::BREAK
|
ControlFlow::BREAK
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue