Function pre::core::ptr::swap [−][src]
pub unsafe fn swap<T>(x: *mut T, y: *mut T)
Expand description
core::ptr::swap
with preconditions.
This function behaves exactly like core::ptr::swap
, but also has preconditions checked by pre
.
You should also read the Safety section on the documentation of core::ptr::swap
.
This function has preconditions
This function has the following preconditions generated by pre
attributes:
- the pointer
x
must be valid for reads and writes - the pointer
y
must be valid for reads and writes - the pointer
x
must have a proper alignment for its type - the pointer
y
must have a proper alignment for its type
To call the function you need to assure
that the preconditions hold:
ⓘ
#[assure(
valid_ptr(x, r+w),
reason = "<specify the reason why you can assure this here>"
)]
#[assure(
valid_ptr(y, r+w),
reason = "<specify the reason why you can assure this here>"
)]
#[assure(
proper_align(x),
reason = "<specify the reason why you can assure this here>"
)]
#[assure(
proper_align(y),
reason = "<specify the reason why you can assure this here>"
)]
swap(/* parameters omitted */);