All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
Remove deprecated #[project], #[project_ref], and #[project_replace] attributes.
Name the projected type by passing an argument with the same name as the method to the #[pin_project] attribute instead:
- #[pin_project] + #[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } - #[project] fn func<T>(x: Pin<&mut Enum<T>>) { - #[project] match x.project() { - Enum::Variant(_) => { /* ... */ } + EnumProj::Variant(_) => { /* ... */ } } }
Remove deprecated Replace argument from #[pin_project] attribute. Use project_replace argument instead.
Raise the minimum supported Rust version of this crate from Rust 1.34 to Rust 1.37.
Suppress explicit_outlives_requirements, box_pointers, clippy::large_enum_variant, clippy::pattern_type_mismatch, clippy::implicit_return, and clippy::redundant_pub_crate lints in generated code. (#276, #277, #284)
Diagnostic improvements.
Changes since the 1.0.0-alpha.1 release:
Update minimal version of syn to 1.0.44
Remove deprecated #[project], #[project_ref], and #[project_replace] attributes.
Name the projected type by passing an argument with the same name as the method to the #[pin_project] attribute instead:
- #[pin_project] + #[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } - #[project] fn func<T>(x: Pin<&mut Enum<T>>) { - #[project] match x.project() { - Enum::Variant(_) => { /* ... */ } + EnumProj::Variant(_) => { /* ... */ } } }
Remove deprecated Replace argument from #[pin_project] attribute. Use project_replace argument instead.
Suppress explicit_outlives_requirements, box_pointers, clippy::large_enum_variant, clippy::pattern_type_mismatch, and clippy::implicit_return lints in generated code. (#276, #277)
Diagnostic improvements.
See also tracking issue for 1.0 release.
syn to 1.0.44Suppress drop_bounds lint, which will be added to rustc in the future. See #272 for more details.
(Note: 1.0.0-alpha.1 already contains this change.)
Fix compatibility of generated code with forbid(future_incompatible)
Note: This does not guarantee compatibility with forbid(future_incompatible) in the future. If rustc adds a new lint, we may not be able to keep this.
Consider naming the projected type by passing an argument with the same name as the method to the #[pin_project] attribute instead.
#[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } fn func<T>(x: Pin<&mut Enum<T>>) { match x.project() { EnumProj::Variant(y) => { let _: Pin<&mut T> = y; } } }
See #225 for more details.
Diagnostic improvements.
You can now use project_replace argument without Replace argument. This used to require you to specify both.
- #[pin_project(Replace, project_replace = EnumProjOwn)] + #[pin_project(project_replace = EnumProjOwn)] enum Enum<T> { Variant(#[pin] T) }
Makes project_replace argument an alias for Replace argument so that it can be used without a value.
#[pin_project(project_replace)] enum Enum<T> { Variant(#[pin] T) }
The Replace argument will be deprecated in the future.
Suppress unreachable_pub lint in generated code.
Support Self in more syntax positions inside #[pinned_drop] impl.
Documentation improvements.
Diagnostic improvements.
Support naming the projection types.
By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method:
#[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } fn func<T>(x: Pin<&mut Enum<T>>) { match x.project() { EnumProj::Variant(y) => { let _: Pin<&mut T> = y; } } }
Added !Unpin option to #[pin_project] attribute for guarantee the type is !Unpin.
#[pin_project(!Unpin)] struct Struct<T, U> { field: T, }
This is equivalent to use #[pin] attribute for PhantomPinned field.
#[pin_project] struct Struct<T, U> { field: T, #[pin] // Note that using `PhantomPinned` without `#[pin]` attribute has no effect. _pin: PhantomPinned, }
Note: This raises the minimum supported Rust version of this crate from Rust 1.33 to Rust 1.34.
Fixed an issue where duplicate #[project] attributes were ignored.
Hide generated items from --document-private-items. See #211 for details.
Documentation improvements.
Note: This release has been yanked. See #206 for details.
Fixed an issue that #[project] on non-statement expression does not work without unstable features.
Suppress clippy::needless_pass_by_value lint in generated code of #[pinned_drop].
Documentation improvements.
Diagnostic improvements.
Added project_replace method and #[project_replace] attribute. project_replace method is optional and can be enabled by passing the Replace argument to #[pin_project] attribute. See the documentation for more details.
Support Self and self in more syntax positions inside #[pinned_drop] impl.
Hided all generated items except for projected types from calling code. See #192 for details.
Fixed lifetime inference error when associated types are used in fields.
#[project] attribute can now be used for if let expressions.
Ensured that users cannot implement PinnedDrop without proper attribute argument.
Fixed use of Self in expression position inside #[pinned_drop] impl.
Note: This release has been yanked. See #148 for details.
#[pin_project] can now interoperate with #[cfg()] on tuple structs and tuple variants.
Fixed support for DSTs(Dynamically Sized Types) on #[pin_project(UnsafeUnpin)]
Diagnostic improvements.
Note: This release has been yanked. See #148 for details.
Note: This release has been yanked. See #148 for details.
Note: This release has been yanked. See #148 for details.
Pin projection has become a safe operation. In the absence of other unsafe code that you write, it is impossible to cause undefined behavior.
#[unsafe_project] attribute has been replaced with #[pin_project] attribute. (#18, #33)
The Unpin argument has been removed - an Unpin impl is now generated by default.
Drop impls must be specified with #[pinned_drop] instead of via a normal Drop impl. (#18, #33, #86)
#[pin_project] can now be used for public type with private field types.
Removed “project_attr” feature and always enable #[project] attribute.
Changes since the 0.4.0-beta.1 release:
Changed the argument type of project method back to self: Pin<&mut Self>.
Removed “project_attr” feature and always enable #[project] attribute.
Changed #[pinned_drop] to trait implementation.
#[pinned_drop] impl<T> PinnedDrop for Foo<'_, T> { fn drop(mut self: Pin<&mut Self>) { **self.project().was_dropped = true; } }
Added some examples and generated code.
Diagnostic improvements.
Documentation improvements.
Added ‘project_into’ method to #[pin_project] types. This can be useful when returning a pin projection from a method.
fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> { self.project_into().pinned }
Prevented UnpinStruct from appearing in the document by default. See #71 for more details.
Improved document of generated code.. Also added an option to control the document of generated code. See #62 for more details.
clippy::drop_bounds lint in generated code.#[pin_project] attribute can now detect that the type used does not have its own drop implementation without actually implementing drop. This removed some restrictions.
proc-macro2, syn, and quote to 1.0.Pin projection has become a safe operation.
#[unsafe_project] has been replaced with #[pin_project].
The Unpin argument has been removed - an Unpin impl is now generated by default.
Drop impls must be specified with #[pinned_drop] instead of via a normal Drop impl.
Unpin impls must be specified with an impl of UnsafeUnpin, instead of implementing the normal Unpin trait.
Made #[project] attribute disabled by default.
See also tracking issue for 0.4 release.
proc-macro2, syn, and quote to 1.0.Note: This release has been yanked. See #16 for details.
Documentation improvements.
Updated minimum syn version to 0.15.22.
Removed unsafe_fields attribute.
Removed unsafe_variants attribute.
Made unsafe_fields optional.
Documentation improvements.
Added the feature to create projected enums to unsafe_project.
Added project attribute to support pattern matching.
unsafe_fields can now opt-out.
Added unsafe_variants attribute. This attribute is available if pin-project is built with the “unsafe_variants” feature.
unsafe_project.Unpin to both unsafe_project and unsafe_fields.Fixed dependencies.
Added unsafe_fields attribute.
unsafe_pin_project to unsafe_project.Note: This release has been yanked.
Initial release