This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ mod prim_never {}
283283/// `char` type. For technical reasons, there is additional, separate
284284/// documentation in [the `std::char` module](char/index.html) as well.
285285///
286- /// # Validity
286+ /// # Validity and Layout
287287///
288288/// A `char` is a '[Unicode scalar value]', which is any '[Unicode code point]'
289289/// other than a [surrogate code point]. This has a fixed numerical definition:
@@ -330,6 +330,13 @@ mod prim_never {}
330330/// ("noncharacters"); and some may be given different meanings by different
331331/// users ("private use").
332332///
333+ /// `char` is guaranteed to have the same size and alignment as `u32` on all
334+ /// platforms.
335+ /// ```
336+ /// use std::alloc::Layout;
337+ /// assert_eq!(Layout::new::<char>(), Layout::new::<u32>());
338+ /// ```
339+ ///
333340/// [Unicode code point]: https://www.unicode.org/glossary/#code_point
334341/// [Unicode scalar value]: https://www.unicode.org/glossary/#unicode_scalar_value
335342/// [non-exhaustive match]: ../book/ch06-02-match.html#matches-are-exhaustive
You can’t perform that action at this time.
0 commit comments