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

E0906: Type too large

CodeCategoryStability
E0906ArrayPermanent

Explanation

Rue rejects a type whose layout needs more than 268,435,455 ABI slots, the object-size ceiling published in C.4:3. The ceiling is the code generator's frame-offset addressing range — i32::MAX, 2,147,483,647 bytes — divided by the 8-byte slot width, so any layout that fits it is addressable by a signed 32-bit displacement. The check counts slots and not bytes: a layout spends one 8-byte slot per scalar, per struct field, and per array element whatever the element's own width (C.4:2), so [i8; N] and [i64; N] reach the ceiling at the same N and a narrow element type buys no headroom. E0906 is raised wherever a value of the type would be materialized — a local, a by-value parameter, a temporary, an array-repeat literal, or a @size_of/@align_of query — and the message names the slot ceiling rather than a byte figure. Exceeding the limit is a diagnosable failure by policy (C.1:2): the compiler reports it instead of wrapping the slot arithmetic or truncating the layout.

Likely cause

An array length (or a nested array's element count times its length) puts the type over 268,435,455 elements' worth of slots. Reduce the length, or hold the data behind a run of storage that is not a single frame-resident object. A layout close to the ceiling is also close to the per-function storage budget that E0907 checks, so shrinking the type usually resolves both. Note that the byte size can look small and still be rejected: [i8; 268435456] is about 256 MiB of data but 268,435,456 slots, one past the ceiling.

Examples

One element past the slot ceiling

fn main() -> i32 { @size_of([i8; 268435456]) }

A layout at the slot ceiling

fn main() -> i32 { @size_of([i8; 268435455]) }

References