Skip to content

Commit d97f61f

Browse files
committed
avoid shadowing; fix examples
1 parent e869b81 commit d97f61f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/intrinsics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,13 +1017,13 @@ extern "rust-intrinsic" {
10171017
/// unsafe {
10181018
/// // The call to offset is always safe because `Vec` will never
10191019
/// // allocate more than `isize::MAX` bytes.
1020-
/// let dst = dst.as_mut_ptr().offset(dst_len as isize);
1021-
/// let src = src.as_ptr();
1020+
/// let dst_ptr = dst.as_mut_ptr().offset(dst_len as isize);
1021+
/// let src_ptr = src.as_ptr();
10221022
///
10231023
/// // The two regions cannot overlap becuase mutable references do
10241024
/// // not alias, and two different vectors cannot own the same
10251025
/// // memory.
1026-
/// ptr::copy_nonoverlapping(src, dst, src_len);
1026+
/// ptr::copy_nonoverlapping(src_ptr, dst_ptr, src_len);
10271027
///
10281028
/// // Truncate `src` without dropping its contents. This cannot panic,
10291029
/// // so double-drops cannot happen.
@@ -1145,7 +1145,7 @@ extern "rust-intrinsic" {
11451145
/// Creating an invalid value:
11461146
///
11471147
/// ```
1148-
/// use std::ptr;
1148+
/// use std::{mem, ptr};
11491149
///
11501150
/// let mut v = Box::new(0i32);
11511151
///

0 commit comments

Comments
 (0)