Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/salsa/src/interned.rs')
-rw-r--r--crates/salsa/src/interned.rs37
1 files changed, 19 insertions, 18 deletions
diff --git a/crates/salsa/src/interned.rs b/crates/salsa/src/interned.rs
index bfa9cc0591..eef8bcc814 100644
--- a/crates/salsa/src/interned.rs
+++ b/crates/salsa/src/interned.rs
@@ -98,26 +98,27 @@ impl<A: InternValue + Eq + Hash + Debug + Clone, B: InternValue + Eq + Hash + De
}
}
+pub trait InternValueTrivial
+where
+ Self: Eq + Hash + Debug + Clone,
+{
+}
+
/// Implement [`InternValue`] trivially, that is without actually mapping at all.
-#[macro_export]
-macro_rules! impl_intern_value_trivial {
- ($($ty:ty),*) => {
- $(
- impl $crate::InternValue for $ty {
- type Key = $ty;
- #[inline]
- fn into_key(&self) -> Self::Key {
- self.clone()
- }
- #[inline]
- fn with_key<F: FnOnce(&Self::Key) -> T, T>(&self, f: F) -> T {
- f(self)
- }
- }
- )*
- };
+impl<V: InternValueTrivial> InternValue for V {
+ type Key = Self;
+ #[inline]
+ fn into_key(&self) -> Self::Key {
+ self.clone()
+ }
+ #[inline]
+ fn with_key<F: FnOnce(&Self::Key) -> T, T>(&self, f: F) -> T {
+ f(self)
+ }
}
-impl_intern_value_trivial!(String);
+
+impl InternValueTrivial for String {}
+
#[derive(Debug)]
struct Slot<V> {
/// DatabaseKeyIndex for this slot.