add missing visit_consts

This commit is contained in:
Bastian Kauschke 2020-03-23 18:39:25 +01:00
parent 8ff785011b
commit 513ea6405b
2 changed files with 29 additions and 5 deletions

View file

@ -273,6 +273,20 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
t.super_visit_with(self)
}
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool {
match c.val {
ty::ConstKind::Bound(debruijn, bound_var) if debruijn == self.binder_index => {
self.types.insert(
bound_var.as_u32(),
Symbol::intern(&format!("^{}", bound_var.as_u32())),
);
}
_ => (),
}
c.super_visit_with(self)
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
match r {
ty::ReLateBound(index, br) if *index == self.binder_index => match br {

View file

@ -978,17 +978,27 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
// ignore the inputs to a projection, as they may not appear
// in the normalized form
if self.just_constrained {
match t.kind {
ty::Projection(..) | ty::Opaque(..) => {
return false;
}
_ => {}
if let ty::Projection(..) | ty::Opaque(..) = t.kind {
return false;
}
}
t.super_visit_with(self)
}
fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool {
// if we are only looking for "constrained" region, we have to
// ignore the inputs of an unevaluated const, as they may not appear
// in the normalized form
if self.just_constrained {
if let ty::ConstKind::Unevaluated(..) = c.val {
return false;
}
}
c.super_visit_with(self)
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
if let ty::ReLateBound(debruijn, br) = *r {
if debruijn == self.current_index {