Skip to content

Commit 5b5c9ac

Browse files
Noratriebkornelski
authored andcommitted
Go through as_mut_ptr instead of as_ptr to mutate
Going through `as_ptr` does not give write provenance since it creates an intermediary shared reference.
1 parent 91ba4e6 commit 5b5c9ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/convert/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ unsafe fn from_items_to_struct<F, T>(from: &[F]) -> &[T] {
203203
unsafe fn from_items_to_struct_mut<F, T>(from: &mut [F]) -> &mut [T] {
204204
debug_assert_eq!(0, mem::size_of::<T>() % mem::size_of::<F>());
205205
let len = from.len() / (mem::size_of::<T>() / mem::size_of::<F>());
206-
slice::from_raw_parts_mut(from.as_ptr() as *mut T, len)
206+
slice::from_raw_parts_mut(from.as_mut_ptr() as *mut T, len)
207207
}
208208

209209
macro_rules! rgb_impl_from {

0 commit comments

Comments
 (0)