diff options
| author | bors <bors@rust-lang.org> | 2017-01-09 02:59:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-01-09 02:59:33 +0000 |
| commit | aee21e2594c0dfe07f074be0da95c95b5b65ed50 (patch) | |
| tree | de00c05d938f8d17038e8b729166877edc7378bf | |
| parent | 7265b938425135702fb2aea9874afca1d3b4c5be (diff) | |
| parent | 95fe6ac14f659b05ecaabf85713f3fc4d0019010 (diff) | |
| download | rust-aee21e2594c0dfe07f074be0da95c95b5b65ed50.tar.gz rust-aee21e2594c0dfe07f074be0da95c95b5b65ed50.zip | |
Auto merge of #38910 - steveklabnik:update_docs, r=eddyb
Improve safety warning on ptr::swap r? @eddyb @bluss , who I asked about this on IRC
| -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..bf5a59c45e4 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. +/// +/// 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) { |
