]> git.lizzy.rs Git - rust.git/commitdiff
Remove `?Sized` on `PartialEq`/`Eq` impls
authorJonas Schievink <jonasschievink@gmail.com>
Fri, 2 Apr 2021 16:26:34 +0000 (18:26 +0200)
committerJonas Schievink <jonasschievink@gmail.com>
Fri, 2 Apr 2021 16:26:34 +0000 (18:26 +0200)
crates/hir_def/src/intern.rs

index 785d9e3c64c0cfecc3bb602a7d341dd18947bfab..cc0b5d3503916ae471c80737288476252a380972 100644 (file)
@@ -90,14 +90,16 @@ fn drop_slow(&mut self) {
 }
 
 /// Compares interned `Ref`s using pointer equality.
-impl<T: Internable + ?Sized> PartialEq for Interned<T> {
+impl<T: Internable> PartialEq for Interned<T> {
+    // NOTE: No `?Sized` because `ptr_eq` doesn't work right with trait objects.
+
     #[inline]
     fn eq(&self, other: &Self) -> bool {
         Arc::ptr_eq(&self.arc, &other.arc)
     }
 }
 
-impl<T: Internable + ?Sized> Eq for Interned<T> {}
+impl<T: Internable> Eq for Interned<T> {}
 
 impl<T: Internable + ?Sized> AsRef<T> for Interned<T> {
     #[inline]
@@ -148,7 +150,7 @@ pub trait Internable: Hash + Eq + 'static {
 }
 
 macro_rules! impl_internable {
-    ( $($t:ty),+ $(,)? ) => { $(
+    ( $($t:path),+ $(,)? ) => { $(
         impl Internable for $t {
             fn storage() -> &'static InternStorage<Self> {
                 static STORAGE: InternStorage<$t> = InternStorage::new();