@@ -475,6 +475,8 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
475
475
///
476
476
/// * `dst` must be properly aligned.
477
477
///
478
+ /// * `dst` must point to a properly initialized value of type `T`.
479
+ ///
478
480
/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
479
481
///
480
482
/// [valid]: ../ptr/index.html#safety
@@ -514,6 +516,8 @@ pub unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
514
516
/// * `src` must be properly aligned. Use [`read_unaligned`] if this is not the
515
517
/// case.
516
518
///
519
+ /// * `src` must point to a properly initialized value of type `T`.
520
+ ///
517
521
/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
518
522
///
519
523
/// # Examples
@@ -628,6 +632,8 @@ pub unsafe fn read<T>(src: *const T) -> T {
628
632
///
629
633
/// * `src` must be [valid] for reads.
630
634
///
635
+ /// * `src` must point to a properly initialized value of type `T`.
636
+ ///
631
637
/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of
632
638
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
633
639
/// value and the value at `*src` can [violate memory safety][read-ownership].
@@ -922,6 +928,8 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
922
928
///
923
929
/// * `src` must be properly aligned.
924
930
///
931
+ /// * `src` must point to a properly initialized value of type `T`.
932
+ ///
925
933
/// Like [`read`], `read_volatile` creates a bitwise copy of `T`, regardless of
926
934
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
927
935
/// value and the value at `*src` can [violate memory safety][read-ownership].
0 commit comments