Skip to content

Commit 45d7dfa

Browse files
cbilzVexu
authored andcommitted
std.hash_map: add const attribute to StringIndexContext.bytes and ...
StringIndexAdapter.bytes Without this change, constructing a Context/Adapter for a `const` string table requires a `@constCast`.
1 parent 1631dc9 commit 45d7dfa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/std/hash_map.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn hashString(s: []const u8) u64 {
9292
}
9393

9494
pub const StringIndexContext = struct {
95-
bytes: *std.ArrayListUnmanaged(u8),
95+
bytes: *const std.ArrayListUnmanaged(u8),
9696

9797
pub fn eql(self: @This(), a: u32, b: u32) bool {
9898
_ = self;
@@ -106,7 +106,7 @@ pub const StringIndexContext = struct {
106106
};
107107

108108
pub const StringIndexAdapter = struct {
109-
bytes: *std.ArrayListUnmanaged(u8),
109+
bytes: *const std.ArrayListUnmanaged(u8),
110110

111111
pub fn eql(self: @This(), a_slice: []const u8, b: u32) bool {
112112
const b_slice = mem.sliceTo(@as([*:0]const u8, @ptrCast(self.bytes.items.ptr)) + b, 0);

0 commit comments

Comments
 (0)