zero-sized accesses are fine on null pointers · qinheping/verify-rust-std@aabdd7d (original) (raw)
`@@ -1024,7 +1024,7 @@ pub const fn slice_from_raw_parts_mut(data: *mut T, len: usize) -> *mut [T] {
`
1024
1024
`///
`
1025
1025
`` /// * Both x
and y
must be properly aligned.
``
1026
1026
`///
`
1027
``
`` -
/// Note that even if T
has size 0
, the pointers must be non-null and properly aligned.
``
``
1027
`` +
/// Note that even if T
has size 0
, the pointers must be properly aligned.
``
1028
1028
`///
`
1029
1029
`/// [valid]: self#safety
`
1030
1030
`///
`
`@@ -1110,7 +1110,7 @@ pub const unsafe fn swap(x: *mut T, y: *mut T) {
`
1110
1110
`` /// beginning at y
with the same size.
``
1111
1111
`///
`
1112
1112
`` /// Note that even if the effectively copied size (count * size_of::<T>()
) is 0
,
``
1113
``
`-
/// the pointers must be non-null and properly aligned.
`
``
1113
`+
/// the pointers must be properly aligned.
`
1114
1114
`///
`
1115
1115
`/// [valid]: self#safety
`
1116
1116
`///
`
`@@ -1243,7 +1243,7 @@ const unsafe fn swap_nonoverlapping_simple_untyped(x: *mut T, y: *mut T, coun
`
1243
1243
`///
`
1244
1244
`` /// * dst
must point to a properly initialized value of type T
.
``
1245
1245
`///
`
1246
``
`` -
/// Note that even if T
has size 0
, the pointer must be non-null and properly aligned.
``
``
1246
`` +
/// Note that even if T
has size 0
, the pointer must be properly aligned.
``
1247
1247
`///
`
1248
1248
`/// [valid]: self#safety
`
1249
1249
`///
`
`@@ -1300,7 +1300,7 @@ pub const unsafe fn replace(dst: *mut T, src: T) -> T {
`
1300
1300
`///
`
1301
1301
`` /// * src
must point to a properly initialized value of type T
.
``
1302
1302
`///
`
1303
``
`` -
/// Note that even if T
has size 0
, the pointer must be non-null and properly aligned.
``
``
1303
`` +
/// Note that even if T
has size 0
, the pointer must be properly aligned.
``
1304
1304
`///
`
1305
1305
`/// # Examples
`
1306
1306
`///
`
`@@ -1555,7 +1555,7 @@ pub const unsafe fn read_unaligned(src: *const T) -> T {
`
1555
1555
`` /// * dst
must be properly aligned. Use [write_unaligned
] if this is not the
``
1556
1556
`/// case.
`
1557
1557
`///
`
1558
``
`` -
/// Note that even if T
has size 0
, the pointer must be non-null and properly aligned.
``
``
1558
`` +
/// Note that even if T
has size 0
, the pointer must be properly aligned.
``
1559
1559
`///
`
1560
1560
`/// [valid]: self#safety
`
1561
1561
`///
`
`@@ -1774,7 +1774,7 @@ pub const unsafe fn write_unaligned(dst: *mut T, src: T) {
`
1774
1774
`` /// However, storing non-[Copy
] types in volatile memory is almost certainly
``
1775
1775
`/// incorrect.
`
1776
1776
`///
`
1777
``
`` -
/// Note that even if T
has size 0
, the pointer must be non-null and properly aligned.
``
``
1777
`` +
/// Note that even if T
has size 0
, the pointer must be properly aligned.
``
1778
1778
`///
`
1779
1779
`/// [valid]: self#safety
`
1780
1780
`/// [read-ownership]: read#ownership-of-the-returned-value
`
`@@ -1853,7 +1853,7 @@ pub unsafe fn read_volatile(src: *const T) -> T {
`
1853
1853
`///
`
1854
1854
`` /// * dst
must be properly aligned.
``
1855
1855
`///
`
1856
``
`` -
/// Note that even if T
has size 0
, the pointer must be non-null and properly aligned.
``
``
1856
`` +
/// Note that even if T
has size 0
, the pointer must be properly aligned.
``
1857
1857
`///
`
1858
1858
`/// [valid]: self#safety
`
1859
1859
`///
`