Skip to content

Commit 8947db0

Browse files
authored
Merge pull request #1401 from joshlf/patch-2
Guarantee `char` layout
2 parents ec979de + 192178f commit 8947db0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/types/textual.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ is valid UTF-8. Calling a `str` method with a non-UTF-8 buffer can cause
1717
Since `str` is a [dynamically sized type], it can only be instantiated through a
1818
pointer type, such as `&str`.
1919

20-
## Bit validity
20+
## Layout and bit validity
21+
22+
`char` is guaranteed to have the same size and alignment as `u32` on all platforms.
2123

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

0 commit comments

Comments
 (0)