Improve safety warning on ptr::swap
This commit is contained in:
parent
3191886426
commit
c547e08ce2
1 changed files with 4 additions and 1 deletions
|
|
@ -74,7 +74,10 @@ pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
|
|||
///
|
||||
/// # 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]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue