mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Revert missing "memory block"
This commit is contained in:
parent
929e37d4bf
commit
93d98328d1
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user