rust/src/librustc_error_codes/error_codes/E0010.md

335 B

The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.

Erroneous code example:

#![feature(box_syntax)]

const CON : Box<i32> = box 0;