Skip to content

Commit f1732f6

Browse files
authored
Rollup merge of rust-lang#72822 - lcnr:intern-me, r=estebank
remove trivial calls to mk_const similar to rust-lang#72754
2 parents db0c346 + 9f83d36 commit f1732f6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_middle/ty/structural_impls.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,11 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> {
10191019
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
10201020
let ty = self.ty.fold_with(folder);
10211021
let val = self.val.fold_with(folder);
1022-
folder.tcx().mk_const(ty::Const { ty, val })
1022+
if ty != self.ty || val != self.val {
1023+
folder.tcx().mk_const(ty::Const { ty, val })
1024+
} else {
1025+
*self
1026+
}
10231027
}
10241028

10251029
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {

0 commit comments

Comments
 (0)