Skip to content

Commit

Permalink
Update based on petrochenkov's review
Browse files Browse the repository at this point in the history
  • Loading branch information
GKFX committed Nov 18, 2023
1 parent 661df4f commit 58ea02e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/core/src/iter/adapters/filter_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ where
// 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);
};

Expand Down

0 comments on commit 58ea02e

Please sign in to comment.