-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
fn main() {
let n = 1 << (core::mem::size_of::<usize>() * 8 - 1);
let mut v = Vec::<()>::new();
assert!(v.capacity() >= n);
unsafe { v.set_len(n) };
let d = std::collections::VecDeque::from(v);
assert_eq!(d.len(), n, "unexpected len");
}
I expected VecDeque constructed from Vec to either work correctly or construction to panic if it is not possible. Instead:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `0`,
right: `2147483648`: unexpected len', a.rs:9:5
Introduced by #80003.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.