Skip to content

Commit 093241d

Browse files
committed
Auto merge of #67808 - Marwes:projection_normalization_recurse, r=nikomatsakis
perf: Don't recurse into types that do not need normalizing A bit speculative at this stage but profiling shows that type folding takes up a substantial amount of time during normalization which may indicate that many types may be folded despite there being nothing to normalize
2 parents 7494250 + e6e61d9 commit 093241d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/librustc/traits/project.rs

+3
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
316316
}
317317

318318
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
319+
if !ty.has_projections() {
320+
return ty;
321+
}
319322
// We don't want to normalize associated types that occur inside of region
320323
// binders, because they may contain bound regions, and we can't cope with that.
321324
//

0 commit comments

Comments
 (0)