1
Fork 0

Redefine range validity

Uses `x.offset(i)` must be valid for all `i` in `0..count`.
This commit is contained in:
Dylan MacKenzie 2018-06-15 22:33:00 -07:00 committed by Ralf Jung
parent e40585f248
commit ea5570cf27
2 changed files with 27 additions and 30 deletions

View file

@ -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.
///