We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Layout::pad_to_align
1 parent 8a48b37 commit 026edbbCopy full SHA for 026edbb
library/core/src/alloc/layout.rs
@@ -281,7 +281,9 @@ impl Layout {
281
// > `usize::MAX`)
282
let new_size = self.size() + pad;
283
284
- Layout::from_size_align(new_size, self.align()).unwrap()
+ // SAFETY: self.align is already known to be valid and new_size has been
285
+ // padded already.
286
+ unsafe { Layout::from_size_align_unchecked(new_size, self.align()) }
287
}
288
289
/// Creates a layout describing the record for `n` instances of
0 commit comments