authorgravatar for burgerindividual@proton.meRyan G <burgerindividual@proton.me> 2024-06-20 19:22:39-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-06-20 23:22:39+00:00
logb6fd34aa46217a8c9f49ebff0b912672296315ad
treee291d98deb9f6a586e0c8ad4d9fb9b3675b2e3f9
parentb8890f8ee1cb36e425afd96c0058fc382eb7cf39
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.static_string_map: Cast length of input for runtime initialization


1 files changed, 3 insertions(+), 2 deletions(-)

lib/std/static_string_map.zig+3-2
...@@ -119,7 +119,7 @@ pub fn StaticStringMapWithEql(...@@ -119,7 +119,7 @@ pub fn StaticStringMapWithEql(
119 kvs.* = .{119 kvs.* = .{
120 .keys = sorted_keys.ptr,120 .keys = sorted_keys.ptr,
121 .values = sorted_vals.ptr,121 .values = sorted_vals.ptr,
122 .len = kvs_list.len,122 .len = @intCast(kvs_list.len),
123 };123 };
124 self.kvs = kvs;124 self.kvs = kvs;
125125
...@@ -270,13 +270,14 @@ const testing = std.testing;...@@ -270,13 +270,14 @@ const testing = std.testing;
270const test_alloc = testing.allocator;270const test_alloc = testing.allocator;
271271
272test "list literal of list literals" {272test "list literal of list literals" {
273 const slice = [_]TestKV{273 const slice: []const TestKV = &.{
274 .{ "these", .D },274 .{ "these", .D },
275 .{ "have", .A },275 .{ "have", .A },
276 .{ "nothing", .B },276 .{ "nothing", .B },
277 .{ "incommon", .C },277 .{ "incommon", .C },
278 .{ "samelen", .E },278 .{ "samelen", .E },
279 };279 };
280
280 const map = TestMap.initComptime(slice);281 const map = TestMap.initComptime(slice);
281 try testMap(map);282 try testMap(map);
282 // Default comparison is case sensitive283 // Default comparison is case sensitive