Skip to content

Commit 1dc5c24

Browse files
committed
Auto merge of rust-lang#139293 - compiler-errors:folder-experiment-6, r=<try>
Folder experiment: Account for type flags in `fold_predicate` in `Canonicalizer` **NOTE:** This is one of a series of perf experiments that I've come up with while sick in bed. I'm assigning them to lqd b/c you're a good reviewer and you'll hopefully be awake when these experiments finish, lol. r? lqd The canonicalizer is used a lot in borrowck and in the eval-flavor of the trait solver. Let's avoid doing unnecessary work when folding predicates, which I would assume are a very important input to the canonicalizer as the main "type" of all goals and such.
2 parents d5b4c2e + 7d2c08f commit 1dc5c24

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+4
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> {

0 commit comments

Comments
 (0)