diff options
| author | Markus Westerlind <markus.westerlind@imperva.com> | 2020-01-02 12:14:23 +0100 |
|---|---|---|
| committer | Markus Westerlind <markus.westerlind@imperva.com> | 2020-01-02 12:14:23 +0100 |
| commit | e6e61d9dff939c1c4ebbae0006efe2a7ac038ff6 (patch) | |
| tree | c2e3a08113692a51ed85322b799ba0a7938ed63a | |
| parent | 766fba3fdca8fe075c370a63d2f76f8407483af5 (diff) | |
| download | rust-e6e61d9dff939c1c4ebbae0006efe2a7ac038ff6.tar.gz rust-e6e61d9dff939c1c4ebbae0006efe2a7ac038ff6.zip | |
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
| -rw-r--r-- | src/librustc/traits/project.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index c604bf59cbd..4b59521a348 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -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. // |
