diff --git a/crossbeam-epoch/src/sync/list.rs b/crossbeam-epoch/src/sync/list.rs index 09e402e17..2e0013d87 100644 --- a/crossbeam-epoch/src/sync/list.rs +++ b/crossbeam-epoch/src/sync/list.rs @@ -300,6 +300,7 @@ mod tests { use super::*; use crate::{Collector, Owned}; use crossbeam_utils::thread; + use std::ptr; use std::sync::Barrier; use std::vec::Vec; @@ -340,13 +341,13 @@ mod tests { let mut iter = l.iter(&guard); let maybe_e3 = iter.next(); assert!(maybe_e3.is_some()); - assert!(maybe_e3.unwrap().unwrap() as *const Entry == e3.as_raw()); + assert!(ptr::eq(maybe_e3.unwrap().unwrap(), e3.as_raw())); let maybe_e2 = iter.next(); assert!(maybe_e2.is_some()); - assert!(maybe_e2.unwrap().unwrap() as *const Entry == e2.as_raw()); + assert!(ptr::eq(maybe_e2.unwrap().unwrap(), e2.as_raw())); let maybe_e1 = iter.next(); assert!(maybe_e1.is_some()); - assert!(maybe_e1.unwrap().unwrap() as *const Entry == e1.as_raw()); + assert!(ptr::eq(maybe_e1.unwrap().unwrap(), e1.as_raw())); assert!(iter.next().is_none()); unsafe { @@ -379,10 +380,10 @@ mod tests { let mut iter = l.iter(&guard); let maybe_e3 = iter.next(); assert!(maybe_e3.is_some()); - assert!(maybe_e3.unwrap().unwrap() as *const Entry == e3.as_raw()); + assert!(ptr::eq(maybe_e3.unwrap().unwrap(), e3.as_raw())); let maybe_e1 = iter.next(); assert!(maybe_e1.is_some()); - assert!(maybe_e1.unwrap().unwrap() as *const Entry == e1.as_raw()); + assert!(ptr::eq(maybe_e1.unwrap().unwrap(), e1.as_raw())); assert!(iter.next().is_none()); unsafe { diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs index 2f345e9c3..998874ae9 100644 --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -2071,7 +2071,7 @@ impl Drop for IntoIter { unsafe { // Unprotected loads are okay because this function is the only one currently using // the skip list. - let next = (*self.node).tower[0].load(Ordering::Relaxed, epoch::unprotected()); + let next = (&(*self.node).tower)[0].load(Ordering::Relaxed, epoch::unprotected()); // We can safely do this without deferring because references to // keys & values that we give out never outlive the SkipList. @@ -2102,7 +2102,7 @@ impl Iterator for IntoIter { // // Unprotected loads are okay because this function is the only one currently using // the skip list. - let next = (*self.node).tower[0].load(Ordering::Relaxed, epoch::unprotected()); + let next = (&(*self.node).tower)[0].load(Ordering::Relaxed, epoch::unprotected()); // Deallocate the current node and move to the next one. Node::dealloc(self.node);