-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.

Description
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):
fn main() {
let mut v = std::vec::from_elem(1 as u8, (std::isize::MAX / 2 + 1) as usize);
v.push(1);
}
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.