From 1c0d4851a6a686d09b03fab575fb0847d1e9f665 Mon Sep 17 00:00:00 2001 From: CAD97 Date: Wed, 15 Jan 2020 17:00:36 -0500 Subject: [PATCH] Fix incorrect slice->ptr conversion in slice_from_raw_parts docs --- src/libcore/ptr/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index 80f865d79e49a..29956ae1a3646 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -252,7 +252,7 @@ pub(crate) struct FatPtr { /// /// // create a slice pointer when starting out with a pointer to the first element /// let x = [5, 6, 7]; -/// let ptr = &x[0] as *const _; +/// let ptr = x.as_ptr(); /// let slice = ptr::slice_from_raw_parts(ptr, 3); /// assert_eq!(unsafe { &*slice }[2], 7); /// ```