Bug Report
Cairo version:
scarb 2.18.0 (e6144df0f 2026-04-21)
cairo: 2.18.0 (https://crates.io/crates/cairo-lang-compiler/2.18.0)
sierra: 1.8.0
arch: aarch64-apple-darwin
Current behavior:
Calling .span() on a fixed-size array [U; N] (N ≥ 1) where U is a zero-sized type causes a Rust-side panic! at sierra-generator/src/db.rs:370 instead of a Cairo diagnostic.
Expected behavior:
A 6-line program that constructs a fixed-size array of an empty struct and calls .span() on it should compile cleanly. Either the program runs (returning the array length as felt252), or the compiler produces a localized Cairo diagnostic explaining that Array<T> does not support zero-sized T. However, the compiler panics with a Rust backtrace.
Steps to reproduce:
scarb new repro --no-vcs --test-runner none
cd repro
(then, Replace src/lib.cairo with the snippet under "Related code" below)
scarb build
Compiling scratch v0.1.0 (Scarb.toml)
thread 'scarb compile scratch-j7r3ccbvc5mek' (130744) panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cairo-lang-sierra-generator-2.18.0/src/db.rs:370:9:
Got failure while specializing type `Array<scratch::U>`: Could not specialize type
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' (130733) panicked at scarb/src/ops/compile.rs:238:14:
Compiler thread has panicked.: Any { .. }
Related code:
#[derive(Drop, Copy)] struct U {}
#[executable]
fn main() -> felt252 {
let arr: [U; 2] = [U {}, U {}];
let s = arr.span();
s.len().into()
}
Other information:
These following variants also trigger this ICE bug:
let arr: [U; 2] = [U {}, U {}]; arr.span().len()
let arr: [U; 1] = [U {}]; arr.span().len()
let arr: [U; 4] = [...]; arr.span().len()
let s: Span<U> = arr.span();
arr.span().pop_front()
Bug Report
Cairo version:
scarb 2.18.0 (e6144df0f 2026-04-21)
cairo: 2.18.0 (https://crates.io/crates/cairo-lang-compiler/2.18.0)
sierra: 1.8.0
arch: aarch64-apple-darwin
Current behavior:
Calling .span() on a fixed-size array [U; N] (N ≥ 1) where U is a zero-sized type causes a Rust-side panic! at sierra-generator/src/db.rs:370 instead of a Cairo diagnostic.
Expected behavior:
A 6-line program that constructs a fixed-size array of an empty struct and calls
.span()on it should compile cleanly. Either the program runs (returning the array length asfelt252), or the compiler produces a localized Cairo diagnostic explaining thatArray<T>does not support zero-sizedT. However, the compiler panics with a Rust backtrace.Steps to reproduce:
scarb new repro --no-vcs --test-runner none
cd repro
(then, Replace src/lib.cairo with the snippet under "Related code" below)
scarb build
Related code:
Other information:
These following variants also trigger this ICE bug:
let arr: [U; 2] = [U {}, U {}]; arr.span().len()let arr: [U; 1] = [U {}]; arr.span().len()let arr: [U; 4] = [...]; arr.span().len()let s: Span<U> = arr.span();arr.span().pop_front()