Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
james7132 opened this issue Jun 6, 2022 · 1 comment · Fixed by #88
Closed

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

james7132 opened this issue Jun 6, 2022 · 1 comment · Fixed by #88
Labels
bug Something isn't working

Comments

@james7132
Copy link

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
Copy link
Owner

hawkw commented Jun 7, 2022

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

@hawkw hawkw added the bug Something isn't working label Jun 7, 2022
loyd added a commit to loyd/sharded-slab that referenced this issue Oct 2, 2023
* Add fuzzing tests for public API
* Fix hawkw#73 (unique_iter)
* Fix panics in `get()` for random keys

Fixes hawkw#73
loyd added a commit to loyd/sharded-slab that referenced this issue Oct 3, 2023
Avoid panics in `Slab::unique_iter()` in case of an empty slab.

Closes hawkw#73
loyd added a commit to loyd/sharded-slab that referenced this issue Oct 3, 2023
Fixes panics in `Slab::unique_iter()` in case of an empty slab.

Fixes hawkw#73
@hawkw hawkw closed this as completed in #88 Oct 4, 2023
hawkw pushed a commit that referenced this issue Oct 4, 2023
Fixes panics in `Slab::unique_iter()` in case of an empty slab.

Fixes #73
hawkw pushed a commit that referenced this issue Oct 4, 2023
Fixes panics in `Slab::unique_iter()` in case of an empty slab.

Fixes #73
hawkw added a commit that referenced this issue Oct 4, 2023
### v0.1.7 (2023-10-04)

#### Bug Fixes

*   index out of bounds in `get()` and `get_owned()` (#88) (fdbc930)
* **unique_iter:**  prevent panics if a slab is empty (#88) (bd599e0,
  closes #73)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants