Skip to content

Commit 2741224

Browse files
committed
fix example
1 parent c06f551 commit 2741224

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/ptr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ pub use intrinsics::write_bytes;
149149
/// assert!(weak.upgrade().is_none());
150150
/// ```
151151
///
152-
/// Drops a potentially unaligned value by copying it to aligned memory first:
152+
/// Unaligned values cannot be dropped in place, they must be copied to an aligned
153+
/// location first:
153154
/// ```
154155
/// use std::ptr;
155156
/// use std::mem;
@@ -158,7 +159,7 @@ pub use intrinsics::write_bytes;
158159
/// let mut copy: T = mem::uninitialized();
159160
/// let copy = &mut copy as *mut T;
160161
/// ptr::copy(to_drop, copy, 1);
161-
/// ptr::drop_in_place(copy);
162+
/// drop(copy);
162163
/// }
163164
///
164165
/// #[repr(packed, C)]

0 commit comments

Comments
 (0)