Skip to content

Commit d7209d5

Browse files
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}`.
1 parent d7ce9a2 commit d7209d5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/libcore/ptr.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
1212

13-
//! Manually manage memory through raw, unsafe pointers.
13+
//! Manually manage memory through raw pointers.
1414
//!
1515
//! *[See also the pointer primitive types](../../std/primitive.pointer.html).*
1616
@@ -438,6 +438,8 @@ pub unsafe fn read<T>(src: *const T) -> T {
438438
///
439439
/// [`read`]: ./fn.read.html
440440
///
441+
/// # Safety
442+
///
441443
/// `read_unaligned` is unsafe because it dereferences a raw pointer. The caller
442444
/// must ensure that the pointer points to a valid value of type `T`.
443445
///
@@ -525,8 +527,7 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
525527
///
526528
/// # Undefined Behavior
527529
///
528-
/// `write` can trigger undefined behavior if any of the following conditions
529-
/// are violated:
530+
/// Behavior is undefined if any of the following conditions are violated:
530531
///
531532
/// * `dst` must point to valid memory.
532533
///
@@ -603,8 +604,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
603604
///
604605
/// # Undefined Behavior
605606
///
606-
/// `write_unaligned` can trigger undefined behavior if any of the following
607-
/// conditions are violated:
607+
/// Behavior is undefined if any of the following conditions are violated:
608608
///
609609
/// * `dst` must point to valid memory.
610610
///
@@ -745,8 +745,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
745745
///
746746
/// # Undefined Behavior
747747
///
748-
/// `write_volatile` can trigger undefined behavior if any of the following
749-
/// conditions are violated:
748+
/// Behavior is undefined if any of the following conditions are violated:
750749
///
751750
/// * `dst` must point to valid memory.
752751
///

0 commit comments

Comments
 (0)