Skip to content

Commit 78f0dbb

Browse files
committed
alloc::Layout: explicitly document size invariant on the type level
1 parent 7b75def commit 78f0dbb

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)