From d7209d5babae4e1e428771287eaca6165e43972c Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Mon, 9 Apr 2018 14:23:08 -0700 Subject: [PATCH] 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}`. --- src/libcore/ptr.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 962fb0f31a40..3d15e4b16589 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(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(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(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(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. ///