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(
119119 kvs.* = .{
120120 .keys = sorted_keys.ptr,
121121 .values = sorted_vals.ptr,
122 .len = kvs_list.len,
122 .len = @intCast(kvs_list.len),
123123 };
124124 self.kvs = kvs;
125125
......@@ -270,13 +270,14 @@ const testing = std.testing;
270270const test_alloc = testing.allocator;
271271
272272test "list literal of list literals" {
273 const slice = [_]TestKV{
273 const slice: []const TestKV = &.{
274274 .{ "these", .D },
275275 .{ "have", .A },
276276 .{ "nothing", .B },
277277 .{ "incommon", .C },
278278 .{ "samelen", .E },
279279 };
280
280281 const map = TestMap.initComptime(slice);
281282 try testMap(map);
282283 // Default comparison is case sensitive