We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents db0c346 + 9f83d36 commit f1732f6Copy full SHA for f1732f6
src/librustc_middle/ty/structural_impls.rs
@@ -1019,7 +1019,11 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> {
1019
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
1020
let ty = self.ty.fold_with(folder);
1021
let val = self.val.fold_with(folder);
1022
- folder.tcx().mk_const(ty::Const { ty, val })
+ if ty != self.ty || val != self.val {
1023
+ folder.tcx().mk_const(ty::Const { ty, val })
1024
+ } else {
1025
+ *self
1026
+ }
1027
}
1028
1029
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
0 commit comments