-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
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... bytes: vec![0; size.bytes_usize()], let alloc = Allocation::uninit(size, align);
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
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.