Redefine range validity
Uses `x.offset(i)` must be valid for all `i` in `0..count`.
This commit is contained in:
parent
e40585f248
commit
ea5570cf27
2 changed files with 27 additions and 30 deletions
|
@ -976,17 +976,17 @@ extern "rust-intrinsic" {
|
|||
///
|
||||
/// Behavior is undefined if any of the following conditions are violated:
|
||||
///
|
||||
/// * Both `src` and `dst` must be [valid].
|
||||
///
|
||||
/// * Both `src` and `dst` must be properly aligned.
|
||||
///
|
||||
/// * `src.offset(count-1)` must be [valid]. In other words, the region of
|
||||
/// memory which begins at `src` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
/// * `src.offset(i)` must be [valid] for all `i` in `0..count`. In other
|
||||
/// words, the region of memory which begins at `src` and has a length of
|
||||
/// `count * size_of::<T>()` bytes must belong to a single, live
|
||||
/// allocation.
|
||||
///
|
||||
/// * `dst.offset(count-1)` must be [valid]. In other words, the region of
|
||||
/// memory which begins at `dst` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
/// * `dst.offset(i)` must be [valid] for all `i` in `0..count`. In other
|
||||
/// words, the region of memory which begins at `dst` and has a length of
|
||||
/// `count * size_of::<T>()` bytes must belong to a single, live
|
||||
/// allocation.
|
||||
///
|
||||
/// * The two regions of memory must *not* overlap.
|
||||
///
|
||||
|
@ -1064,17 +1064,17 @@ extern "rust-intrinsic" {
|
|||
///
|
||||
/// Behavior is undefined if any of the following conditions are violated:
|
||||
///
|
||||
/// * Both `src` and `dst` must be [valid].
|
||||
///
|
||||
/// * Both `src` and `dst` must be properly aligned.
|
||||
///
|
||||
/// * `src.offset(count-1)` must be [valid]. In other words, the region of
|
||||
/// memory which begins at `src` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
/// * `src.offset(i)` must be [valid] for all `i` in `0..count`. In other
|
||||
/// words, the region of memory which begins at `src` and has a length of
|
||||
/// `count * size_of::<T>()` bytes must belong to a single, live
|
||||
/// allocation.
|
||||
///
|
||||
/// * `dst.offset(count-1)` must be [valid]. In other words, the region of
|
||||
/// memory which begins at `dst` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
/// * `dst.offset(i)` must be [valid] for all `i` in `0..count`. In other
|
||||
/// words, the region of memory which begins at `dst` and has a length of
|
||||
/// `count * size_of::<T>()` bytes must belong to a single, live
|
||||
/// allocation.
|
||||
///
|
||||
/// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
|
||||
|
@ -1116,14 +1116,13 @@ extern "rust-intrinsic" {
|
|||
///
|
||||
/// Behavior is undefined if any of the following conditions are violated:
|
||||
///
|
||||
/// * `dst` must be [valid].
|
||||
///
|
||||
/// * `dst.offset(count-1)` must be [valid]. In other words, the region of
|
||||
/// memory which begins at `dst` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
///
|
||||
/// * `dst` must be properly aligned.
|
||||
///
|
||||
/// * `dst.offset(i)` must be [valid] for all `i` in `0..count`. In other
|
||||
/// words, the region of memory which begins at `dst` and has a length of
|
||||
/// `count * size_of::<T>()` bytes must belong to a single, live
|
||||
/// allocation.
|
||||
///
|
||||
/// Additionally, the caller must ensure that writing `count *
|
||||
/// size_of::<T>()` bytes to the given region of memory results in a valid
|
||||
/// value of `T`. Creating an invalid value of `T` can result in undefined
|
||||
|
|
|
@ -240,17 +240,15 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
|||
///
|
||||
/// Behavior is undefined if any of the following conditions are violated:
|
||||
///
|
||||
/// * Both `x` and `y` must be [valid].
|
||||
///
|
||||
/// * Both `x` and `y` must be properly aligned.
|
||||
///
|
||||
/// * `x.offset(count-1)` must be [valid]. In other words, the region of memory
|
||||
/// which begins at `x` and has a length of `count * size_of::<T>()` bytes
|
||||
/// must belong to a single, live allocation.
|
||||
/// * `x.offset(i)` must be [valid] for all `i` in `0..count`. In other words,
|
||||
/// the region of memory which begins at `x` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
///
|
||||
/// * `y.offset(count-1)` must be [valid]. In other words, the region of memory
|
||||
/// which begins at `y` and has a length of `count * size_of::<T>()` bytes
|
||||
/// must belong to a single, live allocation.
|
||||
/// * `y.offset(i)` must be [valid] for all `i` in `0..count`. In other words,
|
||||
/// the region of memory which begins at `y` and has a length of `count *
|
||||
/// size_of::<T>()` bytes must belong to a single, live allocation.
|
||||
///
|
||||
/// * The two regions of memory must *not* overlap.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue