diff --git a/src/bounded.rs b/src/bounded.rs index 5ceeb50..781038b 100644 --- a/src/bounded.rs +++ b/src/bounded.rs @@ -312,8 +312,8 @@ impl Drop for Bounded { // Drop the value in the slot. let slot = &self.buffer[index]; unsafe { - let value = slot.value.get().read().assume_init(); - drop(value); + let value = &mut *slot.value.get(); + value.as_mut_ptr().drop_in_place(); } } } diff --git a/src/single.rs b/src/single.rs index 022c7e4..26562e9 100644 --- a/src/single.rs +++ b/src/single.rs @@ -120,8 +120,10 @@ impl Drop for Single { fn drop(&mut self) { // Drop the value in the slot. if *self.state.get_mut() & PUSHED != 0 { - let value = unsafe { self.slot.get().read().assume_init() }; - drop(value); + unsafe { + let value = &mut *self.slot.get(); + value.as_mut_ptr().drop_in_place(); + } } } } diff --git a/src/unbounded.rs b/src/unbounded.rs index 94b1bdf..9018778 100644 --- a/src/unbounded.rs +++ b/src/unbounded.rs @@ -387,8 +387,8 @@ impl Drop for Unbounded { if offset < BLOCK_CAP { // Drop the value in the slot. let slot = (*block).slots.get_unchecked(offset); - let value = slot.value.get().read().assume_init(); - drop(value); + let value = &mut *slot.value.get(); + value.as_mut_ptr().drop_in_place(); } else { // Deallocate the block and move to the next one. let next = *(*block).next.get_mut();