diff options
author | Haibo Huang <hhb@google.com> | 2020-07-10 20:23:30 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2020-07-13 22:26:50 -0700 |
commit | d58366dc4a1a1ec807bb02dfc7928051799130ac (patch) | |
tree | 99470e8e8e4787e90b156f71bafac98438d6c39a /examples | |
parent | 09ba014483c2506939704e0b993a728958553e25 (diff) | |
download | pin-project-d58366dc4a1a1ec807bb02dfc7928051799130ac.tar.gz |
Upgrade rust/crates/pin-project to 0.4.22android-r-beta-3android-r-beta-2
* Keep local change in src/lib.rs
Test: make
Change-Id: I63ca4a3f247df2028bcb6cb849823b296865f444
Diffstat (limited to 'examples')
-rw-r--r-- | examples/enum-default-expanded.rs | 33 | ||||
-rw-r--r-- | examples/not_unpin-expanded.rs | 42 | ||||
-rw-r--r-- | examples/pinned_drop-expanded.rs | 34 | ||||
-rw-r--r-- | examples/project_replace-expanded.rs | 50 | ||||
-rw-r--r-- | examples/project_replace.rs | 2 | ||||
-rw-r--r-- | examples/struct-default-expanded.rs | 46 | ||||
-rw-r--r-- | examples/unsafe_unpin-expanded.rs | 32 |
7 files changed, 131 insertions, 108 deletions
diff --git a/examples/enum-default-expanded.rs b/examples/enum-default-expanded.rs index 845645a..3e7cb3c 100644 --- a/examples/enum-default-expanded.rs +++ b/examples/enum-default-expanded.rs @@ -15,7 +15,7 @@ // ``` #![allow(dead_code, unused_imports, unused_parens)] -#![allow(clippy::no_effect, clippy::just_underscores_and_digits)] +#![allow(clippy::just_underscores_and_digits)] use pin_project::pin_project; @@ -24,51 +24,54 @@ enum Enum<T, U> { Unpinned(U), } -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, { - Pinned(::pin_project::__reexport::pin::Pin<&'pin mut (T)>), + Pinned(::pin_project::__private::Pin<&'pin mut (T)>), Unpinned(&'pin mut (U)), } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] enum __EnumProjectionRef<'pin, T, U> where Enum<T, U>: 'pin, { - Pinned(::pin_project::__reexport::pin::Pin<&'pin (T)>), + Pinned(::pin_project::__private::Pin<&'pin (T)>), Unpinned(&'pin (U)), } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Enum: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<T, U> Enum<T, U> { fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Enum::Pinned(_0) => { - EnumProj::Pinned(::pin_project::__reexport::pin::Pin::new_unchecked(_0)) + EnumProj::Pinned(::pin_project::__private::Pin::new_unchecked(_0)) } Enum::Unpinned(_0) => EnumProj::Unpinned(_0), } } } fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __EnumProjectionRef<'pin, T, U> { unsafe { match self.get_ref() { Enum::Pinned(_0) => __EnumProjectionRef::Pinned( - ::pin_project::__reexport::pin::Pin::new_unchecked(_0), + ::pin_project::__private::Pin::new_unchecked(_0), ), Enum::Unpinned(_0) => __EnumProjectionRef::Unpinned(_0), } @@ -84,8 +87,8 @@ const __SCOPE_Enum: () = { __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<'pin, (T, U)>, __field0: T, } - impl<'pin, T, U> ::pin_project::__reexport::marker::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: ::pin_project::__reexport::marker::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } unsafe impl<T, U> ::pin_project::UnsafeUnpin for Enum<T, U> {} @@ -95,10 +98,10 @@ const __SCOPE_Enum: () = { // See ./struct-default-expanded.rs for details. trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds)] - impl<T: ::pin_project::__reexport::ops::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: ::pin_project::__reexport::pin::Pin<&mut Self>) {} + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } // We don't need to check for `#[repr(packed)]`, diff --git a/examples/not_unpin-expanded.rs b/examples/not_unpin-expanded.rs index 45f1321..fdfe5a2 100644 --- a/examples/not_unpin-expanded.rs +++ b/examples/not_unpin-expanded.rs @@ -30,50 +30,53 @@ pub struct Struct<T, U> { } #[doc(hidden)] -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin mut (T)>, + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin (T)>, + pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U), } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Struct: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<T, U> Struct<T, U> { pub(crate) fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + 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::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } pub(crate) fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -84,17 +87,17 @@ const __SCOPE_Struct: () = { // // See https://github.com/taiki-e/pin-project/issues/102#issuecomment-540472282 // for details. - impl<'pin, T, U> ::pin_project::__reexport::marker::Unpin for Struct<T, U> where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__reexport::marker::PhantomPinned>: - ::pin_project::__reexport::marker::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } // A dummy impl of `UnsafeUnpin`, to ensure that the user cannot implement it. // // To ensure that users don't accidentally write a non-functional `UnsafeUnpin` - // impls, we emit one ourselves. If the user ends up writing a `UnsafeUnpin` impl, - // they'll get a "conflicting implementations of trait" error when coherence - // checks are run. + // impls, we emit one ourselves. If the user ends up writing an `UnsafeUnpin` + // impl, they'll get a "conflicting implementations of trait" error when + // coherence checks are run. unsafe impl<T, U> ::pin_project::UnsafeUnpin for Struct<T, U> {} // Ensure that struct does not implement `Drop`. @@ -102,13 +105,14 @@ const __SCOPE_Struct: () = { // See ./struct-default-expanded.rs for details. trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds)] - impl<T: ::pin_project::__reexport::ops::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: ::pin_project::__reexport::pin::Pin<&mut Self>) {} + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } - // Ensure that it's impossible to use pin projections on a #[repr(packed)] struct. + // Ensure that it's impossible to use pin projections on a #[repr(packed)] + // struct. // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. diff --git a/examples/pinned_drop-expanded.rs b/examples/pinned_drop-expanded.rs index 15dde89..8f295e9 100644 --- a/examples/pinned_drop-expanded.rs +++ b/examples/pinned_drop-expanded.rs @@ -34,61 +34,64 @@ pub struct Struct<'a, T> { } #[doc(hidden)] -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjection<'pin, 'a, T> where Struct<'a, T>: 'pin, { was_dropped: &'pin mut (&'a mut bool), - field: ::pin_project::__reexport::pin::Pin<&'pin mut (T)>, + field: ::pin_project::__private::Pin<&'pin mut (T)>, } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjectionRef<'pin, 'a, T> where Struct<'a, T>: 'pin, { was_dropped: &'pin (&'a mut bool), - field: ::pin_project::__reexport::pin::Pin<&'pin (T)>, + field: ::pin_project::__private::Pin<&'pin (T)>, } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Struct: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<'a, T> Struct<'a, T> { pub(crate) fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, 'a, T> { unsafe { let Self { was_dropped, field } = self.get_unchecked_mut(); __StructProjection { was_dropped, - field: ::pin_project::__reexport::pin::Pin::new_unchecked(field), + field: ::pin_project::__private::Pin::new_unchecked(field), } } } pub(crate) fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, 'a, T> { unsafe { let Self { was_dropped, field } = self.get_ref(); __StructProjectionRef { was_dropped, - field: ::pin_project::__reexport::pin::Pin::new_unchecked(field), + field: ::pin_project::__private::Pin::new_unchecked(field), } } } } - impl<'a, T> ::pin_project::__reexport::ops::Drop for Struct<'a, T> { + impl<'a, T> ::pin_project::__private::Drop for Struct<'a, T> { fn drop(&mut self) { // Safety - we're in 'drop', so we know that 'self' will // never move again. - let pinned_self = unsafe { ::pin_project::__reexport::pin::Pin::new_unchecked(self) }; + let pinned_self = unsafe { ::pin_project::__private::Pin::new_unchecked(self) }; // We call `pinned_drop` only once. Since `PinnedDrop::drop` // is an unsafe method and a private API, it is never called again in safe // code *unless the user uses a maliciously crafted macro*. @@ -107,13 +110,14 @@ const __SCOPE_Struct: () = { __field0: T, __lifetime0: &'a (), } - impl<'pin, 'a, T> ::pin_project::__reexport::marker::Unpin for Struct<'a, T> where - __Struct<'pin, 'a, T>: ::pin_project::__reexport::marker::Unpin + impl<'pin, 'a, T> ::pin_project::__private::Unpin for Struct<'a, T> where + __Struct<'pin, 'a, T>: ::pin_project::__private::Unpin { } unsafe impl<'a, T> ::pin_project::UnsafeUnpin for Struct<'a, T> {} - // Ensure that it's impossible to use pin projections on a #[repr(packed)] struct. + // Ensure that it's impossible to use pin projections on a #[repr(packed)] + // struct. // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. diff --git a/examples/project_replace-expanded.rs b/examples/project_replace-expanded.rs index ec9f00e..661a0ac 100644 --- a/examples/project_replace-expanded.rs +++ b/examples/project_replace-expanded.rs @@ -5,7 +5,7 @@ // // use pin_project::pin_project; // -// #[pin_project(Replace)] +// #[pin_project(project_replace)] // struct Struct<T, U> { // #[pin] // pinned: T, @@ -27,64 +27,67 @@ struct Struct<T, U> { } #[doc(hidden)] -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin mut (T)>, + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin (T)>, + pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U), } - #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] +#[allow(unreachable_pub)] #[allow(single_use_lifetimes)] struct __StructProjectionOwned<T, U> { - pinned: ::pin_project::__reexport::marker::PhantomData<T>, + pinned: ::pin_project::__private::PhantomData<T>, unpinned: U, } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Struct: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<T, U> Struct<T, U> { fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + 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::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: ::pin_project::__reexport::pin::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned<T, U> { unsafe { @@ -93,15 +96,15 @@ const __SCOPE_Struct: () = { // First, extract all the unpinned fields let __result = __StructProjectionOwned { - pinned: ::pin_project::__reexport::marker::PhantomData, - unpinned: ::pin_project::__reexport::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; // Destructors will run in reverse order, so next create a guard to overwrite // `self` with the replacement value without calling destructors. let __guard = ::pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__reexport::mem::ManuallyDrop::new(__replacement), + value: ::pin_project::__private::ManuallyDrop::new(__replacement), }; // Now create guards to drop all the pinned fields @@ -127,8 +130,8 @@ const __SCOPE_Struct: () = { __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<'pin, (T, U)>, __field0: T, } - impl<'pin, T, U> ::pin_project::__reexport::marker::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: ::pin_project::__reexport::marker::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } unsafe impl<T, U> ::pin_project::UnsafeUnpin for Struct<T, U> {} @@ -138,13 +141,14 @@ const __SCOPE_Struct: () = { // See ./struct-default-expanded.rs for details. trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds)] - impl<T: ::pin_project::__reexport::ops::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: ::pin_project::__reexport::pin::Pin<&mut Self>) {} + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } - // Ensure that it's impossible to use pin projections on a #[repr(packed)] struct. + // Ensure that it's impossible to use pin projections on a #[repr(packed)] + // struct. // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. diff --git a/examples/project_replace.rs b/examples/project_replace.rs index 4482625..99cec18 100644 --- a/examples/project_replace.rs +++ b/examples/project_replace.rs @@ -4,7 +4,7 @@ use pin_project::pin_project; -#[pin_project(Replace)] +#[pin_project(project_replace)] struct Struct<T, U> { #[pin] pinned: T, diff --git a/examples/struct-default-expanded.rs b/examples/struct-default-expanded.rs index 2bf7edd..53f00c9 100644 --- a/examples/struct-default-expanded.rs +++ b/examples/struct-default-expanded.rs @@ -27,50 +27,53 @@ struct Struct<T, U> { } #[doc(hidden)] -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin mut (T)>, + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin (T)>, + pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U), } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Struct: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<T, U> Struct<T, U> { fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + 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::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -91,9 +94,9 @@ const __SCOPE_Struct: () = { // When RFC 2145 is implemented (rust-lang/rust#48054), // this will become a lint, rather then a hard error. // - // As a workaround for this, we generate a new struct, containing all of the pinned - // fields from our #[pin_project] type. This struct is declared within - // a function, which makes it impossible to be named by user code. + // As a workaround for this, we generate a new struct, containing all of + // the pinned fields from our #[pin_project] type. This struct is declared + // within a function, which makes it impossible to be named by user code. // This guarantees that it will use the default auto-trait impl for Unpin - // that is, it will implement Unpin iff all of its fields implement Unpin. // This type can be safely declared as 'public', satisfying the privacy @@ -107,16 +110,16 @@ const __SCOPE_Struct: () = { __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<'pin, (T, U)>, __field0: T, } - impl<'pin, T, U> ::pin_project::__reexport::marker::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: ::pin_project::__reexport::marker::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } // A dummy impl of `UnsafeUnpin`, to ensure that the user cannot implement it. // // To ensure that users don't accidentally write a non-functional `UnsafeUnpin` - // impls, we emit one ourselves. If the user ends up writing a `UnsafeUnpin` impl, - // they'll get a "conflicting implementations of trait" error when coherence - // checks are run. + // impls, we emit one ourselves. If the user ends up writing an `UnsafeUnpin` + // impl, they'll get a "conflicting implementations of trait" error when + // coherence checks are run. unsafe impl<T, U> ::pin_project::UnsafeUnpin for Struct<T, U> {} // Ensure that struct does not implement `Drop`. @@ -126,15 +129,16 @@ const __SCOPE_Struct: () = { // the conflict with the second impl. trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds)] - impl<T: ::pin_project::__reexport::ops::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} // A dummy impl of `PinnedDrop`, to ensure that users don't accidentally // write a non-functional `PinnedDrop` impls. impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: ::pin_project::__reexport::pin::Pin<&mut Self>) {} + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } - // Ensure that it's impossible to use pin projections on a #[repr(packed)] struct. + // Ensure that it's impossible to use pin projections on a #[repr(packed)] + // struct. // // Taking a reference to a packed field is unsafe, and applying // #[deny(safe_packed_borrows)] makes sure that doing this without diff --git a/examples/unsafe_unpin-expanded.rs b/examples/unsafe_unpin-expanded.rs index 7d8ad8e..e55b740 100644 --- a/examples/unsafe_unpin-expanded.rs +++ b/examples/unsafe_unpin-expanded.rs @@ -29,57 +29,60 @@ pub struct Struct<T, U> { } #[doc(hidden)] -#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin mut (T)>, + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } #[doc(hidden)] -#[allow(dead_code)] // This lint warns unused fields/variants. +#[allow(dead_code)] #[allow(single_use_lifetimes)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, { - pinned: ::pin_project::__reexport::pin::Pin<&'pin (T)>, + pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U), } #[doc(hidden)] #[allow(non_upper_case_globals)] #[allow(single_use_lifetimes)] -const __SCOPE_Struct: () = { +#[allow(clippy::used_underscore_binding)] +const _: () = { impl<T, U> Struct<T, U> { pub(crate) fn project<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin mut Self>, + 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::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } pub(crate) fn project_ref<'pin>( - self: ::pin_project::__reexport::pin::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__reexport::pin::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - impl<'pin, T, U> ::pin_project::__reexport::marker::Unpin for Struct<T, U> where + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin { } @@ -89,13 +92,14 @@ const __SCOPE_Struct: () = { // See ./struct-default-expanded.rs for details. trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds)] - impl<T: ::pin_project::__reexport::ops::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: ::pin_project::__reexport::pin::Pin<&mut Self>) {} + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } - // Ensure that it's impossible to use pin projections on a #[repr(packed)] struct. + // Ensure that it's impossible to use pin projections on a #[repr(packed)] + // struct. // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. |