diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 04033905728ab..ef37fef045526 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -793,7 +793,7 @@ impl Box { /// use std::alloc::{Allocator, Layout, System}; /// /// unsafe { - /// let ptr = System.allocate(Layout::new::())?.as_mut_ptr(); + /// let ptr = System.allocate(Layout::new::())?.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.