Skip to content

Commit

Permalink
Merge pull request #1401 from joshlf/patch-2
Browse files Browse the repository at this point in the history
Guarantee `char` layout
  • Loading branch information
ehuss authored Oct 30, 2023
2 parents ec979de + 192178f commit 8947db0
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 8947db0

Please sign in to comment.