fix incorrect from_raw_in doctest

This commit is contained in:
Ralf Jung 2021-04-10 12:24:08 +02:00
parent 481598b26d
commit 63b682b3ec

View File

@ -793,7 +793,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
/// use std::alloc::{Allocator, Layout, System};
///
/// unsafe {
/// let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr();
/// let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;
/// // In general .write is required to avoid attempting to destruct
/// // the (uninitialized) previous contents of `ptr`, though for this
/// // simple example `*ptr = 5` would have worked as well.