8309e19a6866e0a0d1513c96e5679ca6592f82f1
`CappedString::as_bytes` previously used a wide pointer cast to obtain a `&[u8]` from the `[MaybeUninit<u8>; N]` buffer; it cast a `*const [MaybeUninit<u8>]` to a `*const [u8]` as an intermediate step. Although this seems to be valid and did not cause any UB detected by MIRI, it seems to be generally accepted that `slice::from_raw_parts` is the preferred way to transmute slices since it makes explicit the metadata (length in this case) of the new wide pointer. This is in contrast to casting with `as`, which implicitly copies the metadata from the old wide pointer into the new one. Therefore, this patch replaces the `as *const [u8]` conversion with a call to `slice::from_raw_parts`.
libshire
A collection of assorted Rust utilities for reuse between various projects 🦀
Languages
Rust
99.7%
Shell
0.3%