pantonshire 82034e14d0 strings: pointer-to-reference functions for InliningString
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`.
2022-09-14 00:32:12 +01:00
2022-05-15 17:14:39 +01:00
2022-05-15 18:32:30 +01:00

libshire

A collection of assorted Rust utilities for reuse between various projects 🦀

S
Description
Assorted utilities
Readme
151 KiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 99.7%
Shell 0.3%