cl-structures: Do not #[derive(Eq)] for Interned<T>

Derive places Eq bound on T, which is not true of Interned<T>
This commit is contained in:
John 2024-05-16 15:04:37 -05:00
parent c9266d971f
commit 33b7cd3971

View File

@ -26,7 +26,6 @@ pub mod interned {
/// dereference to the wrapped pointers, and as such, may produce /// dereference to the wrapped pointers, and as such, may produce
/// results inconsistent with [PartialEq] or [Eq]. /// results inconsistent with [PartialEq] or [Eq].
#[repr(transparent)] #[repr(transparent)]
#[derive(Eq)]
pub struct Interned<'a, T: ?Sized> { pub struct Interned<'a, T: ?Sized> {
value: &'a T, value: &'a T,
} }
@ -80,6 +79,7 @@ pub mod interned {
// } // }
// } // }
impl<'a, T: ?Sized> Eq for Interned<'a, T> {}
impl<'a, T: ?Sized> PartialEq for Interned<'a, T> { impl<'a, T: ?Sized> PartialEq for Interned<'a, T> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
std::ptr::eq(self.value, other.value) std::ptr::eq(self.value, other.value)