Clarify Layout::pad_to_align safety comment
This commit is contained in:
committed by
GitHub
parent
6773064b05
commit
d1e53da809
@@ -219,7 +219,7 @@ impl Layout {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn pad_to_align(&self) -> Layout {
|
pub fn pad_to_align(&self) -> Layout {
|
||||||
let pad = self.padding_needed_for(self.align());
|
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`,
|
// > `size`, when rounded up to the nearest multiple of `align`,
|
||||||
// > must not overflow (i.e., the rounded value must be less than
|
// > must not overflow (i.e., the rounded value must be less than
|
||||||
// > `usize::MAX`)
|
// > `usize::MAX`)
|
||||||
|
|||||||
Reference in New Issue
Block a user