impl visit_const for HasEscapingVarsVisitor

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
This commit is contained in:
Gabriel Smith 2019-02-28 23:09:44 -05:00 committed by varkor
parent c13aa09d49
commit 57d3a5a32d

View File

@ -32,6 +32,7 @@
//! looking for, and does not need to visit anything else.
use crate::hir::def_id::DefId;
use crate::mir::interpret::ConstValue;
use crate::ty::{self, Binder, Ty, TyCtxt, TypeFlags, flags::FlagComputation};
use std::collections::BTreeMap;
@ -840,6 +841,17 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
// visited.
r.bound_at_or_above_binder(self.outer_index)
}
fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool {
if let ty::LazyConst::Evaluated(ty::Const {
val: ConstValue::Infer(ty::InferConst::Canonical(debruijn, _)),
..
}) = *c {
debruijn >= self.outer_index
} else {
false
}
}
}
struct HasTypeFlagsVisitor {