Skip to content

Commit

Permalink
cast the entire slice to a raw pointer, not just the first element
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 28, 2019
1 parent 4368aa4 commit 2693d12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ impl<T> RawTable<T> {
pub fn new() -> Self {
Self {
data: NonNull::dangling(),
ctrl: NonNull::from(&Group::static_empty()[0]),
// Be careful to cast the entire slice to a raw pointer.
ctrl: unsafe { NonNull::new_unchecked(Group::static_empty().as_ptr() as *mut u8) },
bucket_mask: 0,
items: 0,
growth_left: 0,
Expand Down

0 comments on commit 2693d12

Please sign in to comment.