diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2018-04-09 14:23:08 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2018-04-09 14:23:08 -0700 |
| commit | d7209d5babae4e1e428771287eaca6165e43972c (patch) | |
| tree | 3827de66ddfe8079aa2edb4628b5bf500407fb01 | |
| parent | d7ce9a213c11f825b8b47f7d9fd970cfb97033bd (diff) | |
| download | rust-d7209d5babae4e1e428771287eaca6165e43972c.tar.gz rust-d7209d5babae4e1e428771287eaca6165e43972c.zip | |
Fix various nits from PR review
- 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}`.
| -rw-r--r-- | src/libcore/ptr.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 962fb0f31a4..3d15e4b1658 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -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. /// |
