Open
Description
Compare these two:
let v = vec![0u8; !0];
let u = vec![0u16; !0];
We request a vector with 18446744073709551615 elements.
- For
u8
we receive out of memory (null) from the allocator, and callalloc::oom
, which aborts the program:application terminated abnormally with signal 4 (Illegal instruction)
- For
u16
, we get an assertion:thread '<main>' panicked at 'capacity overflow', ../src/libcore/option.rs:330
This is inconsistent. Why don't we abort on both of these cases? We abort on too large allocation requests, so those that are even larger could abort too?