We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd3594b commit 183e61bCopy full SHA for 183e61b
src/libcore/alloc.rs
@@ -224,9 +224,10 @@ impl Layout {
224
// > must not overflow (i.e., the rounded value must be less than
225
// > `usize::MAX`)
226
let new_size = self.size() + pad;
227
- debug_assert!(new_size > self.size());
228
229
- Layout::from_size_align(new_size, self.align())
+ // SAFETY: This necessarily respectes the from_size_align
+ // prerequisites per the above.
230
+ unsafe { Layout::from_size_align_unchecked(new_size, self.align()) }
231
}
232
233
/// Creates a layout describing the record for `n` instances of
0 commit comments