diff --git a/src/arc.rs b/src/arc.rs index a5f09d8..0446de2 100644 --- a/src/arc.rs +++ b/src/arc.rs @@ -647,6 +647,7 @@ impl Drop for Arc { impl PartialEq for Arc { fn eq(&self, other: &Arc) -> bool { + // TODO: pointer equality is incorrect if `T` is not `Eq`. Self::ptr_eq(self, other) || *(*self) == *(*other) } @@ -1050,6 +1051,15 @@ mod tests { assert_eq!(1, Arc::strong_count(&arc2)); } + #[test] + fn test_partial_eq_bug() { + let float = f32::NAN; + assert_ne!(float, float); + let arc = Arc::new(f32::NAN); + // TODO: this is a bug. + assert_eq!(arc, arc); + } + #[allow(dead_code)] const fn is_partial_ord() {}