From fa912f451be6d9c32dbf7e1df20382e21406001d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 2 Apr 2025 23:36:57 +0000 Subject: [PATCH] Account for flags in ArgFolder --- compiler/rustc_type_ir/src/binder.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs index e9055940310d0..7512e032fe73a 100644 --- a/compiler/rustc_type_ir/src/binder.rs +++ b/compiler/rustc_type_ir/src/binder.rs @@ -697,12 +697,24 @@ impl<'a, I: Interner> TypeFolder for ArgFolder<'a, I> { } fn fold_const(&mut self, c: I::Const) -> I::Const { + if !c.has_param() { + return c; + } + if let ty::ConstKind::Param(p) = c.kind() { self.const_for_param(p, c) } else { c.super_fold_with(self) } } + + fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicate { + if !p.has_param() { + return p; + } + + p.super_fold_with(self) + } } impl<'a, I: Interner> ArgFolder<'a, I> {