E0475: Const missing type annotation
| Code | Category | Stability |
|---|---|---|
E0475 | Struct and enum | Permanent |
Explanation
A value constant must declare its type explicitly. Rue does not infer a type for value constants; module bindings and callable function aliases are different constant forms and remain unannotated because no source-level type names those values.
Likely cause
A declaration such as const LIMIT = 42; supplies a runtime value but omits the : Type annotation. Add the intended type after the constant name; do not add an annotation to an @import module binding or callable alias.
Examples
Omit a value constant's type
const LIMIT = 42;
fn main() -> i32 { LIMIT }
Annotate the value constant
const LIMIT: i32 = 42;
fn main() -> i32 { LIMIT }