#E0080: definition depends on itself
A const, static or type alias is defined in terms of itself, directly or through others, or a type contains itself by value. Break the cycle; a type that contains itself holds it through a reference type such as List.
nabi
struct Node { value: i32; next: Node; }
error[E0080]: recursive type `Node` has infinite size (a struct can't contain itself by value; hold it through a reference type such as `List`) --> main.nabi:1:1 | 1 | struct Node { value: i32; next: Node; } | ^^^^^^
Hold the inner value through a reference type such as List:
nabi
struct Node { value: i32; next: List<Node>; }
let n = Node { value: 1, next: [] };
println(f"{n.value}");
1
Related: E0079 cannot evaluate at compile time, E0095 type too large
Found a mistake? Edit this page on GitHub. Last updated