about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-11-28 10:39:47 +0000
committerbors <bors@rust-lang.org>2022-11-28 10:39:47 +0000
commit69df0f2c2f665d7f4e38a3579a81d4efc0d81034 (patch)
tree199e0c08da4797bc751be3c286ff9937fa64e52b /compiler/rustc_codegen_llvm/src/errors.rs
parentdd12cd6dc631b5e964d541d370ca863c2242376c (diff)
parentb1c3c6380f5293b57cd2073908c84f2e270238ca (diff)
downloadrust-69df0f2c2f665d7f4e38a3579a81d4efc0d81034.tar.gz
rust-69df0f2c2f665d7f4e38a3579a81d4efc0d81034.zip
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`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions