Zig Version
0.15.2
Steps to Reproduce and Observed Output
When trying to loop over a tuple with runtime-known fields without inline:
pub fn main() !void {
var tuple = .{ @as(u32, 123), @as(u32, 456) };
_ = &tuple;
for (tuple) |value| _ = value;
}
./example.zig:4:10: error: unable to resolve comptime value
for (tuple) |value| _ = value;
^~~~~
./example.zig:4:10: note: tuple field index must be comptime-known
This requires quite a mental jump and knowledge of how tuples are represented to figure out that inline is the solution here. Making the 'tuple field index' comptime-known is a concept that shouldn't really be exposed to the user if they're not explicitly using @typeInfo IMO.
Expected Output
An error message that is more context-aware and directly suggests using inline.
Zig Version
0.15.2
Steps to Reproduce and Observed Output
When trying to loop over a tuple with runtime-known fields without
inline:This requires quite a mental jump and knowledge of how tuples are represented to figure out that
inlineis the solution here. Making the 'tuple field index' comptime-known is a concept that shouldn't really be exposed to the user if they're not explicitly using@typeInfoIMO.Expected Output
An error message that is more context-aware and directly suggests using
inline.