about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-11-12 10:38:44 +0200
committerGitHub <noreply@github.com>2016-11-12 10:38:44 +0200
commitafbb675f2ec243358933f9fa16175fd8db83a3ae (patch)
tree5608da1965a22f2f5b7954152feb8fbe99ce1c03
parent75f2c211240cf257ce34a82a1d0b34b2c9dde573 (diff)
parent11c1126688bab32f76dbe1a973906c7586da143f (diff)
downloadrust-afbb675f2ec243358933f9fa16175fd8db83a3ae.tar.gz
rust-afbb675f2ec243358933f9fa16175fd8db83a3ae.zip
Rollup merge of #37705 - nnethercote:fewer-mk_ty-calls, r=brson
Avoid unnecessary mk_ty calls in Ty::super_fold_with.

This speeds up compilation of several rustc-benchmarks by 1--2% and the workload in #36799 by 5%.

r? @eddyb
-rw-r--r--src/librustc/ty/structural_impls.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs
index 9ca911837b5..282cb9f80f5 100644
--- a/src/librustc/ty/structural_impls.rs
+++ b/src/librustc/ty/structural_impls.rs
@@ -482,7 +482,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
             ty::TyAnon(did, substs) => ty::TyAnon(did, substs.fold_with(folder)),
             ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
             ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) |
-            ty::TyParam(..) | ty::TyNever => self.sty.clone(),
+            ty::TyParam(..) | ty::TyNever => return self
         };
         folder.tcx().mk_ty(sty)
     }