Skip to content

Commit

Permalink
Rollup merge of #72822 - lcnr:intern-me, r=estebank
Browse files Browse the repository at this point in the history
remove trivial calls to mk_const

similar to #72754
  • Loading branch information
JohnTitor authored Jun 2, 2020
2 parents db0c346 + 9f83d36 commit f1732f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/librustc_middle/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f1732f6

Please sign in to comment.