Commit 852440b
authored
Rollup merge of rust-lang#134953 - DiuDiu777:unaligned-doc, r=RalfJung
Fix doc for read&write unaligned in zst operation
### PR Description
This PR addresses an inconsistency in the Rust documentation regarding `read_unaligned ` and `write_unaligned` on zero-sized types (ZSTs). The current documentation for [pointer validity](https://doc.rust-lang.org/nightly/std/ptr/index.html#safety) states that for zero-sized types (ZSTs), null pointers are valid:
> For zero-sized types (ZSTs), every pointer is valid, including the null pointer.
However, there is an inconsistency in the documentation for the unaligned read operation in the function [ptr::read_unaligned](https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html)(as well as `write_unaligned`), which states:
> Note that even if T has size 0, the pointer must be non-null.
This change is also supported by [PR rust-lang#134912](rust-lang#134912)
> the _unaligned method docs should be fixed.1 file changed
+0
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1403 | 1403 | | |
1404 | 1404 | | |
1405 | 1405 | | |
1406 | | - | |
1407 | | - | |
1408 | 1406 | | |
1409 | 1407 | | |
1410 | 1408 | | |
| |||
1611 | 1609 | | |
1612 | 1610 | | |
1613 | 1611 | | |
1614 | | - | |
1615 | | - | |
1616 | 1612 | | |
1617 | 1613 | | |
1618 | 1614 | | |
| |||
0 commit comments