-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.