avoid shadowing; fix examples
This commit is contained in:
parent
e869b81b93
commit
d97f61f10e
1 changed files with 4 additions and 4 deletions
|
@ -1017,13 +1017,13 @@ extern "rust-intrinsic" {
|
||||||
/// unsafe {
|
/// unsafe {
|
||||||
/// // The call to offset is always safe because `Vec` will never
|
/// // The call to offset is always safe because `Vec` will never
|
||||||
/// // allocate more than `isize::MAX` bytes.
|
/// // allocate more than `isize::MAX` bytes.
|
||||||
/// let dst = dst.as_mut_ptr().offset(dst_len as isize);
|
/// let dst_ptr = dst.as_mut_ptr().offset(dst_len as isize);
|
||||||
/// let src = src.as_ptr();
|
/// let src_ptr = src.as_ptr();
|
||||||
///
|
///
|
||||||
/// // The two regions cannot overlap becuase mutable references do
|
/// // The two regions cannot overlap becuase mutable references do
|
||||||
/// // not alias, and two different vectors cannot own the same
|
/// // not alias, and two different vectors cannot own the same
|
||||||
/// // memory.
|
/// // memory.
|
||||||
/// ptr::copy_nonoverlapping(src, dst, src_len);
|
/// ptr::copy_nonoverlapping(src_ptr, dst_ptr, src_len);
|
||||||
///
|
///
|
||||||
/// // Truncate `src` without dropping its contents. This cannot panic,
|
/// // Truncate `src` without dropping its contents. This cannot panic,
|
||||||
/// // so double-drops cannot happen.
|
/// // so double-drops cannot happen.
|
||||||
|
@ -1145,7 +1145,7 @@ extern "rust-intrinsic" {
|
||||||
/// Creating an invalid value:
|
/// Creating an invalid value:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::ptr;
|
/// use std::{mem, ptr};
|
||||||
///
|
///
|
||||||
/// let mut v = Box::new(0i32);
|
/// let mut v = Box::new(0i32);
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue