Skip to content

Commit

Permalink
Use raw pointers for potentially racy loads (#233)
Browse files Browse the repository at this point in the history
Shared references assert immutability, so any concurrent access would be UB
disregarding data race concerns.
  • Loading branch information
RalfJung authored and carllerche committed Nov 17, 2018
1 parent 7c3085a commit c6c5b8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bytes.rs
Expand Up @@ -2438,7 +2438,7 @@ impl Inner {
#[inline]
fn imp(arc: &AtomicPtr<Shared>) -> usize {
unsafe {
let p: &u8 = mem::transmute(arc);
let p: *const u8 = mem::transmute(arc);
(*p as usize) & KIND_MASK
}
}
Expand All @@ -2447,7 +2447,7 @@ impl Inner {
#[inline]
fn imp(arc: &AtomicPtr<Shared>) -> usize {
unsafe {
let p: &usize = mem::transmute(arc);
let p: *const usize = mem::transmute(arc);
*p & KIND_MASK
}
}
Expand Down

0 comments on commit c6c5b8f

Please sign in to comment.