diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-05-17 13:53:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-17 13:53:27 -0400 |
| commit | 16f100b82e4075a047f008c0de6c44fc418eb58e (patch) | |
| tree | 93555fbcba29bcd1120349a03ae6904321cb7718 /lib/std/hash_map.zig | |
| parent | 9a22c8b6ca98fd01795f8cd4f3e9d92311175f13 (diff) | |
| parent | b0968abccbfb4072528c3b5e039bc03b27af89a1 (diff) | |
| download | zig-16f100b82e4075a047f008c0de6c44fc418eb58e.tar.gz zig-16f100b82e4075a047f008c0de6c44fc418eb58e.zip | |
Merge pull request #5307 from ziglang/self-hosted-incremental-compilation
rework self-hosted compiler for incremental builds
Diffstat (limited to 'lib/std/hash_map.zig')
| -rw-r--r-- | lib/std/hash_map.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig index 47cc2f91e9..e2addb9b38 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -10,7 +10,7 @@ const Wyhash = std.hash.Wyhash; const Allocator = mem.Allocator; const builtin = @import("builtin"); -const want_modification_safety = builtin.mode != .ReleaseFast; +const want_modification_safety = std.debug.runtime_safety; const debug_u32 = if (want_modification_safety) u32 else void; pub fn AutoHashMap(comptime K: type, comptime V: type) type { @@ -219,6 +219,10 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3 return put_result.old_kv; } + pub fn putAssumeCapacityNoClobber(self: *Self, key: K, value: V) void { + assert(self.putAssumeCapacity(key, value) == null); + } + pub fn get(hm: *const Self, key: K) ?*KV { if (hm.entries.len == 0) { return null; |
