Skip to content

Commit

Permalink
Unrolled build for rust-lang#123048
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rust-timer committed Apr 23, 2024
2 parents cd90d5c + 7731135 commit 576bea1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/core/src/alloc/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const fn size_align<T>() -> (usize, usize) {
/// An instance of `Layout` describes a particular layout of memory.
/// You build a `Layout` up as an input to give to an allocator.
///
/// All layouts have an associated size and a power-of-two alignment.
/// All layouts have an associated size and a power-of-two alignment. The size, when rounded up to
/// the nearest multiple of `align`, does not overflow isize (i.e., the rounded value will always be
/// less than or equal to `isize::MAX`).
///
/// (Note that layouts are *not* required to have non-zero size,
/// even though `GlobalAlloc` requires that all memory requests
Expand Down

0 comments on commit 576bea1

Please sign in to comment.