Skip to content

Commit 1c0d485

Browse files
committed
Fix incorrect slice->ptr conversion in slice_from_raw_parts docs
1 parent f76177c commit 1c0d485

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/ptr/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ pub(crate) struct FatPtr<T> {
252252
///
253253
/// // create a slice pointer when starting out with a pointer to the first element
254254
/// let x = [5, 6, 7];
255-
/// let ptr = &x[0] as *const _;
255+
/// let ptr = x.as_ptr();
256256
/// let slice = ptr::slice_from_raw_parts(ptr, 3);
257257
/// assert_eq!(unsafe { &*slice }[2], 7);
258258
/// ```

0 commit comments

Comments
 (0)