diff options
| -rw-r--r-- | library/core/src/intrinsics.rs | 11 | ||||
| -rw-r--r-- | library/core/src/ptr/mod.rs | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 84b9a3bba88..f7469008d7c 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -2705,12 +2705,13 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us /// /// Behavior is undefined if any of the following conditions are violated: /// -/// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes. -/// -/// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes. +/// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes, and must remain valid even +/// if `dst` is written for `count * size_of::<T>()` bytes. (This means if the memory ranges +/// overlap, the two pointers must not be subject to aliasing restrictions relative to each +/// other.) /// -/// * `src` must remain valid for reads even after `dst` is written, and vice versa. -/// (In other words, there cannot be aliasing restrictions on the use of these pointers.) +/// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes, and must remain valid even +/// if `src` is read for `count * size_of::<T>()` bytes. /// /// * Both `src` and `dst` must be properly aligned. /// diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index f8badc4130d..69d775075f3 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -795,10 +795,9 @@ pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] { /// /// Behavior is undefined if any of the following conditions are violated: /// -/// * Both `x` and `y` must be [valid] for both reads and writes. -/// -/// * `x` must remain valid for reads and writes even after `y` is read/written, and vice versa. -/// (In other words, there cannot be aliasing restrictions on the use of these pointers.) +/// * Both `x` and `y` must be [valid] for both reads and writes. They must remain valid even if the +/// other pointer is written. (This means if the memory ranges overlap, the two pointers must not +/// be subject to aliasing restrictions relative to each other.) /// /// * Both `x` and `y` must be properly aligned. /// |
