diff options
| author | bors <bors@rust-lang.org> | 2019-12-03 01:50:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-03 01:50:33 +0000 |
| commit | 4787e97475de6be9487e3d9255a9c2d3c0bf9252 (patch) | |
| tree | 1392d3c24ff90ef3424c873bd51b4cca055c6c62 /src/test/debuginfo/enum-thinlto.rs | |
| parent | fdc0011561c6365c596dfd8fa1ef388162bc89c7 (diff) | |
| parent | d1e53da80992d27073b3e918bd56d6c0692f160c (diff) | |
| download | rust-4787e97475de6be9487e3d9255a9c2d3c0bf9252.tar.gz rust-4787e97475de6be9487e3d9255a9c2d3c0bf9252.zip | |
Auto merge of #66256 - CAD97:patch-2, r=RalfJung
Layout::pad_to_align is infallible As per [this comment](https://github.com/rust-lang/rust/issues/55724#issuecomment-441421651) (cc @glandium). > Per https://github.com/rust-lang/rust/blob/eb981a1/src/libcore/alloc.rs#L63-L65, `layout.size()` is always <= `usize::MAX - (layout.align() - 1)`. > > Which means: > > * The maximum value `layout.size()` can have is already aligned for `layout.align()` (`layout.align()` being a power of two, `usize::MAX - (layout.align() - 1)` is a multiple of `layout.align()`) > * Incidentally, any value smaller than that maximum value will align at most to that maximum value. > > IOW, `pad_to_align` can not return `Err(LayoutErr)`, except for the layout not respecting its invariants, but we shouldn't care about that. This PR makes `pad_to_align` return `Layout` directly, representing the fact that it cannot fail.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
