Fix incorrect slice->ptr conversion in slice_from_raw_parts docs
This commit is contained in:
parent
f76177ce43
commit
1c0d4851a6
1 changed files with 1 additions and 1 deletions
|
@ -252,7 +252,7 @@ pub(crate) struct FatPtr<T> {
|
||||||
///
|
///
|
||||||
/// // create a slice pointer when starting out with a pointer to the first element
|
/// // create a slice pointer when starting out with a pointer to the first element
|
||||||
/// let x = [5, 6, 7];
|
/// 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);
|
/// let slice = ptr::slice_from_raw_parts(ptr, 3);
|
||||||
/// assert_eq!(unsafe { &*slice }[2], 7);
|
/// assert_eq!(unsafe { &*slice }[2], 7);
|
||||||
/// ```
|
/// ```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue