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,7 +481,12 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) |
|
||||
ty::TyParam(..) | ty::TyNever => return self
|
||||
};
|
||||
folder.tcx().mk_ty(sty)
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user