Improve safety warning on ptr::swap
This commit is contained in:
parent
3191886426
commit
c547e08ce2
@ -74,7 +74,10 @@ pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
|
|||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// This is only unsafe because it accepts a raw pointer.
|
/// This function copies the memory through the raw pointers passed to it
|
||||||
|
/// as arguments, which means they will be dereferenced.
|
||||||
|
///
|
||||||
|
/// Ensure that these pointers are valid before calling `swap`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user