6.3 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
[1.0.1] - 2022-03-24
FIXED
- To avoid an issue where allocated heap memory may be deallocated with a different layout
alignment than it was officially allocated with when converting between
std::string::StringandSmartString, even if otherwise correctly aligned, the respectiveFromimplementations now usestd::alloc::Allocator::grow()to re-align the heap data as necessary. An unfortunate consequence of this is that because thestd::alloc::AllocatorAPI hasn't been stabilised yet, unless you're on nightly or some future stable rustc version afterallocator_apihas been stabilised, converting betweenStringandSmartStringwill always reallocate and copy (making it always O(n) rather than O(1) when correctly aligned and O(n) otherwise). (#28)
[1.0.0] - 2022-02-24
CHANGED
-
smartstringnow implements its own boxed string type rather than deferring directly toString, so it no longer makes assumptions it shouldn't be making about the layout of theStringstruct.This also allows us to organise the boxed struct in a way that will let us rely only on our basic assumption that heap memory is word aligned on both big and little endian architectures. The most immediate consequence of this is that
smartstringwill now compile on 32-bit big endian architectures such asmips.We are now also explicitly allocating heap memory aligned for
u16rather thanu8, ensuring the assumption about pointer alignment becomes an invariant.In short:
smartstringno longer relies on undefined behaviour, and should be safe to use anywhere. -
The above means that the boxed
SmartStringis no longer pointer compatible withString, so if you were relying on that despite the documentation urging you not to, you'll really have to stop it now. Converting betweenSmartStringandStringusingFromandIntotraits is still efficient and allocation free. -
The minimum supported rustc version is now 1.57.0.
-
The
smartstring::validate()function has been removed, as it's no longer needed.
[0.2.10] - 2022-02-20
CHANGED
- The minimum supported rustc version has been increased to 1.56.0, and the
rust-versionfield has been added to the crate'sCargo.tomlto indicate the MSRV. (Therust-versionfield itself was introduced in version 1.56, hence the bump.) - Dependencies have been bumped, most notably to
arbitraryversion 1.
[0.2.9] - 2021-07-27
ADDED
- You can (and should) now call
smartstring::validate()from your own code or test suite to validateSmartString's memory layout assumptions.
[0.2.8] - 2021-07-26
CHANGED
- The minimum supported rustc version has been increased to 1.46.0.
ADDED
-
There are now
const fn new_const()constructors forSmartString<Compact>andSmartString<LazyCompact>, added as a temporary measure because const functions can't yet take trait bounds on type arguments, so we can't simply makeSmartString::new()const.Please note that when rustc catches up, the plan is to deprecate
new_const()in favour ofnew(). (#21)
[0.2.7] - 2021-07-01
FIXED
no_stdbuilds have been fixed. (#18)
[0.2.6] - 2020-12-19
ADDED
SmartStringnow implementsPartialEq<&str>.
[0.2.5] - 2020-09-24
ADDED
Fromimplementations fromCow<'_, str>and&mut strwere added. (#12)
[0.2.4] - 2020-09-05
ADDED
smartstringis nowno_stdif you disable thestdfeature flag (which is enabled by default). (#10)
FIXED
smartstringwill now refuse to compile on 32-bit big-endian architectures, where assuming that the high bit of a pointer is always empty is going to be a very bad idea.
[0.2.3] - 2020-07-07
ADDED
SmartStringnow implementsDisplay. (#6)SmartStringnow implementsFromIterator<char>.- Support for
serdebehind theserdefeature flag. (#2) - Support for
arbitrarybehind thearbitraryfeature flag. - Support for
proptestbehind theproptestfeature flag.
FIXED
SmartString::push_strwould previously trigger two heap allocations while promoting an inline string to a boxed string, one of which was unnecessary. It now only makes the one strictly necessary allocation. (#5)- Fixed a bug where
SmartString::removewould panic if you tried to remove the last index in an inline string.
[0.2.2] - 2020-07-05
FIXED
- Calling
shrink_to_fit()on a string withLazyCompactlayout will now inline it and deallocate the heap allocation if the string is short enough to be inlined.
[0.2.1] - 2020-07-04
FIXED
- The type alias
smartstring::alias::Stringwas incorrectly pointing at theCompactvariant. It is now pointing atLazyCompact, as the documentation describes.
[0.2.0] - 2020-07-04
REMOVED
- The
Prefixedvariant has been removed, as it comes with significant code complexity for very dubious gains.
CHANGED
- The type alias
smartstring::alias::Stringnow refers toLazyCompactinstead ofCompact, the idea being that the obvious drop-in replacement forStringshouldn't have any unexpected performance differences, whichCompactcan have because it aggressively re-inlines strings to keep them as local as possible.LazyCompactinstead heap allocates once when the string is in excess of the inline capacity and keeps the allocation from then on, so there are no surprises.
ADDED
- There's a new layout variant,
LazyCompact, which works likeCompactexcept it never re-inlines strings once they have been moved to the heap. - As the alias
Stringhas changed, there is now a new type aliassmartstring::alias::CompactString, referring to strings withCompactlayout.
FIXED
- Fixed a bug where
SmartString::drain()would remove twice the drained content from the string.
[0.1.0] - 2020-05-15
Initial release.