]> git.lizzy.rs Git - rust.git/commitdiff
Fix various nits from PR review
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Mon, 9 Apr 2018 21:23:08 +0000 (14:23 -0700)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Mon, 9 Apr 2018 21:23:08 +0000 (14:23 -0700)
- Remove redundant "unsafe" from module description.
- Add a missing `Safety` heading to `read_unaligned`.
- Remove weasel words in `Undefined Behavior` description for
  `write{,_unaligned,_bytes}`.

src/libcore/ptr.rs

index 962fb0f31a407625207df356c87eb2ad5a8dd53b..3d15e4b165893ecb39197c42c4fe91777a710b74 100644 (file)
@@ -10,7 +10,7 @@
 
 // FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
 
-//! Manually manage memory through raw, unsafe pointers.
+//! Manually manage memory through raw pointers.
 //!
 //! *[See also the pointer primitive types](../../std/primitive.pointer.html).*
 
@@ -438,6 +438,8 @@ pub unsafe fn read<T>(src: *const T) -> T {
 ///
 /// [`read`]: ./fn.read.html
 ///
+/// # Safety
+///
 /// `read_unaligned` is unsafe because it dereferences a raw pointer. The caller
 /// must ensure that the pointer points to a valid value of type `T`.
 ///
@@ -525,8 +527,7 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
 ///
 /// # Undefined Behavior
 ///
-/// `write` can trigger undefined behavior if any of the following conditions
-/// are violated:
+/// Behavior is undefined if any of the following conditions are violated:
 ///
 /// * `dst` must point to valid memory.
 ///
@@ -603,8 +604,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
 ///
 /// # Undefined Behavior
 ///
-/// `write_unaligned` can trigger undefined behavior if any of the following
-/// conditions are violated:
+/// Behavior is undefined if any of the following conditions are violated:
 ///
 /// * `dst` must point to valid memory.
 ///
@@ -745,8 +745,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
 ///
 /// # Undefined Behavior
 ///
-/// `write_volatile` can trigger undefined behavior if any of the following
-/// conditions are violated:
+/// Behavior is undefined if any of the following conditions are violated:
 ///
 /// * `dst` must point to valid memory.
 ///