jonhoo / flurry

A port of Java's ConcurrentHashMap to Rust
Apache License 2.0
533 stars 49 forks source link

Unsoundness in `HashMap::clear` #98

Closed ibraheemdev closed 2 years ago

ibraheemdev commented 3 years ago

HashMap::clear does not have K\V: Send + Sync bounds, even though it calls defer_destroy on nodes and values, which might call the destructors on another thread. Unless I am missing something, this is unsound and could cause undefined behavior.

jonhoo commented 3 years ago

Ah, yes, you are entirely right! Good catch. Would you mind submitting a PR with a fix?

ibraheemdev commented 2 years ago

Fixed as a side-affect of #102, K/V: 'static is no longer required.