1
Fork 0

Clarify Layout::pad_to_align safety comment

This commit is contained in:
Christopher Durham 2019-11-25 16:39:24 -05:00 committed by GitHub
parent 6773064b05
commit d1e53da809
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,7 @@ impl Layout {
#[inline]
pub fn pad_to_align(&self) -> Layout {
let pad = self.padding_needed_for(self.align());
// This cannot overflow: it is an invariant of Layout that
// This cannot overflow. Quoting from the invariant of Layout:
// > `size`, when rounded up to the nearest multiple of `align`,
// > must not overflow (i.e., the rounded value must be less than
// > `usize::MAX`)