diff --git a/src/lib.rs b/src/lib.rs index 98ccdb1..34a86e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -171,7 +171,8 @@ impl LinkedHashMap { if self.head.is_null() { // allocate the guard node if not present unsafe { - self.head = Box::into_raw(Box::new(mem::uninitialized())); + let node_layout = std::alloc::Layout::new::>(); + self.head = std::alloc::alloc(node_layout) as *mut Node; (*self.head).next = self.head; (*self.head).prev = self.head; }