rust/src/liballoc
bors 4787e97475 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 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.
2019-12-03 01:50:33 +00:00
..
alloc Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
benches Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
collections Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
prelude Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
raw_vec Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
rc Add implementations for converting boxed slices into boxed arrays 2019-08-05 10:26:53 -04:00
sync Add implementations for converting boxed slices into boxed arrays 2019-08-05 10:26:53 -04:00
tests Rollup merge of #66890 - dtolnay:fmt4, r=Dylan-DPC 2019-12-01 04:49:31 +01:00
alloc.rs Snap cfgs to new beta 2019-09-25 08:42:46 -04:00
borrow.rs Add Cow::is_borrowed and Cow::is_owned 2019-10-22 19:56:41 -04:00
boxed.rs alloc: Add new_zeroed() versions like new_uninit(). 2019-11-05 19:27:42 +01:00
Cargo.toml bump rand to fix Miri failures 2019-08-04 14:50:26 +02:00
fmt.rs Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
lib.rs gate rustc_on_unimplemented under rustc_attrs 2019-11-06 07:34:51 +01:00
macros.rs Scope format! temporaries 2019-09-27 17:36:45 -04:00
raw_vec.rs Const-stabilize Vec::new. 2019-09-16 16:45:16 +02:00
rc.rs Auto merge of #66256 - CAD97:patch-2, r=RalfJung 2019-12-03 01:50:33 +00:00
slice.rs Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
str.rs Apply clippy::needless_return suggestions 2019-10-22 19:23:10 +02:00
string.rs Rollup merge of #66111 - RalfJung:from_raw_parts, r=Centril 2019-11-07 09:20:41 +09:00
sync.rs Auto merge of #66256 - CAD97:patch-2, r=RalfJung 2019-12-03 01:50:33 +00:00
tests.rs Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
vec.rs Rollup merge of #66759 - CAD97:patch-3, r=KodrAus 2019-11-30 16:56:49 +01:00