Skip to content

Commit

Permalink
Rollup merge of rust-lang#37705 - nnethercote:fewer-mk_ty-calls, r=brson
Browse files Browse the repository at this point in the history
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 rust-lang#36799 by 5%.

r? @eddyb
  • Loading branch information
eddyb authored Nov 11, 2016
2 parents 0db7d5a + 11c1126 commit 03a6d8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 03a6d8e

Please sign in to comment.