Skip to content

Commit bab5fb0

Browse files
committed
don't use slice::from_raw_parts for uninitialized memory
1 parent 64c7467 commit bab5fb0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/slice-dst/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use {
9999
alloc::{alloc, dealloc, handle_alloc_error},
100100
boxed::Box,
101101
},
102-
core::{alloc::Layout, mem::ManuallyDrop, ptr, slice},
102+
core::{alloc::Layout, mem::ManuallyDrop, ptr},
103103
};
104104

105105
/// A custom slice-based dynamically sized type.
@@ -173,7 +173,7 @@ where
173173
ptr::NonNull::new(alloc(layout) as *mut ())
174174
}
175175
.unwrap_or_else(|| handle_alloc_error(layout));
176-
let ptr = ptr::NonNull::new_unchecked(slice::from_raw_parts_mut::<()>(ptr.as_ptr(), len));
176+
let ptr = ptr::NonNull::new_unchecked(slice_from_raw_parts(ptr.as_ptr(), len));
177177
S::retype(ptr)
178178
}
179179
}

0 commit comments

Comments
 (0)