Skip to content

Commit

Permalink
Guarantee char layout
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlf authored Sep 11, 2023
1 parent ee7c676 commit 192178f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/types/textual.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ is valid UTF-8. Calling a `str` method with a non-UTF-8 buffer can cause
Since `str` is a [dynamically sized type], it can only be instantiated through a
pointer type, such as `&str`.

## Bit validity
## Layout and bit validity

`char` is guaranteed to have the same size and alignment as `u32` on all platforms.

Every byte of a `char` is guaranteed to be initialized (in other words,
`transmute::<char, [u8; size_of::<char>()]>(...)` is always sound -- but since
Expand Down

0 comments on commit 192178f

Please sign in to comment.