File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ mod prim_never {}
283
283
/// `char` type. For technical reasons, there is additional, separate
284
284
/// documentation in [the `std::char` module](char/index.html) as well.
285
285
///
286
- /// # Validity
286
+ /// # Validity and Layout
287
287
///
288
288
/// A `char` is a '[Unicode scalar value]', which is any '[Unicode code point]'
289
289
/// other than a [surrogate code point]. This has a fixed numerical definition:
@@ -330,6 +330,13 @@ mod prim_never {}
330
330
/// ("noncharacters"); and some may be given different meanings by different
331
331
/// users ("private use").
332
332
///
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
+ ///
333
340
/// [Unicode code point]: https://www.unicode.org/glossary/#code_point
334
341
/// [Unicode scalar value]: https://www.unicode.org/glossary/#unicode_scalar_value
335
342
/// [non-exhaustive match]: ../book/ch06-02-match.html#matches-are-exhaustive
You can’t perform that action at this time.
0 commit comments