mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.static_string_map: Cast length of input for runtime initialization
This commit is contained in:
parent
b8890f8ee1
commit
b6fd34aa46
@ -119,7 +119,7 @@ pub fn StaticStringMapWithEql(
|
|||||||
kvs.* = .{
|
kvs.* = .{
|
||||||
.keys = sorted_keys.ptr,
|
.keys = sorted_keys.ptr,
|
||||||
.values = sorted_vals.ptr,
|
.values = sorted_vals.ptr,
|
||||||
.len = kvs_list.len,
|
.len = @intCast(kvs_list.len),
|
||||||
};
|
};
|
||||||
self.kvs = kvs;
|
self.kvs = kvs;
|
||||||
|
|
||||||
@ -270,13 +270,14 @@ const testing = std.testing;
|
|||||||
const test_alloc = testing.allocator;
|
const test_alloc = testing.allocator;
|
||||||
|
|
||||||
test "list literal of list literals" {
|
test "list literal of list literals" {
|
||||||
const slice = [_]TestKV{
|
const slice: []const TestKV = &.{
|
||||||
.{ "these", .D },
|
.{ "these", .D },
|
||||||
.{ "have", .A },
|
.{ "have", .A },
|
||||||
.{ "nothing", .B },
|
.{ "nothing", .B },
|
||||||
.{ "incommon", .C },
|
.{ "incommon", .C },
|
||||||
.{ "samelen", .E },
|
.{ "samelen", .E },
|
||||||
};
|
};
|
||||||
|
|
||||||
const map = TestMap.initComptime(slice);
|
const map = TestMap.initComptime(slice);
|
||||||
try testMap(map);
|
try testMap(map);
|
||||||
// Default comparison is case sensitive
|
// Default comparison is case sensitive
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user