Use raw pointers for potentially racy loads (#233)

Shared references assert immutability, so any concurrent access would be UB
disregarding data race concerns.
This commit is contained in:
Ralf Jung
2018-11-17 07:51:50 -08:00
committed by Carl Lerche
parent 7c3085aaec
commit c6c5b8fb54
+2 -2
View File
@@ -2438,7 +2438,7 @@ impl Inner {
#[inline] #[inline]
fn imp(arc: &AtomicPtr<Shared>) -> usize { fn imp(arc: &AtomicPtr<Shared>) -> usize {
unsafe { unsafe {
let p: &u8 = mem::transmute(arc); let p: *const u8 = mem::transmute(arc);
(*p as usize) & KIND_MASK (*p as usize) & KIND_MASK
} }
} }
@@ -2447,7 +2447,7 @@ impl Inner {
#[inline] #[inline]
fn imp(arc: &AtomicPtr<Shared>) -> usize { fn imp(arc: &AtomicPtr<Shared>) -> usize {
unsafe { unsafe {
let p: &usize = mem::transmute(arc); let p: *const usize = mem::transmute(arc);
*p & KIND_MASK *p & KIND_MASK
} }
} }