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 committed Nov 12, 2016
2 parents 75f2c21 + 11c1126 commit afbb675
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 afbb675

Please sign in to comment.