Skip to content

Commit 183e61b

Browse files
authored
Fix Layout::pad_to_align type mismatch
1 parent fd3594b commit 183e61b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/alloc.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,10 @@ impl Layout {
224224
// > must not overflow (i.e., the rounded value must be less than
225225
// > `usize::MAX`)
226226
let new_size = self.size() + pad;
227-
debug_assert!(new_size > self.size());
228227

229-
Layout::from_size_align(new_size, self.align())
228+
// SAFETY: This necessarily respectes the from_size_align
229+
// prerequisites per the above.
230+
unsafe { Layout::from_size_align_unchecked(new_size, self.align()) }
230231
}
231232

232233
/// Creates a layout describing the record for `n` instances of

0 commit comments

Comments
 (0)