Rollup merge of #72822 - lcnr:intern-me, r=estebank

remove trivial calls to mk_const

similar to #72754
This commit is contained in:
Yuki Okushi 2020-06-02 13:07:15 +09:00 committed by GitHub
commit f1732f66ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1019,7 +1019,11 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
let ty = self.ty.fold_with(folder);
let val = self.val.fold_with(folder);
folder.tcx().mk_const(ty::Const { ty, val })
if ty != self.ty || val != self.val {
folder.tcx().mk_const(ty::Const { ty, val })
} else {
*self
}
}
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {