Skip to content

Commit 58ea02e

Browse files
committed
Update based on petrochenkov's review
1 parent 661df4f commit 58ea02e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/core/src/iter/adapters/filter_map.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ where
9797
// SAFETY: Loop conditions ensure the index is in bounds.
9898

9999
unsafe {
100-
let opt_payload_at =
101-
(&val as *const Option<B>).byte_add(core::mem::offset_of!(Option<B>, Some.0));
100+
let opt_payload_at: *const MaybeUninit<B> = (&val as *const Option<B>)
101+
.byte_add(core::mem::offset_of!(Option<B>, Some.0))
102+
.cast();
102103
let dst = guard.array.as_mut_ptr().add(idx);
103-
crate::ptr::copy_nonoverlapping(opt_payload_at.cast(), dst, 1);
104+
crate::ptr::copy_nonoverlapping(opt_payload_at, dst, 1);
104105
crate::mem::forget(val);
105106
};
106107

0 commit comments

Comments
 (0)