Skip to content

Commit 63b682b

Browse files
committed
fix incorrect from_raw_in doctest
1 parent 481598b commit 63b682b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/alloc/src/boxed.rs

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

0 commit comments

Comments
 (0)