diff options
| author | Christopher Durham <cad97@cad97.com> | 2019-11-09 15:28:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-09 15:28:32 -0500 |
| commit | 183e61b66174e76520b38cf5153f8fb6f5cdce94 (patch) | |
| tree | a9f767f10adc57c8bcd48058b1b9bd914a8978d3 | |
| parent | fd3594b9ee56a288058de0b3e9d2aa5098e98944 (diff) | |
| download | rust-183e61b66174e76520b38cf5153f8fb6f5cdce94.tar.gz rust-183e61b66174e76520b38cf5153f8fb6f5cdce94.zip | |
Fix Layout::pad_to_align type mismatch
| -rw-r--r-- | src/libcore/alloc.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index c6d18b04a31..7d621090f07 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -224,9 +224,10 @@ impl Layout { // > must not overflow (i.e., the rounded value must be less than // > `usize::MAX`) let new_size = self.size() + pad; - debug_assert!(new_size > self.size()); - Layout::from_size_align(new_size, self.align()) + // SAFETY: This necessarily respectes the from_size_align + // prerequisites per the above. + unsafe { Layout::from_size_align_unchecked(new_size, self.align()) } } /// Creates a layout describing the record for `n` instances of |
