diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2017-01-07 13:41:16 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2017-01-07 13:41:16 -0500 |
| commit | c547e08ce20516253c781f6fe1eb26a5bfe2ef56 (patch) | |
| tree | 2b27638879b3ca598088504ca3c156103b8452d4 /src/libcore | |
| parent | 31918864261c9fde79df1f84c5f22ab40b115ca9 (diff) | |
| download | rust-c547e08ce20516253c781f6fe1eb26a5bfe2ef56.tar.gz rust-c547e08ce20516253c781f6fe1eb26a5bfe2ef56.zip | |
Improve safety warning on ptr::swap
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/ptr.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index e3ca8eca76c..0aa8e4319ce 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -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) { |
