Skip to content

Fix panic after remove()

Alex Hornby requested to merge ahornby/chashmap:fix_remove into master

Fix panic after remove raised in #9

Reproduced issue by adding new tests, checked they failed

The underlying problem was lookup() and lookup_mut()'s handling of removed buckets, but lookup_or_free() did the right thing.

With the test in place fixes were:

  1. Generalized the old lookup_or_free to cover all lookup cases by parameterizing the lock->guard function.

  2. Delete dead code no longer needed due to above

Tested using cargo test:

test result: ok. 34 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Merge request reports