Closed
Description
I tried this code:
const FOO: () = {
let x = [0_u8; 1000*1000*1000];
};
I expected to see this happen: An error about the constant evaluation using more memory than the compiler having available
Instead, this happened: The compiler triggered an abort
Meta
rustc --version --verbose
:
1.48.0
Backtrace
- somewhere in the
Vec
machinery...
I think we'll need to stop using Vec
and move to manually using AllocRef::alloc
(and maybe Box<[u8]>
? in order to allow bubbling up allocation errors during const eval back to the user via error messages.
cc @rust-lang/wg-const-eval
related: #23600