From 9caa7f5dfdb370756c0045979ff5a5c9e1aedb72 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 2 Apr 2025 23:36:40 +0000 Subject: [PATCH] Account for type flags in fold_predicate in OpportunisticVarResolver --- compiler/rustc_infer/src/infer/resolve.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_infer/src/infer/resolve.rs b/compiler/rustc_infer/src/infer/resolve.rs index 4a99c2209755d..496931a94c5d4 100644 --- a/compiler/rustc_infer/src/infer/resolve.rs +++ b/compiler/rustc_infer/src/infer/resolve.rs @@ -56,6 +56,10 @@ impl<'a, 'tcx> TypeFolder> for OpportunisticVarResolver<'a, 'tcx> { ct.super_fold_with(self) } } + + fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { + if !p.has_non_region_infer() { p } else { p.super_fold_with(self) } + } } /// The opportunistic region resolver opportunistically resolves regions