From 2693d1242c25c708b7fe9e12bda27c3e841634d1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 28 May 2019 12:53:45 +0200 Subject: [PATCH] cast the entire slice to a raw pointer, not just the first element --- src/raw/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/raw/mod.rs b/src/raw/mod.rs index e02c21c5f6..822b5c9c31 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -357,7 +357,8 @@ impl RawTable { 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,