1
Fork 0

Convert TypeVisitor and DefIdVisitor to use VisitorResult

This commit is contained in:
Jason Newcomb 2024-02-24 17:22:28 -05:00
parent 5abfb3775d
commit be9b125d41
53 changed files with 345 additions and 448 deletions

View file

@ -1964,31 +1964,26 @@ fn is_late_bound_map(
arg_is_constrained: Box<[bool]>,
}
use std::ops::ControlFlow;
use ty::Ty;
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ConstrainedCollectorPostAstConv {
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<!> {
fn visit_ty(&mut self, t: Ty<'tcx>) {
match t.kind() {
ty::Param(param_ty) => {
self.arg_is_constrained[param_ty.index as usize] = true;
}
ty::Alias(ty::Projection | ty::Inherent, _) => return ControlFlow::Continue(()),
ty::Alias(ty::Projection | ty::Inherent, _) => return,
_ => (),
}
t.super_visit_with(self)
}
fn visit_const(&mut self, _: ty::Const<'tcx>) -> ControlFlow<!> {
ControlFlow::Continue(())
}
fn visit_const(&mut self, _: ty::Const<'tcx>) {}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<!> {
fn visit_region(&mut self, r: ty::Region<'tcx>) {
debug!("r={:?}", r.kind());
if let ty::RegionKind::ReEarlyParam(region) = r.kind() {
self.arg_is_constrained[region.index as usize] = true;
}
ControlFlow::Continue(())
}
}