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%.
This commit is contained in:
Nicholas Nethercote 2016-11-11 15:56:58 +11:00
parent da2ce22768
commit 11c1126688

View File

@ -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)
}