From 57d3a5a32de7a10ed7af886dc6ddd3754c9a394c Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Thu, 28 Feb 2019 23:09:44 -0500 Subject: [PATCH] impl visit_const for HasEscapingVarsVisitor Signed-off-by: Gabriel Smith --- src/librustc/ty/fold.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index dd936efb3c8..96705124b28 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -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 { -- 2.44.0