Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hybrid-array: make
ArraySize
an unsafe trait
It's used when checking the lengths of slices match an array size prior to using a pointer cast to convert types. If someone were to make their own `typenum::Unsigned` type and impl `ArraySize` for it with an `ArrayType` whose size does not match `Unsigned::USIZE`, that would be UB. Really `ArraySize` is not intended for downstream crates to impl anyway, but making it an `unsafe trait` at least captures the UB potential. Additionally this adds more debug checks to `check_slice_length` to ensure that if there is a length mismatch, it's at least caught in debug builds.
- Loading branch information