The error E0015 occurs because Rust constants must be evaluated at compile time, but your code attempts to call a function that isn't marked as const. Fix this by adding the const keyword before the function definition to allow it to run during compilation.
const fn calculate_value() -> i32 {
42
}
const MY_VALUE: i32 = calculate_value();
If you cannot make the function const (e.g., it uses heap allocation or non-const logic), you must move the calculation out of the constant context and into a static variable or a runtime initialization block instead.