82034e14d0d42b4efe4d0cf609c364b74cd373d2
Previously, several functions in the implementation of `InliningString` converted raw pointers to references as part of large blocks of code, either via deref coercion or via `slice::from_raw_parts`. This created a risk of Rust inferring reference lifetimes that were too long; this is bad because it could result in a use-after-free or mutable aliasing. This patch moves pointer-to-reference conversions in `InliningString` to dedicated helper functions with explicit or easily-elided lifetimes to avoid this issue. This patch also introduces a `InliningString::take_boxed_buf_invalidating` method, which provides a way to move the boxed buffer out of an `InliningString` without aliasing the box's heap allocation (which is not allowed). The `Drop` implementation is reworked to use this method, as well as `InliningString::into_boxed_str`.
libshire
A collection of assorted Rust utilities for reuse between various projects 🦀
Languages
Rust
99.7%
Shell
0.3%