Revert missing "memory block"

This commit is contained in:
Tim Diekmann 2020-08-04 19:24:08 +02:00 committed by GitHub
parent 929e37d4bf
commit 93d98328d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,7 @@ pub unsafe trait AllocRef {
/// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> {
let ptr = self.alloc(layout)?;
// SAFETY: `alloc` returns a valid memory slice
// SAFETY: `alloc` returns a valid memory block
unsafe { ptr.as_non_null_ptr().as_ptr().write_bytes(0, ptr.len()) }
Ok(ptr)
}