Lokathor / bytemuck

A crate for mucking around with piles of bytes
https://docs.rs/bytemuck
Apache License 2.0
697 stars 77 forks source link

Disallow casting ZST <-> non-ZST in cast_slice_box. #255

Closed zachs18 closed 1 month ago

zachs18 commented 1 month ago

Alternative to #254. Fixes the panics in try_cast_slice_box by disallowing casting between boxed ZST slices and boxed non-ZST slices, regardless of length (i.e. option 3 from #253 "Make cast_slice_box behave like cast_slice").

Lokathor commented 1 month ago

I merged 254 instead of this because i think that we should always be trying to move towards more casts allowed than less. That said, I won't actually publish the patch right away, I'd like to think on 253 a bit more and then resolve that fully and then do a release with a "complete" solution.