From 05fc4d34a93d1e8fd4a107cb17c9d4fd7ffc29bc Mon Sep 17 00:00:00 2001 From: Josh Wolfe Date: Sat, 7 Dec 2019 13:22:23 -0500 Subject: [PATCH] documentation for mutable HashMap KV pointers --- lib/std/hash_map.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig index f08ec4b59e..57a2f58b92 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -42,6 +42,11 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3 const Self = @This(); + /// A *KV is a mutable pointer into this HashMap's internal storage. + /// Modifying the key is undefined behavior. + /// Modifying the value is harmless. + /// *KV pointers become invalid whenever this HashMap is modified, + /// and then any access to the *KV is undefined behavior. pub const KV = struct { key: K, value: V,