docs

You are reading the docs for v0.1.2. Nabi 0.1.2 is no longer supported. Latest release: v0.1.3 →

#E0079: cannot evaluate at compile time

A const, array length, const generic argument or const fn body uses something that has no value at compile time: a call of a plain fn, a heap allocation, or a runtime value. Use literals, other consts and const fn calls.

nabi
fn three() -> i32 { 3 }
const N: i32 = three();
error[E0079]: const `N` cannot be evaluated at compile time: calls `three`, which is not a `const fn`
  --> main.nabi:2:16
   |
 2 | const N: i32 = three();
   |                ^^^^^^^

Make the function a const fn:

nabi
const fn three() -> i32 { 3 }
const N: i32 = three();
println(f"{N}");
3

Related: E0080 definition depends on itself, E0081 invalid const generic argument

Found a mistake? Edit this page on GitHub. Last updated