From d38a05c10f6c284cc09646e459824e0cab419f90 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sat, 23 Aug 2025 19:33:27 +0200 Subject: [PATCH 01/20] removed pub downgrading to pub crate --- pin-project-internal/src/pin_project/derive.rs | 4 ++-- pin-project-internal/src/utils.rs | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index 8b620687..22f2d59c 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -13,7 +13,7 @@ use super::{ args::{Args, ProjReplace, UnpinImpl, parse_args}, }; use crate::utils::{ - ReplaceReceiver, SliceExt as _, Variants, determine_lifetime_name, determine_visibility, + ReplaceReceiver, SliceExt as _, Variants, determine_lifetime_name, insert_lifetime_and_bound, }; @@ -238,7 +238,7 @@ impl<'a> Context<'a> { project_ref: project_ref.is_some(), project_replace, proj: ProjectedType { - vis: determine_visibility(vis), + vis: vis.clone(), mut_ident: project.unwrap_or_else(|| format_ident!("__{}Projection", ident)), ref_ident: project_ref.unwrap_or_else(|| format_ident!("__{}ProjectionRef", ident)), own_ident, diff --git a/pin-project-internal/src/utils.rs b/pin-project-internal/src/utils.rs index 2e66247b..7c61071f 100644 --- a/pin-project-internal/src/utils.rs +++ b/pin-project-internal/src/utils.rs @@ -7,7 +7,7 @@ use quote::{ToTokens, quote, quote_spanned}; use syn::{ Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeParam, Macro, PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type, - TypeParamBound, TypePath, Variant, Visibility, WherePredicate, + TypeParamBound, TypePath, Variant, WherePredicate, parse::{Parse, ParseBuffer, ParseStream}, parse_quote, punctuated::Punctuated, @@ -74,18 +74,6 @@ pub(crate) fn insert_lifetime(generics: &mut Generics, lifetime: Lifetime) { generics.params.insert(0, LifetimeParam::new(lifetime).into()); } -/// Determines the visibility of the projected types and projection methods. -/// -/// If given visibility is `pub`, returned visibility is `pub(crate)`. -/// Otherwise, returned visibility is the same as given visibility. -pub(crate) fn determine_visibility(vis: &Visibility) -> Visibility { - if let Visibility::Public(token) = vis { - parse_quote_spanned!(token.span => pub(crate)) - } else { - vis.clone() - } -} - pub(crate) fn respan(node: &T, span: Span) -> T where T: ToTokens + Parse, From d51683a856cd179b0f86ec8b9ee7784e9c4be496 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 17:28:13 +0200 Subject: [PATCH 02/20] added optional pub prefix to force public visibility --- pin-project-internal/src/lib.rs | 19 +- pin-project-internal/src/pin_project/args.rs | 87 +++++++-- .../src/pin_project/derive.rs | 93 ++++++---- pin-project-internal/src/utils.rs | 14 +- tests/expand/explicit_pub/enum.expanded.rs | 170 ++++++++++++++++++ tests/expand/explicit_pub/enum.rs | 16 ++ tests/expand/explicit_pub/struct.expanded.rs | 149 +++++++++++++++ tests/expand/explicit_pub/struct.rs | 12 ++ .../explicit_pub/tuple_struct.expanded.rs | 123 +++++++++++++ tests/expand/explicit_pub/tuple_struct.rs | 8 + tests/ui/pin_project/invalid.rs | 12 ++ tests/ui/pin_project/invalid.stderr | 108 ++++++----- 12 files changed, 711 insertions(+), 100 deletions(-) create mode 100644 tests/expand/explicit_pub/enum.expanded.rs create mode 100644 tests/expand/explicit_pub/enum.rs create mode 100644 tests/expand/explicit_pub/struct.expanded.rs create mode 100644 tests/expand/explicit_pub/struct.rs create mode 100644 tests/expand/explicit_pub/tuple_struct.expanded.rs create mode 100644 tests/expand/explicit_pub/tuple_struct.rs diff --git a/pin-project-internal/src/lib.rs b/pin-project-internal/src/lib.rs index a6349240..a9819c41 100644 --- a/pin-project-internal/src/lib.rs +++ b/pin-project-internal/src/lib.rs @@ -68,6 +68,20 @@ use proc_macro::TokenStream; /// } /// ``` /// +/// By default, the visibility of the projected types and projection methods is +/// based on the original type, except `pub` which is downgraded to `pub(crate)`. +/// You can force `pub` visibility by passing a pub before the method name. +/// (In that case, you are also required to provide a name for the returned struct) +/// +/// ``` +/// # use pin_project::pin_project +/// #[pin_project(pub project = StructProj)] //force the project method and StructProj to be pub +/// struct Struct { +/// #[pin] +/// field: T, +/// } +/// ``` +/// /// Note that the projection types returned by `project` and `project_ref` have /// an additional lifetime at the beginning of generics. /// @@ -76,11 +90,6 @@ use proc_macro::TokenStream; /// ^^ /// ``` /// -/// The visibility of the projected types and projection methods is based on the -/// original type. However, if the visibility of the original type is `pub`, the -/// visibility of the projected types and the projection methods is downgraded -/// to `pub(crate)`. -/// /// # Safety /// /// This attribute is completely safe. In the absence of other `unsafe` code diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index 00593dc8..434d94bc 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -3,9 +3,7 @@ use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{ - Attribute, Error, Ident, Result, Token, - parse::{Parse, ParseStream}, - spanned::Spanned as _, + parse::{Parse, ParseStream}, spanned::Spanned as _, Attribute, Error, Ident, Result, Token, Visibility }; use super::PIN; @@ -64,11 +62,11 @@ pub(super) struct Args { /// `UnsafeUnpin` or `!Unpin` argument. pub(super) unpin_impl: UnpinImpl, /// `project = ` argument. - pub(super) project: Option, + pub(super) project: ProjArgs, /// `project_ref = ` argument. - pub(super) project_ref: Option, + pub(super) project_ref: ProjArgs, /// `project_replace [= ]` argument. - pub(super) project_replace: ProjReplace, + pub(super) project_replace: ProjArgs, } impl Parse for Args { @@ -103,11 +101,19 @@ impl Parse for Args { let mut unsafe_unpin = None; let mut not_unpin = None; let mut project = None; + let mut project_pub = false; let mut project_ref = None; + let mut project_ref_pub = false; let mut project_replace_value = None; let mut project_replace_span = None; + let mut project_replace_pub = false; + let mut visibility_pub = None; while !input.is_empty() { + if input.peek(Token![pub]) { + let pub_token: Token![pub] = input.parse()?; + visibility_pub.replace(pub_token.span()); + } if input.peek(Token![!]) { let bang: Token![!] = input.parse()?; if input.is_empty() { @@ -133,9 +139,11 @@ impl Parse for Args { } "project" => { project = Some(parse_value(input, &token, project.is_some())?.0); + project_pub = visibility_pub.take().is_some(); } "project_ref" => { project_ref = Some(parse_value(input, &token, project_ref.is_some())?.0); + project_ref_pub = visibility_pub.take().is_some(); } "project_replace" => { if input.peek(Token![=]) { @@ -143,6 +151,7 @@ impl Parse for Args { parse_value(input, &token, project_replace_span.is_some())?; project_replace_value = Some(value); project_replace_span = Some(span.span()); + project_replace_pub = visibility_pub.take().is_some(); } else if project_replace_span.is_some() { bail!(token, "duplicate `project_replace` argument"); } else { @@ -158,7 +167,12 @@ impl Parse for Args { _ => bail!(token, "unexpected argument: {}", token), } } - + if let Some(span) = visibility_pub { + return Err(Error::new( + span, + "`pub` can only be used on project, project_ref or named project_replace.", + )); + } if input.is_empty() { break; } @@ -181,7 +195,6 @@ impl Parse for Args { } } } - if let Some(span) = pinned_drop { if project_replace_span.is_some() { return Err(Error::new( @@ -190,10 +203,28 @@ impl Parse for Args { )); } } - let project_replace = match (project_replace_span, project_replace_value) { - (None, _) => ProjReplace::None, - (Some(span), Some(ident)) => ProjReplace::Named { ident, span }, - (Some(span), None) => ProjReplace::Unnamed { span }, + let project_replace = + match (project_replace_span, project_replace_value, project_replace_pub) { + (None, _, _) => ProjArgs::None, + (Some(span), Some(ident), false) => ProjArgs::Named { ident, span }, + (Some(span), Some(ident), true) => ProjArgs::NamedPublic { span, ident }, + (Some(span), None, false) => ProjArgs::Unnamed { span }, + (Some(span), None, true) => { + return Err(Error::new( + span, + "project_replace cannot be pub if it is not named", + )); + } + }; + let project = match (project, project_pub) { + (None, _) => ProjArgs::None, + (Some(ident), false) => ProjArgs::Named { span: ident.span(), ident }, + (Some(ident), true) => ProjArgs::NamedPublic { span: ident.span(), ident }, + }; + let project_ref = match (project_ref, project_ref_pub) { + (None, _) => ProjArgs::None, + (Some(ident), false) => ProjArgs::Named { span: ident.span(), ident }, + (Some(ident), true) => ProjArgs::NamedPublic { span: ident.span(), ident }, }; let unpin_impl = match (unsafe_unpin, not_unpin) { (None, None) => UnpinImpl::Default, @@ -221,8 +252,8 @@ pub(super) enum UnpinImpl { Negative(Span), } -/// `project_replace [= ]` argument. -pub(super) enum ProjReplace { +/// `[pub] project{,_ref,_replace} [= ]` argument. +pub(super) enum ProjArgs { None, /// `project_replace`. Unnamed { @@ -233,18 +264,40 @@ pub(super) enum ProjReplace { span: Span, ident: Ident, }, + NamedPublic { + span: Span, + ident: Ident, + }, } -impl ProjReplace { +impl ProjArgs { /// Return the span of this argument. pub(super) fn span(&self) -> Option { match self { Self::None => None, - Self::Named { span, .. } | Self::Unnamed { span, .. } => Some(*span), + Self::Named { span, .. } + | Self::Unnamed { span, .. } + | Self::NamedPublic { span, .. } => Some(*span), } } pub(super) fn ident(&self) -> Option<&Ident> { - if let Self::Named { ident, .. } = self { Some(ident) } else { None } + if let Self::Named { ident, .. } | Self::NamedPublic { ident, .. } = self { + Some(ident) + } else { + None + } + } + pub(super) fn vis(&self,default_vis: &Visibility) -> Visibility { + match self { + Self::NamedPublic { .. } => parse_quote_spanned!(default_vis.span() => pub), + _ => default_vis.clone(), + } + } + pub(super) fn is_some(&self) -> bool { + match self { + Self::None => false, + _ => true, + } } } diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index 22f2d59c..a60eb8b2 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -5,15 +5,18 @@ use quote::{ToTokens as _, format_ident, quote, quote_spanned}; use syn::{ Attribute, Error, Field, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, Index, Item, Lifetime, LifetimeParam, Meta, Result, Token, Type, Variant, Visibility, WhereClause, - parse_quote, punctuated::Punctuated, token, visit_mut::VisitMut as _, + parse_quote, + punctuated::Punctuated, + token::{self}, + visit_mut::VisitMut as _, }; use super::{ PIN, - args::{Args, ProjReplace, UnpinImpl, parse_args}, + args::{Args, ProjArgs, UnpinImpl, parse_args}, }; use crate::utils::{ - ReplaceReceiver, SliceExt as _, Variants, determine_lifetime_name, + ReplaceReceiver, SliceExt as _, Variants, determine_lifetime_name, determine_visibility, insert_lifetime_and_bound, }; @@ -132,7 +135,8 @@ fn global_allowed_lints() -> TokenStream { /// Returns attributes used on projected types. fn proj_allowed_lints(cx: &Context<'_>) -> (TokenStream, TokenStream, TokenStream) { let global_allowed_lints = global_allowed_lints(); - let proj_mut_allowed_lints = if cx.project { Some(&global_allowed_lints) } else { None }; + let proj_mut_allowed_lints = + if cx.project.is_some() { Some(&global_allowed_lints) } else { None }; let proj_mut = quote! { #[allow( dead_code, // This lint warns unused fields/variants. @@ -141,7 +145,8 @@ fn proj_allowed_lints(cx: &Context<'_>) -> (TokenStream, TokenStream, TokenStrea clippy::mut_mut // This lint warns `&mut &mut `. )] }; - let proj_ref_allowed_lints = if cx.project_ref { Some(&global_allowed_lints) } else { None }; + let proj_ref_allowed_lints = + if cx.project_ref.is_some() { Some(&global_allowed_lints) } else { None }; let proj_ref = quote! { #[allow( dead_code, // This lint warns unused fields/variants. @@ -182,12 +187,12 @@ struct Context<'a> { pinned_drop: Option, /// `UnsafeUnpin` or `!Unpin` argument. unpin_impl: UnpinImpl, - /// `project` argument. - project: bool, - /// `project_ref` argument. - project_ref: bool, - /// `project_replace [= ]` argument. - project_replace: ProjReplace, + /// `[pub] project` argument. + project: ProjArgs, + /// `[pub] project_ref` argument. + project_ref: ProjArgs, + /// `[pub] project_replace [= ]` argument. + project_replace: ProjArgs, } impl<'a> Context<'a> { @@ -201,7 +206,7 @@ impl<'a> Context<'a> { let Args { pinned_drop, unpin_impl, project, project_ref, project_replace } = parse_args(attrs)?; - if let Some(name) = [project.as_ref(), project_ref.as_ref(), project_replace.ident()] + if let Some(name) = [project.ident(), project_ref.ident(), project_replace.ident()] .iter() .filter_map(Option::as_ref) .find(|name| **name == ident) @@ -229,18 +234,24 @@ impl<'a> Context<'a> { .ident() .cloned() .unwrap_or_else(|| format_ident!("__{}ProjectionOwned", ident)); + let mut_ident = + project.ident().cloned().unwrap_or_else(|| format_ident!("__{}Projection", ident)); + let ref_ident = project_ref + .ident() + .cloned() + .unwrap_or_else(|| format_ident!("__{}ProjectionRef", ident)); Ok(Self { kind, pinned_drop, unpin_impl, - project: project.is_some(), - project_ref: project_ref.is_some(), + project, + project_ref, project_replace, proj: ProjectedType { - vis: vis.clone(), - mut_ident: project.unwrap_or_else(|| format_ident!("__{}Projection", ident)), - ref_ident: project_ref.unwrap_or_else(|| format_ident!("__{}ProjectionRef", ident)), + vis: determine_visibility(vis), + mut_ident, + ref_ident, own_ident, lifetime, generics: proj_generics, @@ -369,7 +380,7 @@ fn parse_struct<'a>( let proj_ident = &cx.proj.mut_ident; let proj_ref_ident = &cx.proj.ref_ident; let proj_own_ident = &cx.proj.own_ident; - let vis = &cx.proj.vis; + let default_vis = &cx.proj.vis; let mut orig_generics = cx.orig.generics.clone(); let orig_where_clause = orig_generics.where_clause.take(); let proj_generics = &cx.proj.generics; @@ -392,18 +403,21 @@ fn parse_struct<'a>( }; let (proj_attrs, proj_ref_attrs, proj_own_attrs) = proj_allowed_lints(cx); - generate.extend(cx.project, quote! { + let project_vis = cx.project.vis(default_vis); + generate.extend(cx.project.is_some(), quote! { #proj_attrs - #vis struct #proj_ident #proj_generics #where_clause_fields + #project_vis struct #proj_ident #proj_generics #where_clause_fields }); - generate.extend(cx.project_ref, quote! { + let project_ref_vis = cx.project_ref.vis(default_vis); + generate.extend(cx.project_ref.is_some(), quote! { #proj_ref_attrs - #vis struct #proj_ref_ident #proj_generics #where_clause_ref_fields + #project_ref_vis struct #proj_ref_ident #proj_generics #where_clause_ref_fields }); + let project_own_vis = cx.project_replace.vis(default_vis); if cx.project_replace.span().is_some() { generate.extend(cx.project_replace.ident().is_some(), quote! { #proj_own_attrs - #vis struct #proj_own_ident #orig_generics #where_clause_own_fields + #project_own_vis struct #proj_own_ident #orig_generics #where_clause_own_fields }); } @@ -431,7 +445,7 @@ fn parse_enum<'a>( variants: &'a Punctuated, generate: &mut GenerateTokens, ) -> Result<()> { - if let ProjReplace::Unnamed { span } = &cx.project_replace { + if let ProjArgs::Unnamed { span } = &cx.project_replace { return Err(Error::new( *span, "`project_replace` argument requires a value when used on enums", @@ -459,33 +473,37 @@ fn parse_enum<'a>( let proj_ident = &cx.proj.mut_ident; let proj_ref_ident = &cx.proj.ref_ident; let proj_own_ident = &cx.proj.own_ident; - let vis = &cx.proj.vis; + let default_vis = &cx.proj.vis; let mut orig_generics = cx.orig.generics.clone(); let orig_where_clause = orig_generics.where_clause.take(); let proj_generics = &cx.proj.generics; let proj_where_clause = &cx.proj.where_clause; let (proj_attrs, proj_ref_attrs, proj_own_attrs) = proj_allowed_lints(cx); - if cx.project { + + let project_vis = cx.project.vis(default_vis); + if cx.project.is_some() { generate.extend(true, quote! { #proj_attrs - #vis enum #proj_ident #proj_generics #proj_where_clause { + #project_vis enum #proj_ident #proj_generics #proj_where_clause { #proj_variants } }); } - if cx.project_ref { + let project_ref_vis = cx.project_ref.vis(default_vis); + if cx.project_ref.is_some() { generate.extend(true, quote! { #proj_ref_attrs - #vis enum #proj_ref_ident #proj_generics #proj_where_clause { + #project_ref_vis enum #proj_ref_ident #proj_generics #proj_where_clause { #proj_ref_variants } }); } + let project_own_vis = cx.project_replace.vis(default_vis); if cx.project_replace.ident().is_some() { generate.extend(true, quote! { #proj_own_attrs - #vis enum #proj_own_ident #orig_generics #orig_where_clause { + #project_own_vis enum #proj_own_ident #orig_generics #orig_where_clause { #proj_own_variants } }); @@ -945,7 +963,7 @@ fn make_proj_impl( proj_ref_body: &TokenStream, proj_own_body: &TokenStream, ) -> TokenStream { - let vis = &cx.proj.vis; + let default_vis = &cx.proj.vis; let lifetime = &cx.proj.lifetime; let orig_ident = cx.orig.ident; let proj_ident = &cx.proj.mut_ident; @@ -961,10 +979,11 @@ fn make_proj_impl( // code, so we allow warnings for all methods for now. let allow_dead_code = quote! { #[allow(dead_code)] }; + let project_vis = cx.project.vis(default_vis); let mut project = Some(quote! { #allow_dead_code #[inline] - #vis fn project<#lifetime>( + #project_vis fn project<#lifetime>( self: _pin_project::__private::Pin<&#lifetime mut Self>, ) -> #proj_ident #proj_ty_generics { unsafe { @@ -972,10 +991,11 @@ fn make_proj_impl( } } }); + let project_ref_vis = cx.project_ref.vis(default_vis); let mut project_ref = Some(quote! { #allow_dead_code #[inline] - #vis fn project_ref<#lifetime>( + #project_ref_vis fn project_ref<#lifetime>( self: _pin_project::__private::Pin<&#lifetime Self>, ) -> #proj_ref_ident #proj_ty_generics { unsafe { @@ -983,10 +1003,11 @@ fn make_proj_impl( } } }); + let project_own_vis = cx.project_replace.vis(default_vis); let mut project_replace = cx.project_replace.span().map(|span| { // It is enough to only set the span of the signature. let sig = quote_spanned! { span => - #vis fn project_replace( + #project_own_vis fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> #proj_own_ident #orig_ty_generics @@ -1012,10 +1033,10 @@ fn make_proj_impl( }); if cx.kind == Enum { - if !cx.project { + if !cx.project.is_some() { project = None; } - if !cx.project_ref { + if !cx.project_ref.is_some() { project_ref = None; } if cx.project_replace.ident().is_none() { diff --git a/pin-project-internal/src/utils.rs b/pin-project-internal/src/utils.rs index 7c61071f..af573482 100644 --- a/pin-project-internal/src/utils.rs +++ b/pin-project-internal/src/utils.rs @@ -7,7 +7,7 @@ use quote::{ToTokens, quote, quote_spanned}; use syn::{ Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeParam, Macro, PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type, - TypeParamBound, TypePath, Variant, WherePredicate, + TypeParamBound, TypePath, Variant, Visibility, WherePredicate, parse::{Parse, ParseBuffer, ParseStream}, parse_quote, punctuated::Punctuated, @@ -74,6 +74,18 @@ pub(crate) fn insert_lifetime(generics: &mut Generics, lifetime: Lifetime) { generics.params.insert(0, LifetimeParam::new(lifetime).into()); } +/// Determines the default visibility of the projected types and projection methods. +/// +/// If given visibility is `pub`, returned visibility is `pub(crate)`. +/// Otherwise, returned visibility is the same as given visibility. +pub(crate) fn determine_visibility(vis: &Visibility) -> Visibility { + if let Visibility::Public(token) = vis { + parse_quote_spanned!(token.span => pub(crate)) + } else { + vis.clone() + } +} + pub(crate) fn respan(node: &T, span: Span) -> T where T: ToTokens + Parse, diff --git a/tests/expand/explicit_pub/enum.expanded.rs b/tests/expand/explicit_pub/enum.expanded.rs new file mode 100644 index 00000000..8846e9d0 --- /dev/null +++ b/tests/expand/explicit_pub/enum.expanded.rs @@ -0,0 +1,170 @@ +use pin_project::pin_project; +#[pin(__private(pub project = EnumProj, pub project_ref = EnumProjRef))] +pub enum Enum { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items, + clippy::mut_mut +)] +pub enum EnumProj<'pin, T, U> +where + Enum: 'pin, +{ + Struct { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + }, + Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)), + Unit, +} +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items, + clippy::ref_option_ref +)] +pub enum EnumProjRef<'pin, T, U> +where + Enum: 'pin, +{ + Struct { pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U) }, + Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)), + Unit, +} +#[allow( + unused_qualifications, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::elidable_lifetime_names, + clippy::missing_const_for_fn, + clippy::needless_lifetimes, + clippy::semicolon_if_nothing_returned, + clippy::use_self, + clippy::used_underscore_binding +)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl Enum { + #[allow(dead_code)] + #[inline] + pub fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> EnumProj<'pin, T, U> { + unsafe { + match self.get_unchecked_mut() { + Self::Struct { pinned, unpinned } => { + EnumProj::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + EnumProj::Tuple( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + Self::Unit => EnumProj::Unit, + } + } + } + #[allow(dead_code)] + #[inline] + pub fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> EnumProjRef<'pin, T, U> { + unsafe { + match self.get_ref() { + Self::Struct { pinned, unpinned } => { + EnumProjRef::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + EnumProjRef::Tuple( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + Self::Unit => EnumProjRef::Unit, + } + } + } + } + #[allow(missing_debug_implementations, unnameable_types)] + pub struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum + where + _pin_project::__private::PinnedFieldsOf< + __Enum<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum + where + _pin_project::__private::PinnedFieldsOf< + __Enum<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for Enum {} + #[doc(hidden)] + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/tests/expand/explicit_pub/enum.rs b/tests/expand/explicit_pub/enum.rs new file mode 100644 index 00000000..7fa9c8f0 --- /dev/null +++ b/tests/expand/explicit_pub/enum.rs @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use pin_project::pin_project; + +#[pin_project(pub project = EnumProj, pub project_ref = EnumProjRef)] +pub enum Enum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/tests/expand/explicit_pub/struct.expanded.rs b/tests/expand/explicit_pub/struct.expanded.rs new file mode 100644 index 00000000..e714ee07 --- /dev/null +++ b/tests/expand/explicit_pub/struct.expanded.rs @@ -0,0 +1,149 @@ +use pin_project::pin_project; +#[pin(__private(pub project = StructProj, project_ref = StructProjRef))] +pub struct Struct { + #[pin] + pub pinned: T, + pub unpinned: U, +} +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items, + clippy::mut_mut +)] +pub struct StructProj<'pin, T, U> +where + Struct: 'pin, +{ + pub pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + pub unpinned: &'pin mut (U), +} +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items, + clippy::ref_option_ref +)] +pub(crate) struct StructProjRef<'pin, T, U> +where + Struct: 'pin, +{ + pub pinned: ::pin_project::__private::Pin<&'pin (T)>, + pub unpinned: &'pin (U), +} +#[allow( + unused_qualifications, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::elidable_lifetime_names, + clippy::missing_const_for_fn, + clippy::needless_lifetimes, + clippy::semicolon_if_nothing_returned, + clippy::use_self, + clippy::used_underscore_binding +)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl Struct { + #[allow(dead_code)] + #[inline] + pub fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> StructProj<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + StructProj { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[inline] + pub(crate) fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> StructProjRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + StructProjRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed(this: &Struct) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations, unnameable_types)] + pub struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct + where + _pin_project::__private::PinnedFieldsOf< + __Struct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct + where + _pin_project::__private::PinnedFieldsOf< + __Struct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for Struct {} + #[doc(hidden)] + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/tests/expand/explicit_pub/struct.rs b/tests/expand/explicit_pub/struct.rs new file mode 100644 index 00000000..1bea90e3 --- /dev/null +++ b/tests/expand/explicit_pub/struct.rs @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use pin_project::pin_project; + +#[pin_project(pub project = StructProj, project_ref = StructProjRef)] +pub struct Struct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +fn main() {} diff --git a/tests/expand/explicit_pub/tuple_struct.expanded.rs b/tests/expand/explicit_pub/tuple_struct.expanded.rs new file mode 100644 index 00000000..618a256f --- /dev/null +++ b/tests/expand/explicit_pub/tuple_struct.expanded.rs @@ -0,0 +1,123 @@ +use pin_project::pin_project; +#[pin(__private(pub project = TupleStructProj))] +pub struct TupleStruct(#[pin] pub T, pub U); +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items, + clippy::mut_mut +)] +pub struct TupleStructProj<'pin, T, U>( + pub ::pin_project::__private::Pin<&'pin mut (T)>, + pub &'pin mut (U), +) +where + TupleStruct: 'pin; +#[allow( + unused_qualifications, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::elidable_lifetime_names, + clippy::missing_const_for_fn, + clippy::needless_lifetimes, + clippy::semicolon_if_nothing_returned, + clippy::use_self, + clippy::used_underscore_binding +)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( + pub ::pin_project::__private::Pin<&'pin (T)>, + pub &'pin (U), + ) + where + TupleStruct: 'pin; + impl TupleStruct { + #[allow(dead_code)] + #[inline] + pub fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> TupleStructProj<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + TupleStructProj(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + } + #[allow(dead_code)] + #[inline] + pub(crate) fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __TupleStructProjectionRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + __TupleStructProjectionRef( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed(this: &TupleStruct) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations, unnameable_types)] + pub struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct + where + _pin_project::__private::PinnedFieldsOf< + __TupleStruct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct + where + _pin_project::__private::PinnedFieldsOf< + __TupleStruct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for TupleStruct {} + #[doc(hidden)] + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/tests/expand/explicit_pub/tuple_struct.rs b/tests/expand/explicit_pub/tuple_struct.rs new file mode 100644 index 00000000..7223617d --- /dev/null +++ b/tests/expand/explicit_pub/tuple_struct.rs @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use pin_project::pin_project; + +#[pin_project(pub project = TupleStructProj)] +pub struct TupleStruct(#[pin] pub T, pub U); + +fn main() {} diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs index 9867ce65..badeb95a 100644 --- a/tests/ui/pin_project/invalid.rs +++ b/tests/ui/pin_project/invalid.rs @@ -193,6 +193,18 @@ mod pin_project_argument { enum ProjectReplaceEnum { V(#[pin] ()), } + + #[pin_project(pub)] //~ Error `pub` can only be used on project, project_ref or named project_replace. + struct Pub1(#[pin] ()); + + #[pin_project(pub Unpin)] //~ Error `pub` can only be used on project, project_ref or named project_replace. + struct Pub2(#[pin] ()); + + #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named + struct Pub3(#[pin] ()); + + #[pin_project(pub project_replace = Pub4ProjReplace, pub Project = Pub4Proj)] // Ok + struct Pub4(#[pin] ()); } mod pin_project_conflict_naming { diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index 01f1bf82..f707c0db 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -250,115 +250,141 @@ error: `project_replace` argument requires a value when used on enums 192 | #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums | ^^^^^^^^^^^^^^^ +error: unexpected end of input, expected identifier + --> tests/ui/pin_project/invalid.rs:197:5 + | +197 | #[pin_project(pub)] //~ Error `pub` can only be used on project, project_ref or named project_replace. + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected argument: Unpin + --> tests/ui/pin_project/invalid.rs:200:23 + | +200 | #[pin_project(pub Unpin)] //~ Error `pub` can only be used on project, project_ref or named project_replace. + | ^^^^^ + +error: `pub` can only be used on project, project_ref or named project_replace. + --> tests/ui/pin_project/invalid.rs:203:19 + | +203 | #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named + | ^^^ + +error: unexpected argument: Project + --> tests/ui/pin_project/invalid.rs:206:62 + | +206 | #[pin_project(pub project_replace = Pub4ProjReplace, pub Project = Pub4Proj)] // Ok + | ^^^^^^^ + error: name `OrigAndProj` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:201:29 + --> tests/ui/pin_project/invalid.rs:213:29 | -201 | #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name +213 | #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name | ^^^^^^^^^^^ error: name `OrigAndProjRef` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:204:33 + --> tests/ui/pin_project/invalid.rs:216:33 | -204 | #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name +216 | #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `OrigAndProjOwn` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:207:37 + --> tests/ui/pin_project/invalid.rs:219:37 | -207 | #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name +219 | #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `A` is already specified by `project` argument - --> tests/ui/pin_project/invalid.rs:210:46 + --> tests/ui/pin_project/invalid.rs:222:46 | -210 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument +222 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project` argument - --> tests/ui/pin_project/invalid.rs:213:50 + --> tests/ui/pin_project/invalid.rs:225:50 | -213 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument +225 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project_ref` argument - --> tests/ui/pin_project/invalid.rs:216:54 + --> tests/ui/pin_project/invalid.rs:228:54 | -216 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument +228 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument | ^ error: duplicate #[pin_project] attribute - --> tests/ui/pin_project/invalid.rs:224:5 + --> tests/ui/pin_project/invalid.rs:236:5 | -224 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute +236 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:232:19 + --> tests/ui/pin_project/invalid.rs:244:19 | -232 | struct Struct {} //~ ERROR may not be used on structs with zero fields +244 | struct Struct {} //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:235:23 + --> tests/ui/pin_project/invalid.rs:247:23 | -235 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields +247 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:238:12 + --> tests/ui/pin_project/invalid.rs:250:12 | -238 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields +250 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields | ^^^^^^^^^^ error: #[pin_project] attribute may not be used on enums without variants - --> tests/ui/pin_project/invalid.rs:241:20 + --> tests/ui/pin_project/invalid.rs:253:20 | -241 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants +253 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants | ^^ error: #[pin_project] attribute may not be used on enums with discriminants - --> tests/ui/pin_project/invalid.rs:245:13 + --> tests/ui/pin_project/invalid.rs:257:13 | -245 | V = 2, //~ ERROR may not be used on enums with discriminants +257 | V = 2, //~ ERROR may not be used on enums with discriminants | ^ error: #[pin_project] attribute may not be used on enums with zero fields - --> tests/ui/pin_project/invalid.rs:250:9 + --> tests/ui/pin_project/invalid.rs:262:9 | -250 | / Unit, //~ ERROR may not be used on enums with zero fields -251 | | Tuple(), -252 | | Struct {}, +262 | / Unit, //~ ERROR may not be used on enums with zero fields +263 | | Tuple(), +264 | | Struct {}, | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> tests/ui/pin_project/invalid.rs:256:5 + --> tests/ui/pin_project/invalid.rs:268:5 | -256 | / union Union { -257 | | //~^ ERROR may only be used on structs or enums -258 | | f: (), -259 | | } +268 | / union Union { +269 | | //~^ ERROR may only be used on structs or enums +270 | | f: (), +271 | | } | |_____^ error: #[pin_project] attribute may only be used on structs or enums - --> tests/ui/pin_project/invalid.rs:262:5 + --> tests/ui/pin_project/invalid.rs:274:5 | -262 | impl Impl {} //~ ERROR may only be used on structs or enums +274 | impl Impl {} //~ ERROR may only be used on structs or enums | ^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:270:12 + --> tests/ui/pin_project/invalid.rs:282:12 | -270 | #[repr(packed)] +282 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:274:12 + --> tests/ui/pin_project/invalid.rs:286:12 | -274 | #[repr(packed)] +286 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:278:12 + --> tests/ui/pin_project/invalid.rs:290:12 | -278 | #[repr(packed)] +290 | #[repr(packed)] | ^^^^^^ From 1885a4e9c704855af8e99732a215f0c3a980522b Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 17:37:19 +0200 Subject: [PATCH 03/20] formated --- pin-project-internal/src/pin_project/args.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index 434d94bc..5b4a27d3 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -3,7 +3,9 @@ use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{ - parse::{Parse, ParseStream}, spanned::Spanned as _, Attribute, Error, Ident, Result, Token, Visibility + Attribute, Error, Ident, Result, Token, Visibility, + parse::{Parse, ParseStream}, + spanned::Spanned as _, }; use super::PIN; @@ -288,7 +290,7 @@ impl ProjArgs { None } } - pub(super) fn vis(&self,default_vis: &Visibility) -> Visibility { + pub(super) fn vis(&self, default_vis: &Visibility) -> Visibility { match self { Self::NamedPublic { .. } => parse_quote_spanned!(default_vis.span() => pub), _ => default_vis.clone(), From ef0b84137828832ca4627fdb32c877a737d59e57 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 18:19:11 +0200 Subject: [PATCH 04/20] format --- pin-project-internal/src/pin_project/derive.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index a60eb8b2..6af03762 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -5,10 +5,7 @@ use quote::{ToTokens as _, format_ident, quote, quote_spanned}; use syn::{ Attribute, Error, Field, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, Index, Item, Lifetime, LifetimeParam, Meta, Result, Token, Type, Variant, Visibility, WhereClause, - parse_quote, - punctuated::Punctuated, - token::{self}, - visit_mut::VisitMut as _, + parse_quote, punctuated::Punctuated, token, visit_mut::VisitMut as _, }; use super::{ From 5368cea0b4821432a38d041133a696a35242b799 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 18:24:30 +0200 Subject: [PATCH 05/20] less misleading exemple in doc --- pin-project-internal/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pin-project-internal/src/lib.rs b/pin-project-internal/src/lib.rs index a9819c41..b95e6d6a 100644 --- a/pin-project-internal/src/lib.rs +++ b/pin-project-internal/src/lib.rs @@ -76,7 +76,7 @@ use proc_macro::TokenStream; /// ``` /// # use pin_project::pin_project /// #[pin_project(pub project = StructProj)] //force the project method and StructProj to be pub -/// struct Struct { +/// pub struct Struct { /// #[pin] /// field: T, /// } From c391364c5278c542f5b7461fe55134f40c2e2f54 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 18:29:29 +0200 Subject: [PATCH 06/20] fixed typo in doc --- pin-project-internal/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pin-project-internal/src/lib.rs b/pin-project-internal/src/lib.rs index b95e6d6a..0e0cc66f 100644 --- a/pin-project-internal/src/lib.rs +++ b/pin-project-internal/src/lib.rs @@ -74,7 +74,7 @@ use proc_macro::TokenStream; /// (In that case, you are also required to provide a name for the returned struct) /// /// ``` -/// # use pin_project::pin_project +/// # use pin_project::pin_project; /// #[pin_project(pub project = StructProj)] //force the project method and StructProj to be pub /// pub struct Struct { /// #[pin] From a2ad1b7f451ddcbd25d887dd52c6cf55b4b6df70 Mon Sep 17 00:00:00 2001 From: louwenus Date: Sun, 24 Aug 2025 18:32:19 +0200 Subject: [PATCH 07/20] followed clippy hint --- pin-project-internal/src/pin_project/args.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index 5b4a27d3..a5243b5d 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -297,9 +297,6 @@ impl ProjArgs { } } pub(super) fn is_some(&self) -> bool { - match self { - Self::None => false, - _ => true, - } + !matches!(self, Self::None) } } From 15b4946e87f51f71420606c65ae86315e6fa8cb2 Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Tue, 2 Sep 2025 19:20:43 +0200 Subject: [PATCH 08/20] fixed error messages and associated tests --- pin-project-internal/src/pin_project/args.rs | 3 +++ tests/ui/pin_project/invalid.rs | 4 ++-- tests/ui/pin_project/invalid.stderr | 16 ++++------------ .../pin_project/project_replace_unsized.stderr | 9 +++------ .../project_replace_unsized_fn_params.stderr | 9 +++------ .../pin_project/remove-attr-from-struct.stderr | 12 ------------ 6 files changed, 15 insertions(+), 38 deletions(-) diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index a5243b5d..6326e7d0 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -114,6 +114,9 @@ impl Parse for Args { while !input.is_empty() { if input.peek(Token![pub]) { let pub_token: Token![pub] = input.parse()?; + if input.is_empty() { + bail!(pub_token, "`pub` can only be used on project, project_ref or named project_replace") + } visibility_pub.replace(pub_token.span()); } if input.peek(Token![!]) { diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs index badeb95a..cbc2e755 100644 --- a/tests/ui/pin_project/invalid.rs +++ b/tests/ui/pin_project/invalid.rs @@ -197,13 +197,13 @@ mod pin_project_argument { #[pin_project(pub)] //~ Error `pub` can only be used on project, project_ref or named project_replace. struct Pub1(#[pin] ()); - #[pin_project(pub Unpin)] //~ Error `pub` can only be used on project, project_ref or named project_replace. + #[pin_project(pub Unpin)] //~ Error unexpected argument: Unpin struct Pub2(#[pin] ()); #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named struct Pub3(#[pin] ()); - #[pin_project(pub project_replace = Pub4ProjReplace, pub Project = Pub4Proj)] // Ok + #[pin_project(pub project_replace = Pub4ProjReplace, pub project = Pub4Proj)] // Ok struct Pub4(#[pin] ()); } diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index f707c0db..f58c64d1 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -250,18 +250,16 @@ error: `project_replace` argument requires a value when used on enums 192 | #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums | ^^^^^^^^^^^^^^^ -error: unexpected end of input, expected identifier - --> tests/ui/pin_project/invalid.rs:197:5 +error: `pub` can only be used on project, project_ref or named project_replace + --> tests/ui/pin_project/invalid.rs:197:19 | 197 | #[pin_project(pub)] //~ Error `pub` can only be used on project, project_ref or named project_replace. - | ^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^ error: unexpected argument: Unpin --> tests/ui/pin_project/invalid.rs:200:23 | -200 | #[pin_project(pub Unpin)] //~ Error `pub` can only be used on project, project_ref or named project_replace. +200 | #[pin_project(pub Unpin)] //~ Error unexpected argument: Unpin | ^^^^^ error: `pub` can only be used on project, project_ref or named project_replace. @@ -270,12 +268,6 @@ error: `pub` can only be used on project, project_ref or named project_replace. 203 | #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named | ^^^ -error: unexpected argument: Project - --> tests/ui/pin_project/invalid.rs:206:62 - | -206 | #[pin_project(pub project_replace = Pub4ProjReplace, pub Project = Pub4Proj)] // Ok - | ^^^^^^^ - error: name `OrigAndProj` is the same as the original type name --> tests/ui/pin_project/invalid.rs:213:29 | diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 9b547a84..131ef5d1 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -101,14 +101,11 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | note: required by an implicit `Sized` bound in `std::ptr::read` --> $RUST/core/src/ptr/mod.rs - | - | pub const unsafe fn read(src: *const T) -> T { - | ^ required by the implicit `Sized` requirement on this type parameter in `read` help: consider removing the `?Sized` bound to make the type parameter `Sized` | - 6 - struct Struct { - 6 + struct Struct { - | +6 - struct Struct { +6 + struct Struct { + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> tests/ui/pin_project/project_replace_unsized.rs:10:15 diff --git a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr index 099068a1..527056a4 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -77,14 +77,11 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | note: required by an implicit `Sized` bound in `std::ptr::read` --> $RUST/core/src/ptr/mod.rs - | - | pub const unsafe fn read(src: *const T) -> T { - | ^ required by the implicit `Sized` requirement on this type parameter in `read` help: consider removing the `?Sized` bound to make the type parameter `Sized` | - 9 - struct Struct { - 9 + struct Struct { - | + 9 - struct Struct { + 9 + struct Struct { + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:13:1 diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 3ec96609..ab8c6be0 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -77,12 +77,6 @@ note: required because it appears within the type `A` | ^ note: required by a bound in `Pin::::new` --> $RUST/core/src/pin.rs - | - | impl> Pin { - | ^^^^^ required by this bound in `Pin::::new` -... - | pub const fn new(pointer: Ptr) -> Pin { - | --- required by a bound in this associated function error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope --> tests/ui/pin_project/remove-attr-from-struct.rs:42:30 @@ -107,12 +101,6 @@ note: required because it appears within the type `B` | ^ note: required by a bound in `Pin::::new` --> $RUST/core/src/pin.rs - | - | impl> Pin { - | ^^^^^ required by this bound in `Pin::::new` -... - | pub const fn new(pointer: Ptr) -> Pin { - | --- required by a bound in this associated function error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope --> tests/ui/pin_project/remove-attr-from-struct.rs:45:30 From f5c1b839bf5c289347b62acaf49b7898259dc41e Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Tue, 2 Sep 2025 19:28:20 +0200 Subject: [PATCH 09/20] fixed: marked unreachable place as such instead of returning an error --- pin-project-internal/src/pin_project/args.rs | 7 +------ tests/ui/pin_project/invalid.rs | 2 +- tests/ui/pin_project/invalid.stderr | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index 6326e7d0..647a3a42 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -214,12 +214,7 @@ impl Parse for Args { (Some(span), Some(ident), false) => ProjArgs::Named { ident, span }, (Some(span), Some(ident), true) => ProjArgs::NamedPublic { span, ident }, (Some(span), None, false) => ProjArgs::Unnamed { span }, - (Some(span), None, true) => { - return Err(Error::new( - span, - "project_replace cannot be pub if it is not named", - )); - } + (Some(_), None, true) => unreachable!(), }; let project = match (project, project_pub) { (None, _) => ProjArgs::None, diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs index cbc2e755..705949b4 100644 --- a/tests/ui/pin_project/invalid.rs +++ b/tests/ui/pin_project/invalid.rs @@ -200,7 +200,7 @@ mod pin_project_argument { #[pin_project(pub Unpin)] //~ Error unexpected argument: Unpin struct Pub2(#[pin] ()); - #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named + #[pin_project(pub project_replace)] //~ Error `pub` can only be used on project, project_ref or named project_replace. struct Pub3(#[pin] ()); #[pin_project(pub project_replace = Pub4ProjReplace, pub project = Pub4Proj)] // Ok diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index f58c64d1..d4b88130 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -265,7 +265,7 @@ error: unexpected argument: Unpin error: `pub` can only be used on project, project_ref or named project_replace. --> tests/ui/pin_project/invalid.rs:203:19 | -203 | #[pin_project(pub project_replace)] //~ Error project_replace cannot be pub if it is not named +203 | #[pin_project(pub project_replace)] //~ Error `pub` can only be used on project, project_ref or named project_replace. | ^^^ error: name `OrigAndProj` is the same as the original type name From 3dee8de6141f4dce9373ec9e4a6e88764b88bdaa Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Tue, 2 Sep 2025 19:34:05 +0200 Subject: [PATCH 10/20] Added expand test for pub project_replace --- .../explicit_pub/struct_replace.expanded.rs | 161 ++++++++++++++++++ tests/expand/explicit_pub/struct_replace.rs | 12 ++ 2 files changed, 173 insertions(+) create mode 100644 tests/expand/explicit_pub/struct_replace.expanded.rs create mode 100644 tests/expand/explicit_pub/struct_replace.rs diff --git a/tests/expand/explicit_pub/struct_replace.expanded.rs b/tests/expand/explicit_pub/struct_replace.expanded.rs new file mode 100644 index 00000000..798ef1b6 --- /dev/null +++ b/tests/expand/explicit_pub/struct_replace.expanded.rs @@ -0,0 +1,161 @@ +use pin_project::pin_project; +#[pin(__private(pub project_replace = StructProjReplace))] +pub struct Struct { + #[pin] + pub pinned: T, + pub unpinned: U, +} +#[allow( + dead_code, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::missing_docs_in_private_items +)] +pub struct StructProjReplace { + pub pinned: ::pin_project::__private::PhantomData, + pub unpinned: U, +} +#[allow( + unused_qualifications, + deprecated, + explicit_outlives_requirements, + single_use_lifetimes, + unreachable_pub, + unused_tuple_struct_fields, + clippy::unknown_clippy_lints, + clippy::absolute_paths, + clippy::min_ident_chars, + clippy::pattern_type_mismatch, + clippy::pub_with_shorthand, + clippy::redundant_pub_crate, + clippy::single_char_lifetime_names, + clippy::type_repetition_in_bounds, + clippy::elidable_lifetime_names, + clippy::missing_const_for_fn, + clippy::needless_lifetimes, + clippy::semicolon_if_nothing_returned, + clippy::use_self, + clippy::used_underscore_binding +)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + pub(crate) struct __StructProjection<'pin, T, U> + where + Struct: 'pin, + { + pub pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + pub unpinned: &'pin mut (U), + } + #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + pub(crate) struct __StructProjectionRef<'pin, T, U> + where + Struct: 'pin, + { + pub pinned: ::pin_project::__private::Pin<&'pin (T)>, + pub unpinned: &'pin (U), + } + impl Struct { + #[allow(dead_code)] + #[inline] + pub(crate) fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __StructProjection<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + __StructProjection { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[inline] + pub(crate) fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __StructProjectionRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + __StructProjectionRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[inline] + pub fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> StructProjReplace { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + let Self { pinned, unpinned } = &mut *__self_ptr; + let __result = StructProjReplace { + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), + }; + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + pinned, + ); + } + __result + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed(this: &Struct) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations, unnameable_types)] + pub struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct + where + _pin_project::__private::PinnedFieldsOf< + __Struct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct + where + _pin_project::__private::PinnedFieldsOf< + __Struct<'pin, T, U>, + >: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for Struct {} + #[doc(hidden)] + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/tests/expand/explicit_pub/struct_replace.rs b/tests/expand/explicit_pub/struct_replace.rs new file mode 100644 index 00000000..2096db82 --- /dev/null +++ b/tests/expand/explicit_pub/struct_replace.rs @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use pin_project::pin_project; + +#[pin_project(pub project_replace = StructProjReplace)] +pub struct Struct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +fn main() {} From 09fa04026ca3d2a98af3080440bdcaf0d277c55d Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Tue, 2 Sep 2025 19:45:00 +0200 Subject: [PATCH 11/20] format --- pin-project-internal/src/pin_project/args.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pin-project-internal/src/pin_project/args.rs b/pin-project-internal/src/pin_project/args.rs index 647a3a42..d8150514 100644 --- a/pin-project-internal/src/pin_project/args.rs +++ b/pin-project-internal/src/pin_project/args.rs @@ -115,7 +115,10 @@ impl Parse for Args { if input.peek(Token![pub]) { let pub_token: Token![pub] = input.parse()?; if input.is_empty() { - bail!(pub_token, "`pub` can only be used on project, project_ref or named project_replace") + bail!( + pub_token, + "`pub` can only be used on project, project_ref or named project_replace" + ) } visibility_pub.replace(pub_token.span()); } From 4afedd0ee04c0262e31cea2afd3168986bd98db8 Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Tue, 2 Sep 2025 20:18:56 +0200 Subject: [PATCH 12/20] trying to fix the CI --- tests/ui/pin_project/project_replace_unsized.stderr | 9 ++++++--- .../project_replace_unsized_fn_params.stderr | 9 ++++++--- tests/ui/pin_project/remove-attr-from-struct.stderr | 12 ++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 131ef5d1..9b547a84 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -101,11 +101,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | note: required by an implicit `Sized` bound in `std::ptr::read` --> $RUST/core/src/ptr/mod.rs -help: consider removing the `?Sized` bound to make the type parameter `Sized` | -6 - struct Struct { -6 + struct Struct { + | pub const unsafe fn read(src: *const T) -> T { + | ^ required by the implicit `Sized` requirement on this type parameter in `read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` | + 6 - struct Struct { + 6 + struct Struct { + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> tests/ui/pin_project/project_replace_unsized.rs:10:15 diff --git a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr index 527056a4..099068a1 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -77,11 +77,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | note: required by an implicit `Sized` bound in `std::ptr::read` --> $RUST/core/src/ptr/mod.rs -help: consider removing the `?Sized` bound to make the type parameter `Sized` | - 9 - struct Struct { - 9 + struct Struct { + | pub const unsafe fn read(src: *const T) -> T { + | ^ required by the implicit `Sized` requirement on this type parameter in `read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` | + 9 - struct Struct { + 9 + struct Struct { + | error[E0277]: the size for values of type `T` cannot be known at compilation time --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:13:1 diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index ab8c6be0..3ec96609 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -77,6 +77,12 @@ note: required because it appears within the type `A` | ^ note: required by a bound in `Pin::::new` --> $RUST/core/src/pin.rs + | + | impl> Pin { + | ^^^^^ required by this bound in `Pin::::new` +... + | pub const fn new(pointer: Ptr) -> Pin { + | --- required by a bound in this associated function error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope --> tests/ui/pin_project/remove-attr-from-struct.rs:42:30 @@ -101,6 +107,12 @@ note: required because it appears within the type `B` | ^ note: required by a bound in `Pin::::new` --> $RUST/core/src/pin.rs + | + | impl> Pin { + | ^^^^^ required by this bound in `Pin::::new` +... + | pub const fn new(pointer: Ptr) -> Pin { + | --- required by a bound in this associated function error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope --> tests/ui/pin_project/remove-attr-from-struct.rs:45:30 From 7652b5ae485b41f55be565338b95cb6d593d464d Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 22:52:34 +0200 Subject: [PATCH 13/20] added documentation to generated items --- .../src/pin_project/derive.rs | 42 ++++++++++++++++++- pin-project-internal/src/utils.rs | 11 +++++ tests/expand/default/enum.expanded.rs | 4 ++ tests/expand/default/struct.expanded.rs | 8 ++++ tests/expand/default/tuple_struct.expanded.rs | 8 ++++ tests/expand/explicit_pub/enum.expanded.rs | 4 ++ tests/expand/explicit_pub/struct.expanded.rs | 15 +++++++ tests/expand/explicit_pub/struct.rs | 3 ++ .../explicit_pub/struct_replace.expanded.rs | 10 +++++ .../explicit_pub/tuple_struct.expanded.rs | 8 ++++ tests/expand/multifields/enum.expanded.rs | 5 +++ tests/expand/multifields/struct.expanded.rs | 10 +++++ .../multifields/tuple_struct.expanded.rs | 10 +++++ tests/expand/naming/enum-all.expanded.rs | 5 +++ tests/expand/naming/enum-mut.expanded.rs | 2 + tests/expand/naming/enum-own.expanded.rs | 1 + tests/expand/naming/enum-ref.expanded.rs | 2 + tests/expand/naming/struct-all.expanded.rs | 10 +++++ tests/expand/naming/struct-mut.expanded.rs | 8 ++++ tests/expand/naming/struct-none.expanded.rs | 8 ++++ tests/expand/naming/struct-own.expanded.rs | 10 +++++ tests/expand/naming/struct-ref.expanded.rs | 8 ++++ .../naming/tuple_struct-all.expanded.rs | 10 +++++ .../naming/tuple_struct-mut.expanded.rs | 8 ++++ .../naming/tuple_struct-none.expanded.rs | 8 ++++ .../naming/tuple_struct-own.expanded.rs | 10 +++++ .../naming/tuple_struct-ref.expanded.rs | 8 ++++ tests/expand/not_unpin/enum.expanded.rs | 4 ++ tests/expand/not_unpin/struct.expanded.rs | 8 ++++ .../expand/not_unpin/tuple_struct.expanded.rs | 8 ++++ tests/expand/pinned_drop/enum.expanded.rs | 4 ++ tests/expand/pinned_drop/struct.expanded.rs | 8 ++++ .../pinned_drop/tuple_struct.expanded.rs | 8 ++++ tests/expand/project_replace/enum.expanded.rs | 1 + .../expand/project_replace/struct.expanded.rs | 10 +++++ .../project_replace/tuple_struct.expanded.rs | 10 +++++ tests/expand/pub/enum.expanded.rs | 4 ++ tests/expand/pub/struct.expanded.rs | 8 ++++ tests/expand/pub/tuple_struct.expanded.rs | 8 ++++ tests/expand/unsafe_unpin/enum.expanded.rs | 4 ++ tests/expand/unsafe_unpin/struct.expanded.rs | 8 ++++ .../unsafe_unpin/tuple_struct.expanded.rs | 8 ++++ tests/include/basic-safe-part.rs | 11 +++++ 43 files changed, 347 insertions(+), 1 deletion(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index 6af03762..a6146c39 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -279,7 +279,7 @@ struct OriginalType<'a> { } struct ProjectedType { - /// Visibility of the projected types. + /// Visibility of the projected type. vis: Visibility, /// Name of the projected type returned by `project` method. mut_ident: Ident, @@ -380,6 +380,7 @@ fn parse_struct<'a>( let default_vis = &cx.proj.vis; let mut orig_generics = cx.orig.generics.clone(); let orig_where_clause = orig_generics.where_clause.take(); + let orig_name = cx.orig.ident; let proj_generics = &cx.proj.generics; let proj_where_clause = &cx.proj.where_clause; @@ -400,20 +401,35 @@ fn parse_struct<'a>( }; let (proj_attrs, proj_ref_attrs, proj_own_attrs) = proj_allowed_lints(cx); + let project_vis = cx.project.vis(default_vis); + let project_doc = format!( + "A projected {0}. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut {0}> directly rather than this struct", + orig_name + ); generate.extend(cx.project.is_some(), quote! { #proj_attrs + #[doc = #project_doc] #project_vis struct #proj_ident #proj_generics #where_clause_fields }); + + let project_ref_doc = format!( + "A immutably projected {0}. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& {0}> directly rather than this struct",orig_name); let project_ref_vis = cx.project_ref.vis(default_vis); generate.extend(cx.project_ref.is_some(), quote! { #proj_ref_attrs + #[doc = #project_ref_doc] #project_ref_vis struct #proj_ref_ident #proj_generics #where_clause_ref_fields }); + + let project_own_doc = format!("A projection that own a {0}.", orig_name); let project_own_vis = cx.project_replace.vis(default_vis); if cx.project_replace.span().is_some() { generate.extend(cx.project_replace.ident().is_some(), quote! { #proj_own_attrs + #[doc = #project_own_doc] #project_own_vis struct #proj_own_ident #orig_generics #where_clause_own_fields }); } @@ -605,14 +621,18 @@ fn visit_fields<'a>( let binding = ident.clone().unwrap_or_else(|| format_ident!("_{}", i)); proj_pat.extend(quote!(#binding,)); let lifetime = &cx.proj.lifetime; + let doc = attrs.extract_doc(); if attrs.position_exact(PIN)?.is_some() { proj_fields.extend(quote! { + #doc #vis #ident #colon_token ::pin_project::__private::Pin<&#lifetime mut (#ty)>, }); proj_ref_fields.extend(quote! { + #doc #vis #ident #colon_token ::pin_project::__private::Pin<&#lifetime (#ty)>, }); proj_own_fields.extend(quote! { + #doc #vis #ident #colon_token ::pin_project::__private::PhantomData<#ty>, }); proj_body.extend(quote! { @@ -626,12 +646,15 @@ fn visit_fields<'a>( pinned_bindings.push(binding); } else { proj_fields.extend(quote! { + #doc #vis #ident #colon_token &#lifetime mut (#ty), }); proj_ref_fields.extend(quote! { + #doc #vis #ident #colon_token &#lifetime (#ty), }); proj_own_fields.extend(quote! { + #doc #vis #ident #colon_token #ty, }); proj_body.extend(quote! { @@ -968,6 +991,7 @@ fn make_proj_impl( let proj_own_ident = &cx.proj.own_ident; let orig_ty_generics = cx.orig.generics.split_for_impl().1; + let orig_name = cx.orig.ident; let proj_ty_generics = cx.proj.generics.split_for_impl().1; let (impl_generics, ty_generics, where_clause) = cx.orig.generics.split_for_impl(); // TODO: For enums and project_replace, dead_code warnings should not be @@ -977,9 +1001,13 @@ fn make_proj_impl( let allow_dead_code = quote! { #[allow(dead_code)] }; let project_vis = cx.project.vis(default_vis); + let project_doc = format!( + "Take a Pin<&mut {0}> and project it, aka return a {0}-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self",orig_name); let mut project = Some(quote! { #allow_dead_code #[inline] + #[doc = #project_doc] #project_vis fn project<#lifetime>( self: _pin_project::__private::Pin<&#lifetime mut Self>, ) -> #proj_ident #proj_ty_generics { @@ -988,10 +1016,16 @@ fn make_proj_impl( } } }); + let project_ref_vis = cx.project_ref.vis(default_vis); + let project_ref_doc = format!( + "Take a Pin<& {0}> and project it, aka return a {0}-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self",orig_name + ); let mut project_ref = Some(quote! { #allow_dead_code #[inline] + #[doc = #project_ref_doc] #project_ref_vis fn project_ref<#lifetime>( self: _pin_project::__private::Pin<&#lifetime Self>, ) -> #proj_ref_ident #proj_ty_generics { @@ -1000,7 +1034,12 @@ fn make_proj_impl( } } }); + let project_own_vis = cx.project_replace.vis(default_vis); + let project_own_doc = format!( + "Take a Pin<&mut {0}>, and a replacement. Replace the pinned {0} and return an owning projection", + orig_name + ); let mut project_replace = cx.project_replace.span().map(|span| { // It is enough to only set the span of the signature. let sig = quote_spanned! { span => @@ -1012,6 +1051,7 @@ fn make_proj_impl( quote! { #allow_dead_code #[inline] + #[doc = #project_own_doc] #sig { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); diff --git a/pin-project-internal/src/utils.rs b/pin-project-internal/src/utils.rs index af573482..738c37ee 100644 --- a/pin-project-internal/src/utils.rs +++ b/pin-project-internal/src/utils.rs @@ -111,6 +111,7 @@ fn respan_tokens(tokens: TokenStream, span: Span) -> TokenStream { pub(crate) trait SliceExt { fn position_exact(&self, ident: &str) -> Result>; fn find(&self, ident: &str) -> Option<&Attribute>; + fn extract_doc(&self) -> TokenStream; } impl SliceExt for [Attribute] { @@ -135,6 +136,16 @@ impl SliceExt for [Attribute] { fn find(&self, ident: &str) -> Option<&Attribute> { self.iter().position(|attr| attr.path().is_ident(ident)).map(|i| &self[i]) } + fn extract_doc(&self) -> TokenStream { + let mut doc = TokenStream::new(); + for doc_item in self.iter().filter(|attr| attr.path().is_ident("doc")) { + doc = quote! { + #doc + #doc_item + }; + } + doc + } } pub(crate) trait ParseBufferExt<'a> { diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs index 09de1f67..14bb290f 100644 --- a/tests/expand/default/enum.expanded.rs +++ b/tests/expand/default/enum.expanded.rs @@ -88,6 +88,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -111,6 +113,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 33abccbc..53012952 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -49,6 +53,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -62,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index 63568659..b3fc663f 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -43,6 +47,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -56,6 +62,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/enum.expanded.rs b/tests/expand/explicit_pub/enum.expanded.rs index 8846e9d0..c2dd29d1 100644 --- a/tests/expand/explicit_pub/enum.expanded.rs +++ b/tests/expand/explicit_pub/enum.expanded.rs @@ -88,6 +88,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -111,6 +113,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct.expanded.rs b/tests/expand/explicit_pub/struct.expanded.rs index e714ee07..869eae7c 100644 --- a/tests/expand/explicit_pub/struct.expanded.rs +++ b/tests/expand/explicit_pub/struct.expanded.rs @@ -1,8 +1,11 @@ use pin_project::pin_project; +/// Test Struct #[pin(__private(pub project = StructProj, project_ref = StructProjRef))] pub struct Struct { + /// Pinned field #[pin] pub pinned: T, + /// UnPinned field pub unpinned: U, } #[allow( @@ -23,11 +26,15 @@ pub struct Struct { clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ pub struct StructProj<'pin, T, U> where Struct: 'pin, { + /// Pinned field pub pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + /// UnPinned field pub unpinned: &'pin mut (U), } #[allow( @@ -48,11 +55,15 @@ where clippy::missing_docs_in_private_items, clippy::ref_option_ref )] +/**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ pub(crate) struct StructProjRef<'pin, T, U> where Struct: 'pin, { + /// Pinned field pub pinned: ::pin_project::__private::Pin<&'pin (T)>, + /// UnPinned field pub unpinned: &'pin (U), } #[allow( @@ -83,6 +94,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> StructProj<'pin, T, U> { @@ -96,6 +109,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> StructProjRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct.rs b/tests/expand/explicit_pub/struct.rs index 1bea90e3..bd1f9d28 100644 --- a/tests/expand/explicit_pub/struct.rs +++ b/tests/expand/explicit_pub/struct.rs @@ -2,10 +2,13 @@ use pin_project::pin_project; +/// Test Struct #[pin_project(pub project = StructProj, project_ref = StructProjRef)] pub struct Struct { + /// Pinned field #[pin] pub pinned: T, + /// UnPinned field pub unpinned: U, } diff --git a/tests/expand/explicit_pub/struct_replace.expanded.rs b/tests/expand/explicit_pub/struct_replace.expanded.rs index 798ef1b6..6c380908 100644 --- a/tests/expand/explicit_pub/struct_replace.expanded.rs +++ b/tests/expand/explicit_pub/struct_replace.expanded.rs @@ -22,6 +22,7 @@ pub struct Struct { clippy::type_repetition_in_bounds, clippy::missing_docs_in_private_items )] +///A projection that own a Struct. pub struct StructProjReplace { pub pinned: ::pin_project::__private::PhantomData, pub unpinned: U, @@ -52,6 +53,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ pub(crate) struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -60,6 +63,8 @@ const _: () = { pub unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -70,6 +75,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -83,6 +90,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { @@ -96,6 +105,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Struct>, and a replacement. Replace the pinned Struct and return an owning projection pub fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/explicit_pub/tuple_struct.expanded.rs b/tests/expand/explicit_pub/tuple_struct.expanded.rs index 618a256f..04064062 100644 --- a/tests/expand/explicit_pub/tuple_struct.expanded.rs +++ b/tests/expand/explicit_pub/tuple_struct.expanded.rs @@ -19,6 +19,8 @@ pub struct TupleStruct(#[pin] pub T, pub U); clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ pub struct TupleStructProj<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin mut (T)>, pub &'pin mut (U), @@ -51,6 +53,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin (T)>, pub &'pin (U), @@ -60,6 +64,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> TupleStructProj<'pin, T, U> { @@ -70,6 +76,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs index 771d99d6..099df7ee 100644 --- a/tests/expand/multifields/enum.expanded.rs +++ b/tests/expand/multifields/enum.expanded.rs @@ -145,6 +145,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -176,6 +178,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { @@ -207,6 +211,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Enum>, and a replacement. Replace the pinned Enum and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index ac0138c6..eb01c7ab 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -34,6 +34,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -44,6 +46,8 @@ const _: () = { unpinned2: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -54,6 +58,7 @@ const _: () = { unpinned2: &'pin (U), } #[allow(dead_code, clippy::missing_docs_in_private_items)] + ///A projection that own a Struct. struct __StructProjectionOwned { pinned1: ::pin_project::__private::PhantomData, pinned2: ::pin_project::__private::PhantomData, @@ -63,6 +68,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -79,6 +86,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { @@ -94,6 +103,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Struct>, and a replacement. Replace the pinned Struct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index ab351c4b..e9ccf430 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, ::pin_project::__private::Pin<&'pin mut (T)>, @@ -36,6 +38,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, ::pin_project::__private::Pin<&'pin (T)>, @@ -45,6 +49,7 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items)] + ///A projection that own a TupleStruct. struct __TupleStructProjectionOwned( ::pin_project::__private::PhantomData, ::pin_project::__private::PhantomData, @@ -54,6 +59,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -69,6 +76,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { @@ -84,6 +93,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut TupleStruct>, and a replacement. Replace the pinned TupleStruct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs index 05cb1bab..17445e76 100644 --- a/tests/expand/naming/enum-all.expanded.rs +++ b/tests/expand/naming/enum-all.expanded.rs @@ -112,6 +112,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { @@ -132,6 +134,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { @@ -155,6 +159,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Enum>, and a replacement. Replace the pinned Enum and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/enum-mut.expanded.rs b/tests/expand/naming/enum-mut.expanded.rs index b2fe404a..4f119467 100644 --- a/tests/expand/naming/enum-mut.expanded.rs +++ b/tests/expand/naming/enum-mut.expanded.rs @@ -62,6 +62,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/enum-own.expanded.rs b/tests/expand/naming/enum-own.expanded.rs index 1e85f5bb..bba564b1 100644 --- a/tests/expand/naming/enum-own.expanded.rs +++ b/tests/expand/naming/enum-own.expanded.rs @@ -57,6 +57,7 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Enum>, and a replacement. Replace the pinned Enum and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/enum-ref.expanded.rs b/tests/expand/naming/enum-ref.expanded.rs index 4d9d5586..1aae1d3b 100644 --- a/tests/expand/naming/enum-ref.expanded.rs +++ b/tests/expand/naming/enum-ref.expanded.rs @@ -59,6 +59,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index 35d225ed..5b699cb5 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -23,6 +23,8 @@ struct Struct { clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct Proj<'pin, T, U> where Struct: 'pin, @@ -48,6 +50,8 @@ where clippy::missing_docs_in_private_items, clippy::ref_option_ref )] +/**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct ProjRef<'pin, T, U> where Struct: 'pin, @@ -72,6 +76,7 @@ where clippy::type_repetition_in_bounds, clippy::missing_docs_in_private_items )] +///A projection that own a Struct. struct ProjOwn { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -104,6 +109,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { @@ -117,6 +124,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { @@ -130,6 +139,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Struct>, and a replacement. Replace the pinned Struct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index 7d3c4f3a..57b061ae 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -23,6 +23,8 @@ struct Struct { clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct Proj<'pin, T, U> where Struct: 'pin, @@ -56,6 +58,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -66,6 +70,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { @@ -79,6 +85,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 33abccbc..53012952 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -49,6 +53,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -62,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index 96a58e26..fbd39da5 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -22,6 +22,7 @@ struct Struct { clippy::type_repetition_in_bounds, clippy::missing_docs_in_private_items )] +///A projection that own a Struct. struct ProjOwn { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -52,6 +53,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -60,6 +63,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -70,6 +75,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -83,6 +90,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { @@ -96,6 +105,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Struct>, and a replacement. Replace the pinned Struct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index 5c9e1e9e..e0b60cee 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -23,6 +23,8 @@ struct Struct { clippy::missing_docs_in_private_items, clippy::ref_option_ref )] +/**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct ProjRef<'pin, T, U> where Struct: 'pin, @@ -56,6 +58,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -66,6 +70,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -79,6 +85,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 467b820e..3ff7be53 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -19,6 +19,8 @@ struct TupleStruct(#[pin] T, U); clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct Proj<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -43,6 +45,8 @@ where clippy::missing_docs_in_private_items, clippy::ref_option_ref )] +/**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct ProjRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -66,6 +70,7 @@ where clippy::type_repetition_in_bounds, clippy::missing_docs_in_private_items )] +///A projection that own a TupleStruct. struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow( unused_qualifications, @@ -95,6 +100,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { @@ -105,6 +112,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { @@ -115,6 +124,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut TupleStruct>, and a replacement. Replace the pinned TupleStruct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index 22e49040..576d3235 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -19,6 +19,8 @@ struct TupleStruct(#[pin] T, U); clippy::missing_docs_in_private_items, clippy::mut_mut )] +/**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct Proj<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -51,6 +53,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -60,6 +64,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { @@ -70,6 +76,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index 63568659..b3fc663f 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -43,6 +47,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -56,6 +62,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 4b0ea0ed..1c06924e 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -18,6 +18,7 @@ struct TupleStruct(#[pin] T, U); clippy::type_repetition_in_bounds, clippy::missing_docs_in_private_items )] +///A projection that own a TupleStruct. struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow( unused_qualifications, @@ -45,6 +46,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -52,6 +55,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -61,6 +66,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -74,6 +81,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { @@ -87,6 +96,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut TupleStruct>, and a replacement. Replace the pinned TupleStruct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index 688ad1eb..79916024 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -19,6 +19,8 @@ struct TupleStruct(#[pin] T, U); clippy::missing_docs_in_private_items, clippy::ref_option_ref )] +/**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct ProjRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -51,6 +53,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -60,6 +64,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -73,6 +79,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs index 98b978c6..592b9766 100644 --- a/tests/expand/not_unpin/enum.expanded.rs +++ b/tests/expand/not_unpin/enum.expanded.rs @@ -88,6 +88,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -111,6 +113,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index 5734fc28..f29995cc 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -49,6 +53,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -62,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index ff486324..ddef0c41 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -43,6 +47,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -56,6 +62,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index ad6122a4..d3877280 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -89,6 +89,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -112,6 +114,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index d485563e..1e8d2ae2 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -32,6 +32,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -40,6 +42,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -50,6 +54,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -63,6 +69,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index e13baf50..d79ec54f 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -28,6 +28,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -35,6 +37,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -44,6 +48,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -57,6 +63,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/project_replace/enum.expanded.rs b/tests/expand/project_replace/enum.expanded.rs index cb13c71f..630499e2 100644 --- a/tests/expand/project_replace/enum.expanded.rs +++ b/tests/expand/project_replace/enum.expanded.rs @@ -57,6 +57,7 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Enum>, and a replacement. Replace the pinned Enum and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index 48a9552d..bc8a99b5 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -47,6 +51,7 @@ const _: () = { unpinned: &'pin (U), } #[allow(dead_code, clippy::missing_docs_in_private_items)] + ///A projection that own a Struct. struct __StructProjectionOwned { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -54,6 +59,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -67,6 +74,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { @@ -80,6 +89,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut Struct>, and a replacement. Replace the pinned Struct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index 37a98c14..d2db624d 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -41,6 +45,7 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items)] + ///A projection that own a TupleStruct. struct __TupleStructProjectionOwned( ::pin_project::__private::PhantomData, U, @@ -48,6 +53,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -61,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { @@ -74,6 +83,7 @@ const _: () = { } #[allow(dead_code)] #[inline] + ///Take a Pin<&mut TupleStruct>, and a replacement. Replace the pinned TupleStruct and return an owning projection fn project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs index 6f197f5d..8f3f0881 100644 --- a/tests/expand/pub/enum.expanded.rs +++ b/tests/expand/pub/enum.expanded.rs @@ -88,6 +88,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -111,6 +113,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index 2cbbf0f8..c11f5d25 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ pub(crate) struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { pub unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -49,6 +53,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -62,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 21cff190..4e210e13 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ pub(crate) struct __TupleStructProjection<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin mut (T)>, pub &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin (T)>, pub &'pin (U), @@ -43,6 +47,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -56,6 +62,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs index 9520e69d..e5a7a988 100644 --- a/tests/expand/unsafe_unpin/enum.expanded.rs +++ b/tests/expand/unsafe_unpin/enum.expanded.rs @@ -88,6 +88,8 @@ const _: () = { impl Enum { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { @@ -111,6 +113,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index 213fcd4a..6f7b5fb3 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -31,6 +31,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected Struct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -39,6 +41,8 @@ const _: () = { unpinned: &'pin mut (U), } #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& Struct> directly rather than this struct*/ struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -49,6 +53,8 @@ const _: () = { impl Struct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { @@ -62,6 +68,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 3ca82acd..724f9c6e 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -27,6 +27,8 @@ const _: () = { #[allow(unused_extern_crates)] extern crate pin_project as _pin_project; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] + /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. +You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -34,6 +36,8 @@ const _: () = { where TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] + /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. +You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -43,6 +47,8 @@ const _: () = { impl TupleStruct { #[allow(dead_code)] #[inline] + /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { @@ -56,6 +62,8 @@ const _: () = { } #[allow(dead_code)] #[inline] + /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, + each being a (pinne if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index 7f216f6e..cbb3ebf0 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -273,3 +273,14 @@ pub enum NotUnpinEnum { /// Unit variant. Unit, } + +/// Testing pub doc +#[derive(Debug)] +#[::pin_project::pin_project(pub project = PubStructProj)] +pub struct PubStruct { + /// Pinned field. + #[pin] + pub pinned: T, + /// Unpinned field. + pub unpinned: U, +} From be2b08fc141546a582427d7216e317ba50ea7d9f Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 22:55:25 +0200 Subject: [PATCH 14/20] allow exhaustive --- tests/include/basic-safe-part.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index cbb3ebf0..875f6fbb 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -275,6 +275,7 @@ pub enum NotUnpinEnum { } /// Testing pub doc +#[allow(clippy::exhaustive_structs)] // for the type itself #[derive(Debug)] #[::pin_project::pin_project(pub project = PubStructProj)] pub struct PubStruct { From ee65667a1c3ad758fbb75f5499006ffbd613bbda Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 22:57:26 +0200 Subject: [PATCH 15/20] changed the attribute order in the tests as apparently the derive complain otherwise --- tests/include/basic-safe-part.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index 875f6fbb..70faa0cc 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -276,8 +276,8 @@ pub enum NotUnpinEnum { /// Testing pub doc #[allow(clippy::exhaustive_structs)] // for the type itself -#[derive(Debug)] #[::pin_project::pin_project(pub project = PubStructProj)] +#[derive(Debug)] pub struct PubStruct { /// Pinned field. #[pin] From 43c9ac1d775b27551ca0ed91abdda91542205686 Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 23:00:36 +0200 Subject: [PATCH 16/20] format + changed the attribute order in the tests for clippy to be happy --- tests/include/basic-safe-part.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index 70faa0cc..3c9cf997 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -275,10 +275,10 @@ pub enum NotUnpinEnum { } /// Testing pub doc -#[allow(clippy::exhaustive_structs)] // for the type itself #[::pin_project::pin_project(pub project = PubStructProj)] #[derive(Debug)] -pub struct PubStruct { +#[allow(clippy::exhaustive_structs)] // for the type itself +pub struct PubStruct { /// Pinned field. #[pin] pub pinned: T, From d9e7f7a2e11bb6ec625810c40694d4f876cde81f Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 23:08:07 +0200 Subject: [PATCH 17/20] spelling mistake corrected --- pin-project-internal/src/pin_project/derive.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index a6146c39..fb361134 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -1020,7 +1020,7 @@ fn make_proj_impl( let project_ref_vis = cx.project_ref.vis(default_vis); let project_ref_doc = format!( "Take a Pin<& {0}> and project it, aka return a {0}-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self",orig_name + each being a (pinned if necessary) reference to the corresponding field of Self",orig_name ); let mut project_ref = Some(quote! { #allow_dead_code From 3402b1939d6778560c4a479b6e0caa5f7a2f8b61 Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 23:49:03 +0200 Subject: [PATCH 18/20] added a non-exaustive attribute (seem okay and make clippy happy) --- pin-project-internal/src/pin_project/derive.rs | 3 +++ tests/expand/default/enum.expanded.rs | 2 +- tests/expand/default/struct.expanded.rs | 4 +++- tests/expand/default/tuple_struct.expanded.rs | 4 +++- tests/expand/explicit_pub/enum.expanded.rs | 2 +- tests/expand/explicit_pub/struct.expanded.rs | 4 +++- tests/expand/explicit_pub/struct_replace.expanded.rs | 5 ++++- tests/expand/explicit_pub/tuple_struct.expanded.rs | 4 +++- tests/expand/multifields/enum.expanded.rs | 2 +- tests/expand/multifields/struct.expanded.rs | 5 ++++- tests/expand/multifields/tuple_struct.expanded.rs | 5 ++++- tests/expand/naming/enum-all.expanded.rs | 2 +- tests/expand/naming/enum-ref.expanded.rs | 2 +- tests/expand/naming/struct-all.expanded.rs | 5 ++++- tests/expand/naming/struct-mut.expanded.rs | 4 +++- tests/expand/naming/struct-none.expanded.rs | 4 +++- tests/expand/naming/struct-own.expanded.rs | 5 ++++- tests/expand/naming/struct-ref.expanded.rs | 4 +++- tests/expand/naming/tuple_struct-all.expanded.rs | 5 ++++- tests/expand/naming/tuple_struct-mut.expanded.rs | 4 +++- tests/expand/naming/tuple_struct-none.expanded.rs | 4 +++- tests/expand/naming/tuple_struct-own.expanded.rs | 5 ++++- tests/expand/naming/tuple_struct-ref.expanded.rs | 4 +++- tests/expand/not_unpin/enum.expanded.rs | 2 +- tests/expand/not_unpin/struct.expanded.rs | 4 +++- tests/expand/not_unpin/tuple_struct.expanded.rs | 4 +++- tests/expand/pinned_drop/enum.expanded.rs | 2 +- tests/expand/pinned_drop/struct.expanded.rs | 4 +++- tests/expand/pinned_drop/tuple_struct.expanded.rs | 4 +++- tests/expand/project_replace/struct.expanded.rs | 5 ++++- tests/expand/project_replace/tuple_struct.expanded.rs | 5 ++++- tests/expand/pub/enum.expanded.rs | 2 +- tests/expand/pub/struct.expanded.rs | 4 +++- tests/expand/pub/tuple_struct.expanded.rs | 4 +++- tests/expand/unsafe_unpin/enum.expanded.rs | 2 +- tests/expand/unsafe_unpin/struct.expanded.rs | 4 +++- tests/expand/unsafe_unpin/tuple_struct.expanded.rs | 4 +++- tests/include/basic-safe-part.rs | 1 + 38 files changed, 103 insertions(+), 36 deletions(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index fb361134..9cbb6f1d 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -411,6 +411,7 @@ You should however consider passing around a Pin<&mut {0}> directly rather than generate.extend(cx.project.is_some(), quote! { #proj_attrs #[doc = #project_doc] + #[non_exhaustive] #project_vis struct #proj_ident #proj_generics #where_clause_fields }); @@ -421,6 +422,7 @@ You should consider passing around a Pin<& {0}> directly rather than this struct generate.extend(cx.project_ref.is_some(), quote! { #proj_ref_attrs #[doc = #project_ref_doc] + #[non_exhaustive] #project_ref_vis struct #proj_ref_ident #proj_generics #where_clause_ref_fields }); @@ -430,6 +432,7 @@ You should consider passing around a Pin<& {0}> directly rather than this struct generate.extend(cx.project_replace.ident().is_some(), quote! { #proj_own_attrs #[doc = #project_own_doc] + #[non_exhaustive] #project_own_vis struct #proj_own_ident #orig_generics #where_clause_own_fields }); } diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs index 14bb290f..acfa9e23 100644 --- a/tests/expand/default/enum.expanded.rs +++ b/tests/expand/default/enum.expanded.rs @@ -114,7 +114,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 53012952..12c50eff 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -69,7 +71,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index b3fc663f..721862e1 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -63,7 +65,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/enum.expanded.rs b/tests/expand/explicit_pub/enum.expanded.rs index c2dd29d1..d83e355f 100644 --- a/tests/expand/explicit_pub/enum.expanded.rs +++ b/tests/expand/explicit_pub/enum.expanded.rs @@ -114,7 +114,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct.expanded.rs b/tests/expand/explicit_pub/struct.expanded.rs index 869eae7c..4114bc90 100644 --- a/tests/expand/explicit_pub/struct.expanded.rs +++ b/tests/expand/explicit_pub/struct.expanded.rs @@ -28,6 +28,7 @@ pub struct Struct { )] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ +#[non_exhaustive] pub struct StructProj<'pin, T, U> where Struct: 'pin, @@ -57,6 +58,7 @@ where )] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ +#[non_exhaustive] pub(crate) struct StructProjRef<'pin, T, U> where Struct: 'pin, @@ -110,7 +112,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> StructProjRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct_replace.expanded.rs b/tests/expand/explicit_pub/struct_replace.expanded.rs index 6c380908..d14dd9a9 100644 --- a/tests/expand/explicit_pub/struct_replace.expanded.rs +++ b/tests/expand/explicit_pub/struct_replace.expanded.rs @@ -23,6 +23,7 @@ pub struct Struct { clippy::missing_docs_in_private_items )] ///A projection that own a Struct. +#[non_exhaustive] pub struct StructProjReplace { pub pinned: ::pin_project::__private::PhantomData, pub unpinned: U, @@ -55,6 +56,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -65,6 +67,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -91,7 +94,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/explicit_pub/tuple_struct.expanded.rs b/tests/expand/explicit_pub/tuple_struct.expanded.rs index 04064062..875d81df 100644 --- a/tests/expand/explicit_pub/tuple_struct.expanded.rs +++ b/tests/expand/explicit_pub/tuple_struct.expanded.rs @@ -21,6 +21,7 @@ pub struct TupleStruct(#[pin] pub T, pub U); )] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ +#[non_exhaustive] pub struct TupleStructProj<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin mut (T)>, pub &'pin mut (U), @@ -55,6 +56,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin (T)>, pub &'pin (U), @@ -77,7 +79,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs index 099df7ee..228e3f0f 100644 --- a/tests/expand/multifields/enum.expanded.rs +++ b/tests/expand/multifields/enum.expanded.rs @@ -179,7 +179,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index eb01c7ab..5a2ab060 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -36,6 +36,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -48,6 +49,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -59,6 +61,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str } #[allow(dead_code, clippy::missing_docs_in_private_items)] ///A projection that own a Struct. + #[non_exhaustive] struct __StructProjectionOwned { pinned1: ::pin_project::__private::PhantomData, pinned2: ::pin_project::__private::PhantomData, @@ -87,7 +90,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index e9ccf430..0075b182 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, ::pin_project::__private::Pin<&'pin mut (T)>, @@ -40,6 +41,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, ::pin_project::__private::Pin<&'pin (T)>, @@ -50,6 +52,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items)] ///A projection that own a TupleStruct. + #[non_exhaustive] struct __TupleStructProjectionOwned( ::pin_project::__private::PhantomData, ::pin_project::__private::PhantomData, @@ -77,7 +80,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs index 17445e76..d28f81d9 100644 --- a/tests/expand/naming/enum-all.expanded.rs +++ b/tests/expand/naming/enum-all.expanded.rs @@ -135,7 +135,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/enum-ref.expanded.rs b/tests/expand/naming/enum-ref.expanded.rs index 1aae1d3b..71d7da23 100644 --- a/tests/expand/naming/enum-ref.expanded.rs +++ b/tests/expand/naming/enum-ref.expanded.rs @@ -60,7 +60,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index 5b699cb5..d94b6eb0 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -25,6 +25,7 @@ struct Struct { )] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ +#[non_exhaustive] struct Proj<'pin, T, U> where Struct: 'pin, @@ -52,6 +53,7 @@ where )] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ +#[non_exhaustive] struct ProjRef<'pin, T, U> where Struct: 'pin, @@ -77,6 +79,7 @@ where clippy::missing_docs_in_private_items )] ///A projection that own a Struct. +#[non_exhaustive] struct ProjOwn { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -125,7 +128,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index 57b061ae..9b66969d 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -25,6 +25,7 @@ struct Struct { )] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ +#[non_exhaustive] struct Proj<'pin, T, U> where Struct: 'pin, @@ -60,6 +61,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -86,7 +88,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 53012952..12c50eff 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -69,7 +71,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index fbd39da5..41327665 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -23,6 +23,7 @@ struct Struct { clippy::missing_docs_in_private_items )] ///A projection that own a Struct. +#[non_exhaustive] struct ProjOwn { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -55,6 +56,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -65,6 +67,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -91,7 +94,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index e0b60cee..93dcb494 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -25,6 +25,7 @@ struct Struct { )] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ +#[non_exhaustive] struct ProjRef<'pin, T, U> where Struct: 'pin, @@ -60,6 +61,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -86,7 +88,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 3ff7be53..24f2896f 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -21,6 +21,7 @@ struct TupleStruct(#[pin] T, U); )] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ +#[non_exhaustive] struct Proj<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -47,6 +48,7 @@ where )] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ +#[non_exhaustive] struct ProjRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -71,6 +73,7 @@ where clippy::missing_docs_in_private_items )] ///A projection that own a TupleStruct. +#[non_exhaustive] struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow( unused_qualifications, @@ -113,7 +116,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index 576d3235..7f6ac502 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -21,6 +21,7 @@ struct TupleStruct(#[pin] T, U); )] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ +#[non_exhaustive] struct Proj<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -55,6 +56,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -77,7 +79,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index b3fc663f..721862e1 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -63,7 +65,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 1c06924e..702663ba 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -19,6 +19,7 @@ struct TupleStruct(#[pin] T, U); clippy::missing_docs_in_private_items )] ///A projection that own a TupleStruct. +#[non_exhaustive] struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow( unused_qualifications, @@ -48,6 +49,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -57,6 +59,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -82,7 +85,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index 79916024..1a99a231 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -21,6 +21,7 @@ struct TupleStruct(#[pin] T, U); )] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ +#[non_exhaustive] struct ProjRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -55,6 +56,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -80,7 +82,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs index 592b9766..03e885c3 100644 --- a/tests/expand/not_unpin/enum.expanded.rs +++ b/tests/expand/not_unpin/enum.expanded.rs @@ -114,7 +114,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index f29995cc..fb664ce2 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -69,7 +71,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index ddef0c41..724d0128 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -63,7 +65,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index d3877280..0b0715fb 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -115,7 +115,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 1e8d2ae2..3363ee2a 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -34,6 +34,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -44,6 +45,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -70,7 +72,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index d79ec54f..1a0e7952 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -30,6 +30,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -39,6 +40,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -64,7 +66,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index bc8a99b5..7d21772b 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -52,6 +54,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str } #[allow(dead_code, clippy::missing_docs_in_private_items)] ///A projection that own a Struct. + #[non_exhaustive] struct __StructProjectionOwned { pinned: ::pin_project::__private::PhantomData, unpinned: U, @@ -75,7 +78,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index d2db624d..c0ce4179 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -46,6 +48,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi TupleStruct: 'pin; #[allow(dead_code, clippy::missing_docs_in_private_items)] ///A projection that own a TupleStruct. + #[non_exhaustive] struct __TupleStructProjectionOwned( ::pin_project::__private::PhantomData, U, @@ -69,7 +72,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs index 8f3f0881..73878a5e 100644 --- a/tests/expand/pub/enum.expanded.rs +++ b/tests/expand/pub/enum.expanded.rs @@ -114,7 +114,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index c11f5d25..483b0afa 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -69,7 +71,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 4e210e13..11b9ccaf 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __TupleStructProjection<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin mut (T)>, pub &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin (T)>, pub &'pin (U), @@ -63,7 +65,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ pub(crate) fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs index e5a7a988..87334206 100644 --- a/tests/expand/unsafe_unpin/enum.expanded.rs +++ b/tests/expand/unsafe_unpin/enum.expanded.rs @@ -114,7 +114,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<& Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index 6f7b5fb3..1dd3f92a 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -33,6 +33,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected Struct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjection<'pin, T, U> where Struct: 'pin, @@ -43,6 +44,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected Struct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& Struct> directly rather than this struct*/ + #[non_exhaustive] struct __StructProjectionRef<'pin, T, U> where Struct: 'pin, @@ -69,7 +71,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<& Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 724f9c6e..73d49b79 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -29,6 +29,7 @@ const _: () = { #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)] /**A projected TupleStruct. Obtained trough the .project() method, useful to access the fields. You should however consider passing around a Pin<&mut TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -38,6 +39,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)] /**A immutably projected TupleStruct. Obtained trough the .project_ref() method, useful to access the fields. You should consider passing around a Pin<& TupleStruct> directly rather than this struct*/ + #[non_exhaustive] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -63,7 +65,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<& TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinne if necessary) reference to the corresponding field of Self*/ + each being a (pinned if necessary) reference to the corresponding field of Self*/ fn project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index 3c9cf997..61befb91 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -2,6 +2,7 @@ // default #[pin_project], PinnedDrop, project_replace, !Unpin, and UnsafeUnpin without UnsafeUnpin impl are completely safe. + /// Testing default struct. #[allow(clippy::exhaustive_structs)] // for the type itself #[::pin_project::pin_project] From dc5a1cfb0c776086ed5ffb34c9678e77899ffe24 Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Wed, 3 Sep 2025 23:53:39 +0200 Subject: [PATCH 19/20] yet another miss spell error ... --- pin-project-internal/src/pin_project/derive.rs | 2 +- tests/expand/default/enum.expanded.rs | 2 +- tests/expand/default/struct.expanded.rs | 2 +- tests/expand/default/tuple_struct.expanded.rs | 2 +- tests/expand/explicit_pub/enum.expanded.rs | 2 +- tests/expand/explicit_pub/struct.expanded.rs | 2 +- tests/expand/explicit_pub/struct_replace.expanded.rs | 2 +- tests/expand/explicit_pub/tuple_struct.expanded.rs | 2 +- tests/expand/multifields/enum.expanded.rs | 2 +- tests/expand/multifields/struct.expanded.rs | 2 +- tests/expand/multifields/tuple_struct.expanded.rs | 2 +- tests/expand/naming/enum-all.expanded.rs | 2 +- tests/expand/naming/enum-mut.expanded.rs | 2 +- tests/expand/naming/struct-all.expanded.rs | 2 +- tests/expand/naming/struct-mut.expanded.rs | 2 +- tests/expand/naming/struct-none.expanded.rs | 2 +- tests/expand/naming/struct-own.expanded.rs | 2 +- tests/expand/naming/struct-ref.expanded.rs | 2 +- tests/expand/naming/tuple_struct-all.expanded.rs | 2 +- tests/expand/naming/tuple_struct-mut.expanded.rs | 2 +- tests/expand/naming/tuple_struct-none.expanded.rs | 2 +- tests/expand/naming/tuple_struct-own.expanded.rs | 2 +- tests/expand/naming/tuple_struct-ref.expanded.rs | 2 +- tests/expand/not_unpin/enum.expanded.rs | 2 +- tests/expand/not_unpin/struct.expanded.rs | 2 +- tests/expand/not_unpin/tuple_struct.expanded.rs | 2 +- tests/expand/pinned_drop/enum.expanded.rs | 2 +- tests/expand/pinned_drop/struct.expanded.rs | 2 +- tests/expand/pinned_drop/tuple_struct.expanded.rs | 2 +- tests/expand/project_replace/struct.expanded.rs | 2 +- tests/expand/project_replace/tuple_struct.expanded.rs | 2 +- tests/expand/pub/enum.expanded.rs | 2 +- tests/expand/pub/struct.expanded.rs | 2 +- tests/expand/pub/tuple_struct.expanded.rs | 2 +- tests/expand/unsafe_unpin/enum.expanded.rs | 2 +- tests/expand/unsafe_unpin/struct.expanded.rs | 2 +- tests/expand/unsafe_unpin/tuple_struct.expanded.rs | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index 9cbb6f1d..8b0661ba 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -1006,7 +1006,7 @@ fn make_proj_impl( let project_vis = cx.project.vis(default_vis); let project_doc = format!( "Take a Pin<&mut {0}> and project it, aka return a {0}-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self",orig_name); + each being a (pinned if necessary) mutable reference to the corresponding field of Self",orig_name); let mut project = Some(quote! { #allow_dead_code #[inline] diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs index acfa9e23..d808d6e1 100644 --- a/tests/expand/default/enum.expanded.rs +++ b/tests/expand/default/enum.expanded.rs @@ -89,7 +89,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 12c50eff..29aa43bf 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -56,7 +56,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index 721862e1..1d7766a9 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -50,7 +50,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/explicit_pub/enum.expanded.rs b/tests/expand/explicit_pub/enum.expanded.rs index d83e355f..c173d903 100644 --- a/tests/expand/explicit_pub/enum.expanded.rs +++ b/tests/expand/explicit_pub/enum.expanded.rs @@ -89,7 +89,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct.expanded.rs b/tests/expand/explicit_pub/struct.expanded.rs index 4114bc90..663663f2 100644 --- a/tests/expand/explicit_pub/struct.expanded.rs +++ b/tests/expand/explicit_pub/struct.expanded.rs @@ -97,7 +97,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> StructProj<'pin, T, U> { diff --git a/tests/expand/explicit_pub/struct_replace.expanded.rs b/tests/expand/explicit_pub/struct_replace.expanded.rs index d14dd9a9..280609e4 100644 --- a/tests/expand/explicit_pub/struct_replace.expanded.rs +++ b/tests/expand/explicit_pub/struct_replace.expanded.rs @@ -79,7 +79,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/explicit_pub/tuple_struct.expanded.rs b/tests/expand/explicit_pub/tuple_struct.expanded.rs index 875d81df..d190bb2a 100644 --- a/tests/expand/explicit_pub/tuple_struct.expanded.rs +++ b/tests/expand/explicit_pub/tuple_struct.expanded.rs @@ -67,7 +67,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> TupleStructProj<'pin, T, U> { diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs index 228e3f0f..dce8cbb0 100644 --- a/tests/expand/multifields/enum.expanded.rs +++ b/tests/expand/multifields/enum.expanded.rs @@ -146,7 +146,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index 5a2ab060..bca3b8a4 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -72,7 +72,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index 0075b182..ca5d461b 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -63,7 +63,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs index d28f81d9..7ef5379b 100644 --- a/tests/expand/naming/enum-all.expanded.rs +++ b/tests/expand/naming/enum-all.expanded.rs @@ -113,7 +113,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/enum-mut.expanded.rs b/tests/expand/naming/enum-mut.expanded.rs index 4f119467..cd64b71a 100644 --- a/tests/expand/naming/enum-mut.expanded.rs +++ b/tests/expand/naming/enum-mut.expanded.rs @@ -63,7 +63,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index d94b6eb0..d928d837 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -113,7 +113,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index 9b66969d..393b5576 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -73,7 +73,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 12c50eff..29aa43bf 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -56,7 +56,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index 41327665..afdf34d8 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -79,7 +79,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index 93dcb494..92429904 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -73,7 +73,7 @@ You should however consider passing around a Pin<&mut Struct> directly rather th #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 24f2896f..0301eeee 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -104,7 +104,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index 7f6ac502..f22174e5 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -67,7 +67,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> Proj<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index 721862e1..1d7766a9 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -50,7 +50,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 702663ba..5da89fae 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -70,7 +70,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index 1a99a231..b58e977c 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -67,7 +67,7 @@ You should however consider passing around a Pin<&mut TupleStruct> directly rath #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs index 03e885c3..f2e17fe3 100644 --- a/tests/expand/not_unpin/enum.expanded.rs +++ b/tests/expand/not_unpin/enum.expanded.rs @@ -89,7 +89,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index fb664ce2..d076ce2f 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -56,7 +56,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index 724d0128..bb50fb0b 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -50,7 +50,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index 0b0715fb..4eca7296 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -90,7 +90,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 3363ee2a..7e8ab5b4 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -57,7 +57,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index 1a0e7952..ad4cf23d 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -51,7 +51,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index 7d21772b..4394c608 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -63,7 +63,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index c0ce4179..253e7b5c 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -57,7 +57,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs index 73878a5e..3bffe9eb 100644 --- a/tests/expand/pub/enum.expanded.rs +++ b/tests/expand/pub/enum.expanded.rs @@ -89,7 +89,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index 483b0afa..0142dc90 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -56,7 +56,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 11b9ccaf..515179ae 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -50,7 +50,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ pub(crate) fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs index 87334206..74adfcc0 100644 --- a/tests/expand/unsafe_unpin/enum.expanded.rs +++ b/tests/expand/unsafe_unpin/enum.expanded.rs @@ -89,7 +89,7 @@ const _: () = { #[allow(dead_code)] #[inline] /**Take a Pin<&mut Enum> and project it, aka return a Enum-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index 1dd3f92a..084e769a 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -56,7 +56,7 @@ You should consider passing around a Pin<& Struct> directly rather than this str #[allow(dead_code)] #[inline] /**Take a Pin<&mut Struct> and project it, aka return a Struct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 73d49b79..5f7b58e2 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -50,7 +50,7 @@ You should consider passing around a Pin<& TupleStruct> directly rather than thi #[allow(dead_code)] #[inline] /**Take a Pin<&mut TupleStruct> and project it, aka return a TupleStruct-like data structure with fields of the same name, - each being a (pinned if necessary) mutable reference to the coresponding field of Self*/ + each being a (pinned if necessary) mutable reference to the corresponding field of Self*/ fn project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { From b3662475826286ea60002cd75cdcffe2a1d4ee5c Mon Sep 17 00:00:00 2001 From: Louwenus / Madcoder Date: Thu, 4 Sep 2025 00:00:52 +0200 Subject: [PATCH 20/20] format --- tests/include/basic-safe-part.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/include/basic-safe-part.rs b/tests/include/basic-safe-part.rs index 61befb91..3c9cf997 100644 --- a/tests/include/basic-safe-part.rs +++ b/tests/include/basic-safe-part.rs @@ -2,7 +2,6 @@ // default #[pin_project], PinnedDrop, project_replace, !Unpin, and UnsafeUnpin without UnsafeUnpin impl are completely safe. - /// Testing default struct. #[allow(clippy::exhaustive_structs)] // for the type itself #[::pin_project::pin_project]