From c6c5b8fb541b5fea581706d04b2525d18ce00ebe Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 17 Nov 2018 16:51:50 +0100 Subject: [PATCH] Use raw pointers for potentially racy loads (#233) Shared references assert immutability, so any concurrent access would be UB disregarding data race concerns. --- src/bytes.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bytes.rs b/src/bytes.rs index 1cc168f1c..3d6fb31b4 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -2438,7 +2438,7 @@ impl Inner { #[inline] fn imp(arc: &AtomicPtr) -> usize { unsafe { - let p: &u8 = mem::transmute(arc); + let p: *const u8 = mem::transmute(arc); (*p as usize) & KIND_MASK } } @@ -2447,7 +2447,7 @@ impl Inner { #[inline] fn imp(arc: &AtomicPtr) -> usize { unsafe { - let p: &usize = mem::transmute(arc); + let p: *const usize = mem::transmute(arc); *p & KIND_MASK } }