9 Commits (82034e14d0d42b4efe4d0cf609c364b74cd373d2)

Author SHA1 Message Date
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`.
3 years ago
pantonshire 5e612f153c Deny unsafe_op_in_unsafe_fn
The unsafe_op_in_unsafe_fn lint was previously set to allow, meaning
that unsafe function calls and operations were allowed within unsafe
functions without a surrounding unsafe block. This patch changes the
lint to deny, for the purpose of making unsafe operations in the
codebase more explicit.
3 years ago
Pantonshire d1ca94954b impl Clone for InliningString 3 years ago
Pantonshire 5ca54944e8 Move the experimental InliningString to the inlining module 3 years ago
Pantonshire 6d6d35f2e0 More conversion functions for InliningString 3 years ago
Pantonshire 8e733c444d Remove debugging info and use new serde::Deserialize impl for experimental InliningString 3 years ago
Pantonshire 45ae1c68eb Improved serde support 3 years ago
Pantonshire 0b4dbc6bc5 no_std support 3 years ago
Pantonshire 4d4e4486d1 ShString is now InliningString 3 years ago