Skip to content

Commit

Permalink
Avoid unnecessary mk_ty calls in Ty::super_fold_with.
Browse files Browse the repository at this point in the history
This speeds up compilation of several rustc-benchmarks by 1--2% and the
workload in #36799 by 5%.
  • Loading branch information
nnethercote committed Nov 11, 2016
1 parent da2ce22 commit 11c1126
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 11c1126

Please sign in to comment.