-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Large allocations in const eval can OOM crash the compiler #79601
Copy link
Copy link
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.
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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
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
abortMeta
rustc --version --verbose:Backtrace
Vecmachinery...rust/compiler/rustc_middle/src/mir/interpret/allocation.rs
Line 110 in 0fa9d31
rust/compiler/rustc_mir/src/interpret/memory.rs
Line 197 in 0fa9d31
I think we'll need to stop using
Vecand move to manually usingAllocRef::alloc(and maybeBox<[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