Skip to content

Commit b4a11d4

Browse files
committed
doc-example: Refactor pointer name to avoid confusion
Changed raw pointer name from ptr to raw_pointer to avoid confusion with the `use std::ptr` statement a few lines above. This way the crate name and pointer name are well differenciated.
1 parent 413a129 commit b4a11d4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/libcore/ptr/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
//! [`write_volatile`]: ./fn.write_volatile.html
6666
//! [`NonNull::dangling`]: ./struct.NonNull.html#method.dangling
6767
68-
// ignore-tidy-undocumented-unsafe
69-
7068
#![stable(feature = "rust1", since = "1.0.0")]
7169

7270
use crate::cmp::Ordering;
@@ -248,8 +246,8 @@ pub(crate) struct FatPtr<T> {
248246
///
249247
/// // create a slice pointer when starting out with a pointer to the first element
250248
/// let x = [5, 6, 7];
251-
/// let ptr = x.as_ptr();
252-
/// let slice = ptr::slice_from_raw_parts(ptr, 3);
249+
/// let raw_pointer = x.as_ptr();
250+
/// let slice = ptr::slice_from_raw_parts(raw_pointer, 3);
253251
/// assert_eq!(unsafe { &*slice }[2], 7);
254252
/// ```
255253
#[inline]

0 commit comments

Comments
 (0)