Skip to content

Commit 57a5319

Browse files
authored
Unrolled build for rust-lang#116894
Rollup merge of rust-lang#116894 - joshlf:patch-12, r=RalfJung Guarantee that `char` has the same size and alignment as `u32`
2 parents a42d94e + c278bc1 commit 57a5319

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/core/src/primitive_docs.rs

+8-1
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)