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
This is pointing at code in std.Build.Step.Options as the source of the error, but that's not where the error is actually being caused. This may be related to #18900.
Zig Version
0.12.0-dev.3630+215de3ee6
Steps to Reproduce and Observed Behavior
Running these commands:
produces this error:
Expected Behavior
Expected no error.
The following change makes it "work", but I doubt this is the appropriate fix.
/// Print the string as a Zig identifier, escaping it with `@""` syntax if needed. fn formatId( bytes: []const u8, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { const allow_primitive, const allow_underscore = comptime parse_fmt: { var allow_primitive = false; var allow_underscore = false; for (fmt) |char| { switch (char) { 'p' => if (!allow_primitive) { allow_primitive = true; continue; }, '_' => if (!allow_underscore) { allow_underscore = true; continue; }, + 's' => continue, else => {}, } @compileError("expected {}, {p}, {_}, {p_} or {_p}, found {" ++ fmt ++ "}"); } break :parse_fmt .{ allow_primitive, allow_underscore }; }; if (isValidId(bytes) and (allow_primitive or !std.zig.isPrimitive(bytes)) and (allow_underscore or !isUnderscore(bytes))) { return writer.writeAll(bytes); } try writer.writeAll("@\""); try stringEscape(bytes, "", options, writer); try writer.writeByte('"'); }
The text was updated successfully, but these errors were encountered: