Skip to content

Commit

Permalink
Fix build for latest Zig master
Browse files Browse the repository at this point in the history
As of ziglang/zig#19414, a small workaround is
necessary to avoid global variables containing references to comptime
vars.
  • Loading branch information
ianprime0509 committed Mar 26, 2024
1 parent 96eddd0 commit b8cd2fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lsp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ pub fn EnumCustomStringValues(comptime T: type, comptime contains_empty_enum: bo
for (fields[0 .. fields.len - 1], 0..) |field, i| {
kvs_array[i] = .{ field.name, @field(T, field.name) };
}
break :build_kvs kvs_array[0..];
const final = kvs_array;
break :build_kvs final[0..];
};
/// NOTE: this maps 'empty' to .empty when T contains an empty enum
/// this shouldn't happen but this doesn't do any harm
Expand Down
3 changes: 2 additions & 1 deletion src/uri.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const reserved_escapes = blk: {
escapes[i][0] = '%';
_ = std.fmt.bufPrint(escapes[i][1..], "{X}", .{c}) catch unreachable;
}
break :blk &escapes;
const final = escapes;
break :blk &final;
};

/// Returns a URI from a path, caller owns the memory allocated with `allocator`
Expand Down

0 comments on commit b8cd2fe

Please sign in to comment.