Update based on petrochenkov's review
This commit is contained in:
parent
661df4fd55
commit
58ea02e872
@ -97,10 +97,11 @@ fn drop(&mut self) {
|
||||
// SAFETY: Loop conditions ensure the index is in bounds.
|
||||
|
||||
unsafe {
|
||||
let opt_payload_at =
|
||||
(&val as *const Option<B>).byte_add(core::mem::offset_of!(Option<B>, Some.0));
|
||||
let opt_payload_at: *const MaybeUninit<B> = (&val as *const Option<B>)
|
||||
.byte_add(core::mem::offset_of!(Option<B>, Some.0))
|
||||
.cast();
|
||||
let dst = guard.array.as_mut_ptr().add(idx);
|
||||
crate::ptr::copy_nonoverlapping(opt_payload_at.cast(), dst, 1);
|
||||
crate::ptr::copy_nonoverlapping(opt_payload_at, dst, 1);
|
||||
crate::mem::forget(val);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user