11 KiB
11 KiB
bytemuck changelog
1.12.3
- This bugfix makes the crate do stuff with
Arcor not based on thetarget_has_atomicconfig. Previously, some targets that have allocation but not atomics were getting errors. This raises the MSRV of theextern_crate_allocfeature to 1.60, but opt-in features are not considered to be hard locked to 1.34 like the basic build of the crate is.
1.12.2
- Fixes
try_pod_read_unalignedbug that made it always fail unless the target type was exactly pointer sized in which case UB could happen. TheCheckedBitPattern::is_valid_bit_patternwas being asked to check that a reference to thepodvalue was a valid bit pattern, rather than the actual bit pattern itself, and so the check could in some cases be illegally bypassed.
1.12.1
- Patch bumped the required
bytemuck_deriveversion because of a regression in how it handledalign(N)attributes.
1.12
- This minor version bump is caused by a version bump in our
bytemuck_derivedependency, which is in turn caused by a mixup in the minimum version ofsynthatbytemuck_deriveuses. See Issue 122. There's not any specific "new" API as you might normally expect from a minor version bump. - pali fixed a problem with SPIR-V builds being
broken. The error handling functions were trying to be generic over
Display, which the error types normally support, except on SPIR-V targets (which run on the GPU and don't have text formatting).
1.11
- WaffleLapkin added
wrap_boxandpeel_boxto theTransparentWrapperAlloctrait. Default impls of these functions are provided, and (as usual with the transparent trait stuff) you should not override the default versions.
1.10
- TheEdward162 added the
ZeroableInOptionandPodInOptiontraits. These are for types that areZeroableorPodwhen in an option, but not on their own. We provide impls for the various "NonZeroINTEGER" types incore, and if you need to newtype a NonZero value then you can impl these traits when you userepr(transparent).
1.9.1
- Bumped the minimum
bytemuck_derivedependency version from1.0to1.1. The fact thatbytemuckandbytemuck_deriveare separate crates at all is an unfortunate technical limit of current Rust, woe and calamity.
1.9.0
- fu5ha added the
NoUninit,AnyBitPattern, andCheckedBitPatterntraits. This allows for a more fine-grained level of detail in what casting operations are allowed for a type. Types that already implementZeroableandPodwill have a blanket impl for these new traits. This is a "preview" of the direction that the crate will probably go in the eventual 2.0 version. We're still waiting on Project Safe Transmute for an actual 2.0 version of the crate, but until then please enjoy this preview. - Also Fusha added better support for
uniontypes in the derive macros. I still don't know how any of the proc-macro stuff works at all, so please direct questions to her.
1.8.0
try_pod_read_unalignedandpod_read_unalignedlet you go from&[u8]toT:Podwithout worrying about alignment.
1.7.3
- Experimental support for the
portable_simdlanguage extension under thenightly_portable_simdcargo feature. As the name implies, this is an experimental crate feature and it's not part of the semver contract. All it does is add the appropriateZeroableandPodimpls.
1.7.2
- Why does this repo keep being hit with publishing problems? What did I do to deserve this curse, Ferris? This doesn't ever happen with tinyvec or fermium, only bytemuck.
1.7.1
- Soundness Fix: The wrap/peel methods for owned value conversion, added to
TransparentWrapperin 1.6, can cause a double-drop if used with types that implDrop. The fix was simply to add aManuallyDroplayer around the value before doing thetransmute_copythat is used to wrap/peel. While this fix could technically be backported to the 1.6 series, since 1.7 is semver compatible anyway the 1.6 series has simply been yanked.
1.7
- In response to Unsafe Code Guidelines Issue
#286, this
version of Bytemuck has a Soundness-Required Breaking Change. This is
"allowed" under Rust's backwards-compatibility guidelines, but it's still
annoying of course so we're trying to keep the damage minimal.
- The Reason: It turns out that pointer values should not have been
Pod. More specifically,ptr as usizeis not the same operation as callingtransmute::<_, usize>(ptr). - LLVM has yet to fully sort out their story, but until they do, transmuting pointers can cause miscompilations. They may fix things up in the future, but we're not gonna just wait and have broken code in the mean time.
- The Fix: The breaking change is that the
Podimpls for*const T,*mut T, andOption<NonNull<T>are now gated behind theunsound_ptr_pod_implfeature, which is off by default. - You are strongly discouraged from using this feature, but if a dependency of yours doesn't work when you upgrade to 1.7 because it relied on pointer casting, then you might wish to temporarily enable the feature just to get that dependency to build. Enabled features are global across all users of a given semver compatible version, so if you enable the feature in your own crate, your dependency will also end up getting the feature too, and then it'll be able to compile.
- Please move away from using this feature as soon as you can. Consider it to already be deprecated.
- PR 65
- The Reason: It turns out that pointer values should not have been
1.6.3
- Small goof with an errant
;, so PR 69 actually got things working on SPIR-V.
1.6.2
cargo upload goof! ignore this one.
1.6.1
1.6
- The
TransparentWrappertrait now has more methods. More ways to wrap, and now you can "peel" too! Note that we don't call it "unwrap" because that name is too strongly associated with the Option/Result methods. Thanks to LU15W1R7H for doing PR 58 - Min Const Generics! Now there's Pod and Zeroable for arrays of any size when
you turn on the
min_const_genericscrate feature. zakarumych got the work started in PR 59, and chorman0773 finished off the task in PR 63
1.5.1
- Fix
bytes_offailing on zero sized types. PR 53
1.5
- Added
pod_collect_to_vec, which will gather a slice into a vec, allowing you to change the pod type while also safely ignoring alignment. PR 50
1.4.2
- Kimundi fixed an issue that could make
try_zeroed_boxstack overflow for large values at low optimization levels. PR 43
1.4.1
1.4
- icewind1991 has contributed the proc-macros
for deriving impls of
Pod,TransparentWrapper,Zeroable!! Everyone has been waiting for this one folks! It's a big deal. Just enable thederivecargo feature and then you'll be able to derive the traits on your types. It generates all the appropriate tests for you. - The
zeroable_maybe_uninitfeature now adds aZeroableimpl to theMaybeUninittype. This is only behind a feature flag becauseMaybeUninitdidn't exist back in1.34.0(the minimum rust version ofbytemuck).
1.3.1
- The entire crate is now available under the
Apache-2.0 OR MITlicense as well as the previousZliblicense #24. - HeroicKatora added the
try_zeroed_slice_boxfunction #10.zeroed_slice_boxis also available. - The
offset_of!macro now supports a 2-arg version. For types that impl Default, it'll just make an instance usingdefaultand then call over to the 3-arg version. - The
PodCastErrortype now supportsHashandDisplay. Also if you enable theextern_crate_stdfeature then it will supportstd::error::Error. - We now provide a
TransparentWrapper<T>impl forcore::num::Wrapper<T>. - The error type of
try_from_bytesandtry_from_bytes_mutwhen the input isn't aligned has been corrected from beingAlignmentMismatch(intended for allocation casting only) toTargetAlignmentGreaterAndInputNotAligned.
1.3.0
- Had a bug because the CI was messed up! It wasn't soundness related, because
it prevented the crate from building entirely if the
extern_crate_allocfeature was used. Still, this is yanked, sorry.
1.2.0
- thomcc added many things:
- A fully sound
offset_of!macro #10 - A
Contiguoustrait for when you've got enums with declared values all in a row #12 - A
TransparentWrappermarker trait for when you want to more clearly enable adding and removing a wrapper struct to its inner value #15 - Now MIRI is run on CI in every single push! #16
- A fully sound
1.1.0
- SimonSapin added
from_bytes,from_bytes_mut,try_from_bytes, andtry_from_bytes_mut(PR Link)
1.0.1
- Changed to the zlib license.
- Added much more proper documentation.
- Reduced the minimum Rust version to 1.34