]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_middle/src/mir/type_foldable.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / compiler / rustc_middle / src / mir / type_foldable.rs
index 9d098c8083ece5e2a98bed14e29310bfe64bfe27..4c0974f86fb35240532d9b9c9dd342c4bf46e627 100644 (file)
@@ -26,6 +26,12 @@ TrivialTypeTraversalAndLiftImpls! {
     GeneratorSavedLocal,
 }
 
+TrivialTypeTraversalImpls! {
+    for <'tcx> {
+        ConstValue<'tcx>,
+    }
+}
+
 impl<'tcx> TypeFoldable<'tcx> for &'tcx [InlineAsmTemplatePiece] {
     fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, _folder: &mut F) -> Result<Self, F::Error> {
         Ok(self)
@@ -49,25 +55,3 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
         Ok(self)
     }
 }
-
-impl<'tcx> TypeFoldable<'tcx> for ConstantKind<'tcx> {
-    #[inline(always)]
-    fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
-        folder.try_fold_mir_const(self)
-    }
-}
-
-impl<'tcx> TypeSuperFoldable<'tcx> for ConstantKind<'tcx> {
-    fn try_super_fold_with<F: FallibleTypeFolder<'tcx>>(
-        self,
-        folder: &mut F,
-    ) -> Result<Self, F::Error> {
-        match self {
-            ConstantKind::Ty(c) => Ok(ConstantKind::Ty(c.try_fold_with(folder)?)),
-            ConstantKind::Val(v, t) => Ok(ConstantKind::Val(v, t.try_fold_with(folder)?)),
-            ConstantKind::Unevaluated(uv, t) => {
-                Ok(ConstantKind::Unevaluated(uv.try_fold_with(folder)?, t.try_fold_with(folder)?))
-            }
-        }
-    }
-}