Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0483: Recursive type infinite size

CodeCategoryStability
E0483Struct and enumPermanent

Explanation

A struct or enum contains itself by value, directly or through other inline fields, payloads, or array elements. A non-zero by-value cycle has no finite size or layout. For uniform structural well-formedness, Rue also treats zero-length array edges as recursive-type edges. A raw pointer has a fixed size independent of its pointee, so pointer indirection can break the inline containment cycle.

Likely cause

A recursive data structure stores its next node directly, or two aggregate types contain one another without indirection. Change at least one edge of every by-value cycle to a pointer or redesign the representation so recursive values are stored out of line.

Examples

Contain a type directly inside itself

struct Node { next: Node, value: i32 }
fn main() -> i32 { 0 }

Break recursion with pointer indirection

struct Node { next: ptr const Node, value: i32 }
fn main() -> i32 { 0 }

References