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.
[pin_]init_scopefunctions to run arbitrary code inside of an initializer.&'static mut MaybeUninit<T>now implementsInPlaceWrite. This enables users to use external allocation mechanisms such asstatic_cell.- Non-zero integer types (
NonZero*) now implementZeroableOption.
#[pin_data]now generates a*Projectionstruct similar to thepin-projectcrate.- Add initializer code blocks to
[try_][pin_]init!macros: make initializer macros accept any number of_: {/* arbitrary code */},& make them run the code at that point. - Make the
[try_][pin_]init!macros expose initialized fields via aletbinding as&mut TorPin<&mut T>for later fields. - Rewrote all proc-macros (
[pin_]init!,#[pin_data],#[pinned_drop],derive([Maybe]Zeroable)), usingsynwith better diagnostics. derive([Maybe]Zeroable)now support tuple structs.[pin_]init!now supports attributes on fields (such as#[cfg(...)]).- Add a
#[default_error(<type>)]attribute to[pin_]init!to override the default error (when no? Erroris specified). - Minimum Rust version is bumped to 1.82.
try_[pin_]init!have been removed in favor of merging their feature with[pin_]init!.
- Corrected
T: Sizedbounds toT: ?Sizedin the generatedPinnedDropcheck by#[pin_data].
0.0.10 - 2025-08-19
Wrapper<T>trait added for creating wrapper structs with a structurally pinned value.MaybeZeroablederive macro to try to deriveZeroable, but not error if not all fields implement it.unsafe fn cast_[pin_]init()functions to unsafely change the initialized type of an initializerimpl<T, E> [Pin]Init<T, E> for Result<T, E>, so results are now (pin-)initializers- add
Zeroable::init_zeroed()delegating toinit_zeroed() - add new
zeroed(), a safe version ofmem::zeroed()and also provide it viaZeroable::zeroed() - implement
ZeroableforOption<&T>andOption<&mut T> - implement
ZeroableforOption<[unsafe] [extern "abi"] fn(...args...) -> ret>for"Rust"and"C"ABIs and up to 20 arguments
InPlaceInitnow only exists when theallocorstdfeatures are enabled- added support for visibility in
Zeroablederive macro - added support for
unions inZeroablederive macro - renamed the crate from
pinned-inittopin-initandpinned-init-macrotopin-init-internal - blanket impls of
InitandPinInitfromimpl<T, E> [Pin]Init<T, E> for Ttoimpl<T> [Pin]Init<T> for T - renamed
zeroed()toinit_zeroed()
Zeroableimplementation forOption<Box<T>>&Option<NonNull<T>>to only allowT: Sized(soundness issue)
0.0.9 - 2024-12-02
InPlaceWritetrait to re-initialize already existing allocations,assert_pinned!macro to check if a field is marked with#[pin],- compatibility with stable Rust, thanks a lot to @bonzini! #24 and #23:
- the
allocfeature enables support forallocator_apiand reflects the old behavior, if it is disabled, then infallible allocations are assumed (just like the standard library does).
- the
- guard hygiene wrt constants in
[try_][pin_]init!
0.0.8 - 2024-07-07
- return type of
zeroed()fromimpl Init<T, E>toimpl Init<T>(also removing the generic parameterE) - removed the default error of
try_[pin_]init!, now you always have to specify an error using? Errorat the end - put
InPlaceInitbehind theallocfeature flag, this allows stable usage of the#![no_std]part of the crate
0.0.7 - 2024-04-09
Zeroablederive macro..Zeroable::zeroed()tail expression support in[try_][pin_]init!macros: allowed to omit fields, omitted fields are initialized with0[pin_]chainfunctions to modify a value after an initializer has run[pin_]init_array_from_fnto createimpl [Pin]Init<[T; N], E>from a generator closurefn(usize) -> impl [Pin]Init<T, E>impl Zeroable for UnsafeCell
PinInitis now a supertrait ofInit(before there was a blanket impl)
- coverage workflow and usage of
#[feature(no_coverage)] impl Zeroable for Infallible(see Security)
Selfin generic bounds on structs with#[pin_data]- const generic default parameter values can now be used on structs with
#[pin_data]
impl Zeroable for Infallible(#13) it was possible to trigger UB by creating a value of typeBox<Infallible>viaBox::init(zeroed())