`FromZeros::insert_vec_zeroed` both panics and returns `Result`
Open
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 179
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 29
Description
Fallible functions that also panic is a general API smell. [`insert_vec_zeroed`](https://docs.rs/zerocopy/0.8.14/zerocopy/trait.FromZeros.html#method.insert_vec_zeroed) mirrors [`std`'s](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.insert) panicking on index, but doesn't mirror the panicking allocation.
In the next breaking version, I propose that `insert_vec_zeroed` be made fully fallible by returning `Err` if `position > v.len()`.
Relevant: #1653
Contributor guide
Assessment
This issue has not been assessed yet.