Avoid more unnecessary mk_ty calls in Ty::super_fold_with.
This speeds up several rustc-benchmarks by 1--5%.
This commit is contained in:
parent
82d8833a45
commit
4d0618ee30
@ -481,8 +481,13 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) |
|
||||
ty::TyParam(..) | ty::TyNever => return self
|
||||
};
|
||||
|
||||
if self.sty == sty {
|
||||
self
|
||||
} else {
|
||||
folder.tcx().mk_ty(sty)
|
||||
}
|
||||
}
|
||||
|
||||
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
folder.fold_ty(*self)
|
||||
|
Loading…
Reference in New Issue
Block a user