diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-01-24 21:28:12 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-01-24 21:29:04 -0700 |
| commit | 913d61ebb95567fe67b0bfad99694892aac841e2 (patch) | |
| tree | 5496f79e086292913a5ac166eff6f7d3ea5113d7 /lib/std/array_hash_map.zig | |
| parent | 2e9ce6facd47189c4bbcd90a2a6ba1a689bfbde3 (diff) | |
| download | zig-913d61ebb95567fe67b0bfad99694892aac841e2.tar.gz zig-913d61ebb95567fe67b0bfad99694892aac841e2.zip | |
Revert "MultiArrayList: Fix error when struct is 0 sized"
This reverts commit 1f10cf4edf2b645e63dedc42f5d7475914bf2311.
Re-opens #10618
I want to solve this a different way. `align(S)` where S is a 0-byte
type should work in this context.
This also caused issues such as
https://github.com/Vexu/arocc/issues/221
Diffstat (limited to 'lib/std/array_hash_map.zig')
| -rw-r--r-- | lib/std/array_hash_map.zig | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index efd75a0fee..7ebafc0a1b 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -2215,35 +2215,6 @@ test "auto store_hash" { try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).field_type != void); } -test "0 sized key" { - var map = AutoArrayHashMap(u0, i32).init(std.testing.allocator); - defer map.deinit(); - - try testing.expectEqual(map.get(0), null); - - try map.put(0, 5); - try testing.expectEqual(map.get(0), 5); - - try map.put(0, 10); - try testing.expectEqual(map.get(0), 10); - - try testing.expectEqual(map.swapRemove(0), true); - try testing.expectEqual(map.get(0), null); -} - -test "0 sized key and 0 sized value" { - var map = AutoArrayHashMap(u0, u0).init(std.testing.allocator); - defer map.deinit(); - - try testing.expectEqual(map.get(0), null); - - try map.put(0, 0); - try testing.expectEqual(map.get(0), 0); - - try testing.expectEqual(map.swapRemove(0), true); - try testing.expectEqual(map.get(0), null); -} - pub fn getHashPtrAddrFn(comptime K: type, comptime Context: type) (fn (Context, K) u32) { return struct { fn hash(ctx: Context, key: K) u32 { |
