Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `[pin_]init_scope` functions to run arbitrary code inside of an initializer.
- `&'static mut MaybeUninit<T>` now implements `InPlaceWrite`. This enables users to use external
allocation mechanisms such as `static_cell`.
- Rewrote all proc-macros using `syn`.

### Changed

Expand All @@ -22,7 +21,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
code at that point.
- Make the `[try_][pin_]init!` macros expose initialized fields via a `let`
binding as `&mut T` or `Pin<&mut T>` for later fields.
- `derive([Maybe]Zeroable)` now support tuple structs
- Rewrote all proc-macros (`[pin_]init!`, `#[pin_data]`, `#[pinned_drop]`,
`derive([Maybe]Zeroable)`), using `syn` with 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 `? Error` is specified).
- Support packed struct in `[pin_]init!` with `#[disable_initialized_field_access]`.

### Removed

- `try_[pin_]init!` have been removed in favor of merging their feature with
`[pin_]init!`.

### Fixed

- Corrected `T: Sized` bounds to `T: ?Sized` in the generated `PinnedDrop`
check by `#[pin_data]`.

## [0.0.10] - 2025-08-19

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/compile-fail/init/missing_pin_data.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ error[E0599]: no associated item named `__pin_data` found for struct `Foo` in th
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `__pin_data`, perhaps you need to implement it:
candidate #1: `HasPinData`
candidate #1: `pin_init::__internal::HasPinData`
= note: this error originates in the macro `pin_init` (in Nightly builds, run with -Z macro-backtrace for more info)
23 changes: 0 additions & 23 deletions tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,3 @@ error: The field `pin4` of type `PhantomPinned` only has an effect if it has the
|
9 | pin4: ::core::marker::PhantomPinned,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0425]: cannot find type `PhantomPinned` in this scope
--> tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.rs:6:11
|
6 | pin1: PhantomPinned,
| ^^^^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
|
1 + use std::marker::PhantomPinned;
|

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `marker`
--> tests/ui/compile-fail/pin_data/no_pin_on_phantompinned.rs:7:11
|
7 | pin2: marker::PhantomPinned,
| ^^^^^^ use of unresolved module or unlinked crate `marker`
|
= help: if you wanted to use a crate named `marker`, use `cargo add marker` to add it to your `Cargo.toml`
help: consider importing this module
|
1 + use std::marker;
|
2 changes: 1 addition & 1 deletion tests/ui/compile-fail/pin_data/twice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ error[E0428]: the name `FooProjection` is defined multiple times
= note: `FooProjection` must be defined only once in the type namespace of this module
= note: this error originates in the attribute macro `pin_data` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `HasPinData` for type `Foo`
error[E0119]: conflicting implementations of trait `pin_init::__internal::HasPinData` for type `Foo`
--> tests/ui/compile-fail/pin_data/twice.rs:4:1
|
3 | #[pin_data]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/compile-fail/pinned_drop/no_fn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ error[E0046]: not all trait items implemented, missing: `drop`
7 | impl PinnedDrop for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(self: Pin<&mut Self>, _: OnlyCallFromDrop) { todo!() }`
= help: implement the missing item: `fn drop(self: Pin<&mut Self>, _: pin_init::__internal::OnlyCallFromDrop) { todo!() }`
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error[E0277]: the trait bound `Foo: HasPinData` is not satisfied
error[E0277]: the trait bound `Foo: pin_init::__internal::HasPinData` is not satisfied
--> tests/ui/compile-fail/pinned_drop/no_pin_data_but_pinned_drop.rs:7:21
|
7 | impl PinnedDrop for Foo {
| ^^^ unsatisfied trait bound
|
help: the trait `HasPinData` is not implemented for `Foo`
help: the trait `pin_init::__internal::HasPinData` is not implemented for `Foo`
--> tests/ui/compile-fail/pinned_drop/no_pin_data_but_pinned_drop.rs:4:1
|
4 | struct Foo {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/compile-fail/pinned_drop/unexpected_item.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ error[E0046]: not all trait items implemented, missing: `drop`
7 | impl PinnedDrop for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(self: Pin<&mut Self>, _: OnlyCallFromDrop) { todo!() }`
= help: implement the missing item: `fn drop(self: Pin<&mut Self>, _: pin_init::__internal::OnlyCallFromDrop) { todo!() }`
4 changes: 2 additions & 2 deletions tests/ui/compile-fail/pinned_drop/wrong_receiver.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ error[E0053]: method `drop` has an incompatible type for trait
8 | fn drop(&mut self) {}
| ^^^^^^^^^ expected `Pin<&mut Foo>`, found `&mut Foo`
|
= note: expected signature `fn(Pin<&mut Foo>, OnlyCallFromDrop)`
found signature `fn(&mut Foo, OnlyCallFromDrop)`
= note: expected signature `fn(Pin<&mut Foo>, pin_init::__internal::OnlyCallFromDrop)`
found signature `fn(&mut Foo, pin_init::__internal::OnlyCallFromDrop)`
help: change the self-receiver type to match the trait
|
8 - fn drop(&mut self) {}
Expand Down