use rustc_middle::ty::fold::{TypeFoldable, TypeVisitor};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::source_map::Span;
+use std::ops::ControlFlow;
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Parameter(pub u32);
}
impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
- fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
+ fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
match *t.kind() {
ty::Projection(..) | ty::Opaque(..) if !self.include_nonconstraining => {
// projections are not injective
- return false;
+ return ControlFlow::CONTINUE;
}
ty::Param(data) => {
self.parameters.push(Parameter::from(data));
t.super_visit_with(self)
}
- fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
+ fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
if let ty::ReEarlyBound(data) = *r {
self.parameters.push(Parameter::from(data));
}
- false
+ ControlFlow::CONTINUE
}
- fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool {
+ fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
match c.val {
ty::ConstKind::Unevaluated(..) if !self.include_nonconstraining => {
// Constant expressions are not injective