Skip to content

Commit daa40a5

Browse files
committed
Auto merge of #141442 - compiler-errors:fast-path-pred, r=<try>
Fold predicate fast path in canonicalizer and eager resolver r? lcnr
2 parents 52bf0cf + e348ad2 commit daa40a5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
515515
ct
516516
}
517517
}
518+
519+
fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
520+
if p.flags().intersects(self.needs_canonical_flags) { p.super_fold_with(self) } else { p }
521+
}
518522
}
519523

520524
impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {

compiler/rustc_next_trait_solver/src/resolve.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,8 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolv
8686
}
8787
}
8888
}
89+
90+
fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicate {
91+
if p.has_infer() { p.super_fold_with(self) } else { p }
92+
}
8993
}

0 commit comments

Comments
 (0)