We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
unchecked_add
Layout::repeat
1 parent b135c73 commit 94045daCopy full SHA for 94045da
src/libcore/alloc.rs
@@ -239,7 +239,9 @@ impl Layout {
239
// > `size`, when rounded up to the nearest multiple of `align`,
240
// > must not overflow (i.e., the rounded value must be less than
241
// > `usize::MAX`)
242
- let padded_size = self.size() + self.padding_needed_for(self.align());
+ let padded_size = unsafe {
243
+ crate::intrinsics::unchecked_add(self.size(), self.padding_needed_for(self.align()))
244
+ };
245
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutErr { private: () })?;
246
247
unsafe {
0 commit comments