You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
`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`. |
3 years ago | |
|---|---|---|
| src | 3 years ago | |
| .gitignore | 4 years ago | |
| Cargo.toml | 3 years ago | |
| README.md | 4 years ago | |
| test.sh | 3 years ago | |
README.md
libshire
A collection of assorted Rust utilities for reuse between various projects 🦀