Skip to content

Commit 57d3a5a

Browse files
yodaldevoidvarkor
authored andcommitted
impl visit_const for HasEscapingVarsVisitor
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
1 parent c13aa09 commit 57d3a5a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustc/ty/fold.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//! looking for, and does not need to visit anything else.
3333
3434
use crate::hir::def_id::DefId;
35+
use crate::mir::interpret::ConstValue;
3536
use crate::ty::{self, Binder, Ty, TyCtxt, TypeFlags, flags::FlagComputation};
3637

3738
use std::collections::BTreeMap;
@@ -840,6 +841,17 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
840841
// visited.
841842
r.bound_at_or_above_binder(self.outer_index)
842843
}
844+
845+
fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool {
846+
if let ty::LazyConst::Evaluated(ty::Const {
847+
val: ConstValue::Infer(ty::InferConst::Canonical(debruijn, _)),
848+
..
849+
}) = *c {
850+
debruijn >= self.outer_index
851+
} else {
852+
false
853+
}
854+
}
843855
}
844856

845857
struct HasTypeFlagsVisitor {

0 commit comments

Comments
 (0)