Remove unsafe in Layout::pad_to_align

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

View File

@ -225,9 +225,7 @@ impl Layout {
// > `usize::MAX`)
let new_size = self.size() + pad;
// SAFETY: This necessarily respects the from_size_align
// prerequisites per the above.
unsafe { Layout::from_size_align_unchecked(new_size, self.align()) }
Layout::from_size_align(new_size, self.align()).unwrap()
}
/// Creates a layout describing the record for `n` instances of