rust/library/alloc/src
bors 69df0f2c2f Auto merge of #102991 - Sp00ph:master, r=scottmcm
Update VecDeque implementation to use head+len instead of head+tail

(See #99805)

This changes `alloc::collections::VecDeque`'s internal representation from using head and tail indices to using a head index and a length field. It has a few advantages over the current design:
* It allows the buffer to be of length 0, which means the `VecDeque::new` new longer has to allocate and could be changed to a `const fn`
* It allows the `VecDeque` to fill the buffer completely, unlike the old implementation, which always had to leave a free space
* It removes the restriction for the size to be a power of two, allowing it to properly `shrink_to_fit`, unlike the old `VecDeque`
* The above points also combine to allow the `Vec<T> -> VecDeque<T>` conversion to be very cheap and guaranteed O(1). I mention this in the `From<Vec<T>>` impl, but it's not a strong guarantee just yet, as that would likely need some form of API change proposal.

All the tests seem to pass for the new `VecDeque`, with some slight adjustments.

r? `@scottmcm`
2022-11-28 10:39:47 +00:00
..
alloc run alloc benchmarks in Miri and fix UB 2022-11-07 10:34:04 +01:00
boxed remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
collections Auto merge of #102991 - Sp00ph:master, r=scottmcm 2022-11-28 10:39:47 +00:00
ffi remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
raw_vec Add a unit test for zero-sized types in RawVec. 2021-11-26 19:30:45 +11:00
rc Use Box::new() instead of box syntax in alloc tests 2022-05-29 00:41:14 +02:00
sync add some Miri-only tests 2022-08-18 18:07:39 -04:00
vec Tune RepeatWith::try_fold and Take::for_each and Vec::extend_trusted 2022-11-24 19:14:19 -08:00
alloc.rs cfg-step code 2022-11-06 17:21:21 -05:00
borrow.rs Remove redundant lifetime bound from impl Borrow for Cow 2022-07-22 01:35:39 +02:00
boxed.rs Rollup merge of #101655 - dns2utf8:box_docs, r=dtolnay 2022-11-22 01:26:06 -05:00
fmt.rs Detect and reject out-of-range integers in format string literals 2022-10-01 01:05:01 +02:00
lib.rs Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc 2022-11-22 22:54:41 -05:00
macros.rs Extra documentation for new formatting feature 2022-08-21 15:28:27 -04:00
raw_vec.rs Make ZST checks in core/alloc more readable 2022-09-22 23:12:29 -07:00
rc.rs Rollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum 2022-11-20 23:50:26 +01:00
slice.rs rustdoc: Add copy to the description of repeat 2022-11-14 15:21:02 +01:00
str.rs Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum 2022-08-22 11:45:40 +05:30
string.rs Rm diagnostic item, use lang item 2022-11-18 06:16:20 +00:00
sync.rs Rollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum 2022-11-20 23:50:26 +01:00
task.rs Document the conditional existence of alloc::sync and alloc::task. 2022-06-17 20:03:23 -07:00
tests.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00