Skip to content

Commit eb97638

Browse files
authored
Rollup merge of rust-lang#123048 - RalfJung:layout, r=dtolnay
alloc::Layout: explicitly document size invariant on the type level rust-lang#95295 added this to the constructor, but it seems worth documenting the type invariant at the type level.
2 parents 50a633b + 78f0dbb commit eb97638

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/alloc/layout.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const fn size_align<T>() -> (usize, usize) {
2525
/// An instance of `Layout` describes a particular layout of memory.
2626
/// You build a `Layout` up as an input to give to an allocator.
2727
///
28-
/// All layouts have an associated size and a power-of-two alignment.
28+
/// All layouts have an associated size and a power-of-two alignment. The size, when rounded up to
29+
/// the nearest multiple of `align`, does not overflow isize (i.e., the rounded value will always be
30+
/// less than or equal to `isize::MAX`).
2931
///
3032
/// (Note that layouts are *not* required to have non-zero size,
3133
/// even though `GlobalAlloc` requires that all memory requests

0 commit comments

Comments
 (0)