Skip to content

Commit

Permalink
Auto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc
Browse files Browse the repository at this point in the history
Add an early-exit to `QueryNormalizer::fold_ty`

Pulled out from #68524, this results in a ~60-70% reduction in compile time for the await-call-tree benchmarks. This should unblock #67982 as well.

r? @Zoxc
  • Loading branch information
bors committed Jan 28, 2020
2 parents ac2f3fa + 474d0e3 commit 3761dcd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc/traits/query/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
}

fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
if !ty.has_projections() {
return ty;
}

let ty = ty.super_fold_with(self);
match ty.kind {
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
Expand Down

0 comments on commit 3761dcd

Please sign in to comment.