Closed
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.