about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2024-11-10 18:34:59 +0100
committerjackh726 <git@jackhuey.me>2025-08-06 18:35:56 +0000
commit4ff22ddc9d0bec9b12a4a878ef4c4a89297081da (patch)
treed71959e7f17fbf6e8fd9c18837679dd28bbdfa92
parent8fb40f798a23adf608182ce5f4eb151fdc8e0da5 (diff)
downloadrust-4ff22ddc9d0bec9b12a4a878ef4c4a89297081da.tar.gz
rust-4ff22ddc9d0bec9b12a4a878ef4c4a89297081da.zip
Move some TypeVisitable/TypeFoldable impls to rustc_type_ir
-rw-r--r--compiler/rustc_type_ir/src/const_kind.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/compiler/rustc_type_ir/src/const_kind.rs b/compiler/rustc_type_ir/src/const_kind.rs
index 70a8509b513..327a6671a46 100644
--- a/compiler/rustc_type_ir/src/const_kind.rs
+++ b/compiler/rustc_type_ir/src/const_kind.rs
@@ -7,7 +7,10 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
 use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
 
-use crate::{self as ty, DebruijnIndex, Interner};
+use crate::{
+    self as ty, DebruijnIndex, FallibleTypeFolder, Interner, TypeFoldable, TypeFolder,
+    TypeVisitable, TypeVisitor, VisitorResult,
+};
 
 /// Represents a constant in Rust.
 #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
@@ -120,3 +123,19 @@ impl<CTX> HashStable<CTX> for InferConst {
         }
     }
 }
+
+impl<I: Interner> TypeFoldable<I> for InferConst {
+    fn try_fold_with<F: FallibleTypeFolder<I>>(self, _folder: &mut F) -> Result<Self, F::Error> {
+        Ok(self)
+    }
+
+    fn fold_with<F: TypeFolder<I>>(self, _folder: &mut F) -> Self {
+        self
+    }
+}
+
+impl<I: Interner> TypeVisitable<I> for InferConst {
+    fn visit_with<V: TypeVisitor<I>>(&self, _visitor: &mut V) -> V::Result {
+        V::Result::output()
+    }
+}