Skip to content

Commit

Permalink
Auto merge of #67808 - Marwes:projection_normalization_recurse, r=nik…
Browse files Browse the repository at this point in the history
…omatsakis

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
  • Loading branch information
bors committed Jan 5, 2020
2 parents 7494250 + e6e61d9 commit 093241d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
}

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

0 comments on commit 093241d

Please sign in to comment.