You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust writes a typeless braced list as an array where a Vec is expected (let xs: Vec<i32> = [1, 2]; E0308), and Go writes a bare return {1} #409
A ConstructionExpression with no type is "the list alone, which initialises a declaration that has already said its type" (CLAUDE.md). Two targets get it wrong outside constant tables:
Rust:SpellCoreType spells an array type as Vec<T> (
). But GenerateConstructionExpression always writes a typeless list as an array literal [ … ] (RustGenerator.cs L2313-L2317). Only the static/const table path wraps it as &[ … ] to match &[T]. So a local, a return value or an argument of array type gets an array where a Vec is expected.
Go: a typeless list is written bare as {…} (GoGenerator.cs L2076-L2080). A local declaration supplies the type prefix itself, but a return (GoGenerator.cs L1754-L1760, via the base class) does not.
Repro
int first() { int[] xs = {1, 2}; return 0; } → Rust let mut xs: Vec<i32> = [ 1, 2 ]; → rustc E0308 expected Vec<i32>, found [{integer}; 2]
int[] all() { return {1}; }:
Rust return [ 1 ]; → E0308
Go return {1} → syntax error: unexpected {, expected expression
Acceptance criteria
In Rust, a typeless list whose receiving type is Vec<T> (a local, return, assignment, argument or instance field default) is written vec[…]. Module statics keep &[…].
In Go, a typeless list in a return, assignment or argument gets the receiving type in front ([]int{1}), as a local declaration already does.
Priority: Medium. In Rust, an array-typed local, return or argument built from a typeless list fails with E0308. In Go, returning a typeless list is a syntax error. Both are common shapes, but they fail loudly at compile time.
Area:RustGenerator.GenerateConstructionExpression (the typeless-list branch, which writes [ … ] where SpellCoreType expects Vec<T>). GoGenerator.GenerateConstructionExpression and the return path, which need the receiving type in front of the list. Tests go in the Rust and Go compile tests.
Activity
matt-edmondson commentedon Oct 31, 2026
Triage
RustGenerator.GenerateConstructionExpression(the typeless-list branch, which writes[ … ]whereSpellCoreTypeexpectsVec<T>).GoGenerator.GenerateConstructionExpressionand the return path, which need the receiving type in front of the list. Tests go in the Rust and Go compile tests.Generated by Claude Code