hawkw / sharded-slab

a lock-free concurrent slab (experimental)
MIT License
273 stars 19 forks source link

Slab::unique_iter panics when the slab is empty #73

Closed james7132 closed 1 year ago

james7132 commented 2 years ago

Due to the expect in Slab::unique_iter, the function panics when used on an empty slab.

Trying to use this as a way to speed up a fork of async_executor, which currently uses Mutex<slab::Slab<Waker>>, but a correct Drop impl requires at the minimum a iterator over the entire slab, and preferably a draining iterator.

hawkw commented 2 years ago

Thanks for the report, we should definitely fix this. It may be necessary to special-case the slab being empty in the Iterator impl...