Zig Version
0.14.0-dev.3446+50b40c962
Steps to Reproduce and Observed Output
const S = struct { a: usize = 1, b = 2, c: isize = 3, d: []const u8 };
yields
test.zig:1:20: error: tuple field has a name
const S = struct { a: usize = 1, b = 2, c: isize = 3, d: []const u8 };
Expected Output
This is an extremely confusing error message, particularly so as the error points to the first field rather than the offending one. In a large struct (where I encountered this error), the field with a missing type was 30-something lines down.
As suggested in Discord, the compiler could output a note: "note: struct is a tuple due to this unnamed field".
Personally, I would prefer the error message be changed. I'm not familiar with the compiler internals, though, so I don't know which would be easier or require a refactor.
Zig Version
0.14.0-dev.3446+50b40c962
Steps to Reproduce and Observed Output
yields
Expected Output
This is an extremely confusing error message, particularly so as the error points to the first field rather than the offending one. In a large struct (where I encountered this error), the field with a missing type was 30-something lines down.
As suggested in Discord, the compiler could output a note:
"note: struct is a tuple due to this unnamed field".Personally, I would prefer the error message be changed. I'm not familiar with the compiler internals, though, so I don't know which would be easier or require a refactor.