Skip to content

Commit aee21e2

Browse files
committed
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
2 parents 7265b93 + 95fe6ac commit aee21e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcore/ptr.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
7474
///
7575
/// # Safety
7676
///
77-
/// This is only unsafe because it accepts a raw pointer.
77+
/// This function copies the memory through the raw pointers passed to it
78+
/// as arguments.
79+
///
80+
/// Ensure that these pointers are valid before calling `swap`.
7881
#[inline]
7982
#[stable(feature = "rust1", since = "1.0.0")]
8083
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {

0 commit comments

Comments
 (0)