The Vec should not needlessly overallocate capacity if it is guaranteed to fail. #31446
Labels
A-collections
Area: `std::collections`
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Current Vec / RawVec allocation strategy is to at least double the capacity on
reallocation. This leads to unnecessary panic when the new overallocated
capacity exceeds std::isize::MAX. If allocating std::isize::MAX would be
sufficient it should do so instead.
For example I would expect the following to work on 32-bit platform (provided
that there is sufficient amount of memory):
The text was updated successfully, but these errors were encountered: