From 4ec68576d3c7dc797629be7c1baa5d8bc057c8d7 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 22 Nov 2023 23:28:28 +0000 Subject: Cache flags for ty::Const --- compiler/rustc_trait_selection/src/traits/query/normalize.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index dba00ce0154..8faaa6be9f5 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -160,14 +160,12 @@ impl<'tcx> TypeVisitor> for MaxEscapingBoundVarVisitor { } fn visit_const(&mut self, ct: ty::Const<'tcx>) -> ControlFlow { - match ct.kind() { - ty::ConstKind::Bound(debruijn, _) if debruijn >= self.outer_index => { - self.escaping = - self.escaping.max(debruijn.as_usize() - self.outer_index.as_usize()); - ControlFlow::Continue(()) - } - _ => ct.super_visit_with(self), + if ct.outer_exclusive_binder() > self.outer_index { + self.escaping = self + .escaping + .max(ct.outer_exclusive_binder().as_usize() - self.outer_index.as_usize()); } + ControlFlow::Continue(()) } } -- cgit 1.4.1-3-g733a5