Fix error when HashMap.remove on uninitialized HashMap (#1629)

* HashMap: test removal on uninitialized

* HashMap.remove_entry_for_key: return false on unintialized

* test: switch to temp_init

* release note
This commit is contained in:
Walther Chen
2024-11-18 08:20:32 -05:00
committed by GitHub
parent 295b374b48
commit f39e339726
3 changed files with 13 additions and 1 deletions

View File

@@ -482,6 +482,7 @@ fn void HashMap.free_internal(&map, void* ptr) @inline @private
fn bool HashMap.remove_entry_for_key(&map, Key key) @private
{
if (!map.count) return false;
uint hash = rehash(key.hash());
uint i = index_for(hash, map.table.len);
Entry* prev = map.table[i];