Skip to content

Commit 0188b9c

Browse files
committed
try to clarify wording
1 parent b9c15c5 commit 0188b9c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

library/core/src/intrinsics.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -2705,12 +2705,13 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
27052705
///
27062706
/// Behavior is undefined if any of the following conditions are violated:
27072707
///
2708-
/// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes.
2709-
///
2710-
/// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes.
2708+
/// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes, and must remain valid even
2709+
/// if `dst` is written for `count * size_of::<T>()` bytes. (This means if the memory ranges
2710+
/// overlap, the two pointers must not be subject to aliasing restrictions relative to each
2711+
/// other.)
27112712
///
2712-
/// * `src` must remain valid for reads even after `dst` is written, and vice versa.
2713-
/// (In other words, there cannot be aliasing restrictions on the use of these pointers.)
2713+
/// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes, and must remain valid even
2714+
/// if `src` is read for `count * size_of::<T>()` bytes.
27142715
///
27152716
/// * Both `src` and `dst` must be properly aligned.
27162717
///

library/core/src/ptr/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -795,10 +795,9 @@ pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] {
795795
///
796796
/// Behavior is undefined if any of the following conditions are violated:
797797
///
798-
/// * Both `x` and `y` must be [valid] for both reads and writes.
799-
///
800-
/// * `x` must remain valid for reads and writes even after `y` is read/written, and vice versa.
801-
/// (In other words, there cannot be aliasing restrictions on the use of these pointers.)
798+
/// * Both `x` and `y` must be [valid] for both reads and writes. They must remain valid even if the
799+
/// other pointer is written. (This means if the memory ranges overlap, the two pointers must not
800+
/// be subject to aliasing restrictions relative to each other.)
802801
///
803802
/// * Both `x` and `y` must be properly aligned.
804803
///

0 commit comments

Comments
 (0)