| ... | ... | @@ -78,7 +78,7 @@ pub const BufSet = struct { |
| 78 | 78 | ) Allocator.Error!BufSet { |
| 79 | 79 | var cloned_hashmap = try self.hash_map.cloneWithAllocator(new_allocator); |
| 80 | 80 | var cloned = BufSet{ .hash_map = cloned_hashmap }; |
| 81 | | var it = self.hash_map.keyIterator(); |
| 81 | var it = cloned.hash_map.keyIterator(); |
| 82 | 82 | while (it.next()) |key_ptr| { |
| 83 | 83 | key_ptr.* = try cloned.copy(key_ptr.*); |
| 84 | 84 | } |
| ... | ... | @@ -132,3 +132,16 @@ test "BufSet clone" { |
| 132 | 132 | original.cloneWithAllocator(testing.failing_allocator), |
| 133 | 133 | ); |
| 134 | 134 | } |
| 135 | |
| 136 | test "BufSet.clone with arena" { |
| 137 | var allocator = std.testing.allocator; |
| 138 | var arena = std.heap.ArenaAllocator.init(allocator); |
| 139 | defer arena.deinit(); |
| 140 | |
| 141 | var buf = BufSet.init(allocator); |
| 142 | defer buf.deinit(); |
| 143 | try buf.insert("member1"); |
| 144 | try buf.insert("member2"); |
| 145 | |
| 146 | _ = try buf.cloneWithAllocator(arena.allocator()); |
| 147 | } |