diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-07-08 23:39:37 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-07-18 19:02:05 -0700 |
| commit | f3dc53f6b53e8493b341f82cb06a56e33e80e6b7 (patch) | |
| tree | a5c5c93af8ea6661214790e54e22fd5af3e0d6d6 /lib/std/array_hash_map.zig | |
| parent | 55e89255e18163bcc153138a4883ec8d85e0d517 (diff) | |
| download | zig-f3dc53f6b53e8493b341f82cb06a56e33e80e6b7.tar.gz zig-f3dc53f6b53e8493b341f82cb06a56e33e80e6b7.zip | |
compiler: rework inferred error sets
* move inferred error sets into InternPool.
- they are now represented by pointing directly at the corresponding
function body value.
* inferred error set working memory is now in Sema and expires after
the Sema for the function corresponding to the inferred error set is
finished having its body analyzed.
* error sets use a InternPool.Index.Slice rather than an actual slice
to avoid lifetime issues.
Diffstat (limited to 'lib/std/array_hash_map.zig')
| -rw-r--r-- | lib/std/array_hash_map.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index 62165f0304..1e95352a02 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -1669,8 +1669,9 @@ pub fn ArrayHashMapUnmanaged( inline fn checkedHash(ctx: anytype, key: anytype) u32 { comptime std.hash_map.verifyContext(@TypeOf(ctx), @TypeOf(key), K, u32, true); - // If you get a compile error on the next line, it means that - const hash = ctx.hash(key); // your generic hash function doesn't accept your key + // If you get a compile error on the next line, it means that your + // generic hash function doesn't accept your key. + const hash = ctx.hash(key); if (@TypeOf(hash) != u32) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type!\n" ++ @typeName(u32) ++ " was expected, but found " ++ @typeName(@TypeOf(hash))); @@ -1679,8 +1680,9 @@ pub fn ArrayHashMapUnmanaged( } inline fn checkedEql(ctx: anytype, a: anytype, b: K, b_index: usize) bool { comptime std.hash_map.verifyContext(@TypeOf(ctx), @TypeOf(a), K, u32, true); - // If you get a compile error on the next line, it means that - const eql = ctx.eql(a, b, b_index); // your generic eql function doesn't accept (self, adapt key, K, index) + // If you get a compile error on the next line, it means that your + // generic eql function doesn't accept (self, adapt key, K, index). + const eql = ctx.eql(a, b, b_index); if (@TypeOf(eql) != bool) { @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic eql function that returns the wrong type!\n" ++ @typeName(bool) ++ " was expected, but found " ++ @typeName(@TypeOf(eql))); |
