1
Fork 0

Remove implicit Continue type

This commit is contained in:
LeSeulArtichaut 2020-10-25 11:50:56 +01:00
parent 24e1a7e656
commit 9433eb83fe
30 changed files with 129 additions and 135 deletions

View file

@ -450,7 +450,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
};
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<()> {
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
if t != self.opaque_identity_ty && t.super_visit_with(self).is_break() {
self.ty = Some(t);
@ -459,7 +459,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
ControlFlow::CONTINUE
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<(), ()> {
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<()> {
debug!("check_opaque_for_inheriting_lifetimes: (visit_region) r={:?}", r);
if let RegionKind::ReEarlyBound(ty::EarlyBoundRegion { index, .. }) = r {
if *index < self.generics.parent_count as u32 {
@ -472,7 +472,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
r.super_visit_with(self)
}
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<(), ()> {
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<()> {
if let ty::ConstKind::Unevaluated(..) = c.val {
// FIXME(#72219) We currenctly don't detect lifetimes within substs
// which would violate this check. Even though the particular substitution is not used
@ -1455,7 +1455,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'tcx>, def_id: LocalDefId, span: Span) {
{
struct VisitTypes(Vec<DefId>);
impl<'tcx> ty::fold::TypeVisitor<'tcx> for VisitTypes {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<()> {
match *t.kind() {
ty::Opaque(def, _) => {
self.0.push(def);

View file

@ -983,7 +983,7 @@ fn suggest_constraining_param(
struct TypeParamVisitor<'tcx>(Vec<Ty<'tcx>>);
impl<'tcx> TypeVisitor<'tcx> for TypeParamVisitor<'tcx> {
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<()> {
if let ty::Param(_) = ty.kind() {
self.0.push(ty);
}

View file

@ -800,18 +800,18 @@ fn check_where_clauses<'tcx, 'fcx>(
params: FxHashSet<u32>,
}
impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<()> {
if let ty::Param(param) = t.kind() {
self.params.insert(param.index);
}
t.super_visit_with(self)
}
fn visit_region(&mut self, _: ty::Region<'tcx>) -> ControlFlow<(), ()> {
fn visit_region(&mut self, _: ty::Region<'tcx>) -> ControlFlow<()> {
ControlFlow::BREAK
}
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<(), ()> {
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<()> {
if let ty::ConstKind::Param(param) = c.val {
self.params.insert(param.index);
}

View file

@ -2062,7 +2062,7 @@ fn const_evaluatable_predicates_of<'tcx>(
}
impl<'a, 'tcx> TypeVisitor<'tcx> for TyAliasVisitor<'a, 'tcx> {
fn visit_const(&mut self, ct: &'tcx Const<'tcx>) -> ControlFlow<(), ()> {
fn visit_const(&mut self, ct: &'tcx Const<'tcx>) -> ControlFlow<()> {
if let ty::ConstKind::Unevaluated(def, substs, None) = ct.val {
self.preds.insert((
ty::PredicateAtom::ConstEvaluatable(def, substs).to_predicate(self.tcx),

View file

@ -57,7 +57,7 @@ struct ParameterCollector {
}
impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<(), ()> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<()> {
match *t.kind() {
ty::Projection(..) | ty::Opaque(..) if !self.include_nonconstraining => {
// projections are not injective
@ -72,14 +72,14 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
t.super_visit_with(self)
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<(), ()> {
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<()> {
if let ty::ReEarlyBound(data) = *r {
self.parameters.push(Parameter::from(data));
}
ControlFlow::CONTINUE
}
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<(), ()> {
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<()> {
match c.val {
ty::ConstKind::Unevaluated(..) if !self.include_nonconstraining => {
// Constant expressions are not injective