Skip to content

Commit

Permalink
perf: Don't recurse into types that do not need normalizing
Browse files Browse the repository at this point in the history
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
Marwes committed Jan 2, 2020
1 parent 766fba3 commit e6e61d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc/traits/project.rs
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 e6e61d9

Please sign in to comment.