Conversation
`const fn new` and `const fn capacity` sit in an impl with a `B: Behavior` bound, which const fns accept only since 1.61 (`const_fn_trait_bound`), so the crate has not built on 1.59 since 3d9a1fd. Update the README, the crate docs and the CI matrix to 1.61, and add `rust-version` to Cargo.toml so cargo reports the requirement instead of failing mid-build. While an LLM was used to help implement this, I can vouch for every line.
ajasmin
force-pushed
the
bulk-extend-back
branch
from
October 1, 2026 15:44
27c4f64 to
5e46ac4
Compare
The previous implementation of `extend_back()` pushed one element at a time, each push recomputing the wrapped index, checking for a full deque and storing `len`. Compute the free capacity up front as its (at most two) contiguous regions and fill them with plain slice loops, counting in a local that an `AddLenOnDrop` guard adds to `len` on exit, so a panicking iterator keeps the elements already written and the loop body is one unconditional store per element, which LLVM vectorizes for primitive `Copy` elements from slice iterators. The storage cast behind `as_uninit_slice_mut()` moves into a function of the `xs` field, so `extend_back()` can borrow the storage and `len` apart without unsafe code of its own. Also add `extend_back_from_slice()` for `T: Copy`: one block copy per free region, for element types the optimizer doesn't automatically vectorize (odd sizes, padded structs) and for older compilers. The copy goes through a private copy of std's `write_copy_of_slice()` (stable since 1.93). The `Wrapping` deque gets neither change. Its `extend_back()` overwrites from the front once full, so filling the free regions is only its first phase, and its `Extend` impl saturates rather than evicts (andylokandy#32); the behavior's contract should be settled before touching the one or adding the other. While an LLM was used to help implement this, I can vouch for every line.
ajasmin
force-pushed
the
bulk-extend-back
branch
from
October 1, 2026 15:45
5e46ac4 to
706cc40
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was a rendering check of the pull request text before opening it upstream. Nothing to review here: the real pull request is PR 35 on andylokandy/arraydeque, from this same branch.