Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![allow(dead_code, unused_macros)]
macro_rules! assert_unpin {
($ty:ty) => {
static_assertions::assert_impl_all!($ty: Unpin);
};
}
macro_rules! assert_not_unpin {
($ty:ty) => {
static_assertions::assert_not_impl_all!($ty: Unpin);
};
}

185
vendor/pin-project/tests/cfg.rs vendored Normal file
View File

@@ -0,0 +1,185 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![allow(dead_code, clippy::items_after_statements)]
// Refs: https://doc.rust-lang.org/reference/attributes.html
#[macro_use]
mod auxiliary;
use std::{marker::PhantomPinned, pin::Pin};
use pin_project::pin_project;
struct Always;
// Use this type to check that `cfg(any())` is working properly.
struct Never(PhantomPinned);
#[test]
fn cfg() {
// structs
#[pin_project(project_replace)]
struct SameName {
#[cfg(not(any()))]
#[pin]
inner: Always,
#[cfg(any())]
#[pin]
inner: Never,
}
assert_unpin!(SameName);
let _ = SameName { inner: Always };
#[pin_project(project_replace)]
struct DifferentName {
#[cfg(not(any()))]
#[pin]
a: Always,
#[cfg(any())]
#[pin]
n: Never,
}
assert_unpin!(DifferentName);
let _ = DifferentName { a: Always };
#[pin_project(project_replace)]
struct TupleStruct(
#[cfg(not(any()))]
#[pin]
Always,
#[cfg(any())]
#[pin]
Never,
);
assert_unpin!(TupleStruct);
let _ = TupleStruct(Always);
// enums
#[pin_project(
project = VariantProj,
project_ref = VariantProjRef,
project_replace = VariantProjOwn,
)]
enum Variant {
#[cfg(not(any()))]
Inner(#[pin] Always),
#[cfg(any())]
Inner(#[pin] Never),
#[cfg(not(any()))]
A(#[pin] Always),
#[cfg(any())]
N(#[pin] Never),
}
assert_unpin!(Variant);
let _ = Variant::Inner(Always);
let _ = Variant::A(Always);
#[pin_project(
project = FieldProj,
project_ref = FieldProjRef,
project_replace = FieldProjOwn,
)]
enum Field {
SameName {
#[cfg(not(any()))]
#[pin]
inner: Always,
#[cfg(any())]
#[pin]
inner: Never,
},
DifferentName {
#[cfg(not(any()))]
#[pin]
a: Always,
#[cfg(any())]
#[pin]
n: Never,
},
TupleVariant(
#[cfg(not(any()))]
#[pin]
Always,
#[cfg(any())]
#[pin]
Never,
),
}
assert_unpin!(Field);
let _ = Field::SameName { inner: Always };
let _ = Field::DifferentName { a: Always };
let _ = Field::TupleVariant(Always);
}
#[test]
fn cfg_attr() {
#[pin_project(project_replace)]
struct SameCfg {
#[cfg(not(any()))]
#[cfg_attr(not(any()), pin)]
inner: Always,
#[cfg(any())]
#[cfg_attr(any(), pin)]
inner: Never,
}
assert_unpin!(SameCfg);
let mut x = SameCfg { inner: Always };
let x = Pin::new(&mut x).project();
let _: Pin<&mut Always> = x.inner;
#[pin_project(project_replace)]
struct DifferentCfg {
#[cfg(not(any()))]
#[cfg_attr(any(), pin)]
inner: Always,
#[cfg(any())]
#[cfg_attr(not(any()), pin)]
inner: Never,
}
assert_unpin!(DifferentCfg);
let mut x = DifferentCfg { inner: Always };
let x = Pin::new(&mut x).project();
let _: &mut Always = x.inner;
#[cfg_attr(not(any()), pin_project)]
struct Foo<T> {
#[cfg_attr(not(any()), pin)]
inner: T,
}
assert_unpin!(Foo<()>);
assert_not_unpin!(Foo<PhantomPinned>);
let mut x = Foo { inner: 0_u8 };
let x = Pin::new(&mut x).project();
let _: Pin<&mut u8> = x.inner;
}
#[test]
fn cfg_attr_any_packed() {
// Since `cfg(any())` can never be true, it is okay for this to pass.
#[pin_project(project_replace)]
#[cfg_attr(any(), repr(packed))]
struct Struct {
#[pin]
f: u32,
}
}

11
vendor/pin-project/tests/compiletest.rs vendored Normal file
View File

@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![cfg(not(miri))]
#[rustversion::attr(not(nightly), ignore)]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/**/*.rs");
t.pass("tests/run-pass/**/*.rs");
}

160
vendor/pin-project/tests/drop_order.rs vendored Normal file
View File

@@ -0,0 +1,160 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Refs: https://doc.rust-lang.org/reference/destructors.html
use std::{cell::Cell, pin::Pin, thread};
use pin_project::pin_project;
struct D<'a>(&'a Cell<usize>, usize);
impl Drop for D<'_> {
fn drop(&mut self) {
if !thread::panicking() {
let old = self.0.replace(self.1);
assert_eq!(old, self.1 - 1);
}
}
}
#[pin_project(project_replace)]
struct StructPinned<'a> {
#[pin]
f1: D<'a>,
#[pin]
f2: D<'a>,
}
#[pin_project(project_replace)]
struct StructUnpinned<'a> {
f1: D<'a>,
f2: D<'a>,
}
#[pin_project(project_replace)]
struct TuplePinned<'a>(#[pin] D<'a>, #[pin] D<'a>);
#[pin_project(project_replace)]
struct TupleUnpinned<'a>(D<'a>, D<'a>);
#[pin_project(project_replace = EnumProj)]
enum Enum<'a> {
StructPinned {
#[pin]
f1: D<'a>,
#[pin]
f2: D<'a>,
},
StructUnpinned {
f1: D<'a>,
f2: D<'a>,
},
TuplePinned(#[pin] D<'a>, #[pin] D<'a>),
TupleUnpinned(D<'a>, D<'a>),
}
#[test]
fn struct_pinned() {
{
let c = Cell::new(0);
let _x = StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
}
{
let c = Cell::new(0);
let mut x = StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
let y = Pin::new(&mut x);
let _z = y.project_replace(StructPinned { f1: D(&c, 3), f2: D(&c, 4) });
}
}
#[test]
fn struct_unpinned() {
{
let c = Cell::new(0);
let _x = StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
}
{
let c = Cell::new(0);
let mut x = StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
let y = Pin::new(&mut x);
let _z = y.project_replace(StructUnpinned { f1: D(&c, 3), f2: D(&c, 4) });
}
}
#[test]
fn tuple_pinned() {
{
let c = Cell::new(0);
let _x = TuplePinned(D(&c, 1), D(&c, 2));
}
{
let c = Cell::new(0);
let mut x = TuplePinned(D(&c, 1), D(&c, 2));
let y = Pin::new(&mut x);
let _z = y.project_replace(TuplePinned(D(&c, 3), D(&c, 4)));
}
}
#[test]
fn tuple_unpinned() {
{
let c = Cell::new(0);
let _x = TupleUnpinned(D(&c, 1), D(&c, 2));
}
{
let c = Cell::new(0);
let mut x = TupleUnpinned(D(&c, 1), D(&c, 2));
let y = Pin::new(&mut x);
let _z = y.project_replace(TupleUnpinned(D(&c, 3), D(&c, 4)));
}
}
#[test]
fn enum_struct() {
{
let c = Cell::new(0);
let _x = Enum::StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
}
{
let c = Cell::new(0);
let mut x = Enum::StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
let y = Pin::new(&mut x);
let _z = y.project_replace(Enum::StructPinned { f1: D(&c, 3), f2: D(&c, 4) });
}
{
let c = Cell::new(0);
let _x = Enum::StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
}
{
let c = Cell::new(0);
let mut x = Enum::StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
let y = Pin::new(&mut x);
let _z = y.project_replace(Enum::StructUnpinned { f1: D(&c, 3), f2: D(&c, 4) });
}
}
#[test]
fn enum_tuple() {
{
let c = Cell::new(0);
let _x = Enum::TuplePinned(D(&c, 1), D(&c, 2));
}
{
let c = Cell::new(0);
let mut x = Enum::TuplePinned(D(&c, 1), D(&c, 2));
let y = Pin::new(&mut x);
let _z = y.project_replace(Enum::TuplePinned(D(&c, 3), D(&c, 4)));
}
{
let c = Cell::new(0);
let _x = Enum::TupleUnpinned(D(&c, 1), D(&c, 2));
}
{
let c = Cell::new(0);
let mut x = Enum::TupleUnpinned(D(&c, 1), D(&c, 2));
let y = Pin::new(&mut x);
let _z = y.project_replace(Enum::TupleUnpinned(D(&c, 3), D(&c, 4)));
}
}

View File

@@ -0,0 +1,170 @@
use pin_project::pin_project;
#[pin(__private(project = EnumProj, project_ref = EnumProjRef))]
enum Enum<T, U> {
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
)]
enum EnumProj<'pin, T, U>
where
Enum<T, U>: '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
)]
enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
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]
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)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = EnumProj, project_ref = EnumProjRef)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,115 @@
use pin_project::pin_project;
#[pin(__private())]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,109 @@
use pin_project::pin_project;
#[pin(__private())]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,300 @@
use pin_project::pin_project;
#[pin(
__private(
project = EnumProj,
project_ref = EnumProjRef,
project_replace = EnumProjOwn
)
)]
enum Enum<T, U> {
Struct { #[pin] pinned1: T, #[pin] pinned2: T, unpinned1: U, unpinned2: U },
Tuple(#[pin] T, #[pin] T, U, 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
)]
enum EnumProj<'pin, T, U>
where
Enum<T, U>: 'pin,
{
Struct {
pinned1: ::pin_project::__private::Pin<&'pin mut (T)>,
pinned2: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned1: &'pin mut (U),
unpinned2: &'pin mut (U),
},
Tuple(
::pin_project::__private::Pin<&'pin mut (T)>,
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
&'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
)]
enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: 'pin,
{
Struct {
pinned1: ::pin_project::__private::Pin<&'pin (T)>,
pinned2: ::pin_project::__private::Pin<&'pin (T)>,
unpinned1: &'pin (U),
unpinned2: &'pin (U),
},
Tuple(
::pin_project::__private::Pin<&'pin (T)>,
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
&'pin (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,
variant_size_differences,
clippy::large_enum_variant,
clippy::missing_docs_in_private_items
)]
enum EnumProjOwn<T, U> {
Struct {
pinned1: ::pin_project::__private::PhantomData<T>,
pinned2: ::pin_project::__private::PhantomData<T>,
unpinned1: U,
unpinned2: U,
},
Tuple(
::pin_project::__private::PhantomData<T>,
::pin_project::__private::PhantomData<T>,
U,
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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
unsafe {
match self.get_unchecked_mut() {
Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
EnumProj::Struct {
pinned1: _pin_project::__private::Pin::new_unchecked(
pinned1,
),
pinned2: _pin_project::__private::Pin::new_unchecked(
pinned2,
),
unpinned1,
unpinned2,
}
}
Self::Tuple(_0, _1, _2, _3) => {
EnumProj::Tuple(
_pin_project::__private::Pin::new_unchecked(_0),
_pin_project::__private::Pin::new_unchecked(_1),
_2,
_3,
)
}
Self::Unit => EnumProj::Unit,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
unsafe {
match self.get_ref() {
Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
EnumProjRef::Struct {
pinned1: _pin_project::__private::Pin::new_unchecked(
pinned1,
),
pinned2: _pin_project::__private::Pin::new_unchecked(
pinned2,
),
unpinned1,
unpinned2,
}
}
Self::Tuple(_0, _1, _2, _3) => {
EnumProjRef::Tuple(
_pin_project::__private::Pin::new_unchecked(_0),
_pin_project::__private::Pin::new_unchecked(_1),
_2,
_3,
)
}
Self::Unit => EnumProjRef::Unit,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> EnumProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
match &mut *__self_ptr {
Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
let __result = EnumProjOwn::Struct {
pinned1: _pin_project::__private::PhantomData,
pinned2: _pin_project::__private::PhantomData,
unpinned1: _pin_project::__private::ptr::read(unpinned1),
unpinned2: _pin_project::__private::ptr::read(unpinned2),
};
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned2,
);
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned1,
);
}
__result
}
Self::Tuple(_0, _1, _2, _3) => {
let __result = EnumProjOwn::Tuple(
_pin_project::__private::PhantomData,
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_2),
_pin_project::__private::ptr::read(_3),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_1,
);
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
Self::Unit => {
let __result = EnumProjOwn::Unit;
{}
__result
}
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
__field2: T,
__field3: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum<T, U> {
Struct {
#[pin]
pinned1: T,
#[pin]
pinned2: T,
unpinned1: U,
unpinned2: U,
},
Tuple(#[pin] T, #[pin] T, U, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,167 @@
use pin_project::pin_project;
#[pin(__private(project_replace))]
struct Struct<T, U> {
#[pin]
pinned1: T,
#[pin]
pinned2: T,
unpinned1: U,
unpinned2: 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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned1: ::pin_project::__private::Pin<&'pin mut (T)>,
pinned2: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned1: &'pin mut (U),
unpinned2: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned1: ::pin_project::__private::Pin<&'pin (T)>,
pinned2: ::pin_project::__private::Pin<&'pin (T)>,
unpinned1: &'pin (U),
unpinned2: &'pin (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items)]
struct __StructProjectionOwned<T, U> {
pinned1: ::pin_project::__private::PhantomData<T>,
pinned2: ::pin_project::__private::PhantomData<T>,
unpinned1: U,
unpinned2: U,
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
unsafe {
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self
.get_unchecked_mut();
__StructProjection {
pinned1: _pin_project::__private::Pin::new_unchecked(pinned1),
pinned2: _pin_project::__private::Pin::new_unchecked(pinned2),
unpinned1,
unpinned2,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
unsafe {
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self.get_ref();
__StructProjectionRef {
pinned1: _pin_project::__private::Pin::new_unchecked(pinned1),
pinned2: _pin_project::__private::Pin::new_unchecked(pinned2),
unpinned1,
unpinned2,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> __StructProjectionOwned<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
let Self { pinned1, pinned2, unpinned1, unpinned2 } = &mut *__self_ptr;
let __result = __StructProjectionOwned {
pinned1: _pin_project::__private::PhantomData,
pinned2: _pin_project::__private::PhantomData,
unpinned1: _pin_project::__private::ptr::read(unpinned1),
unpinned2: _pin_project::__private::ptr::read(unpinned2),
};
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned2,
);
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned1,
);
}
__result
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned1;
let _ = &this.pinned2;
let _ = &this.unpinned1;
let _ = &this.unpinned2;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace)]
struct Struct<T, U> {
#[pin]
pinned1: T,
#[pin]
pinned2: T,
unpinned1: U,
unpinned2: U,
}
fn main() {}

View File

@@ -0,0 +1,157 @@
use pin_project::pin_project;
#[pin(__private(project_replace))]
struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items)]
struct __TupleStructProjectionOwned<T, U>(
::pin_project::__private::PhantomData<T>,
::pin_project::__private::PhantomData<T>,
U,
U,
);
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1, _2, _3) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_pin_project::__private::Pin::new_unchecked(_1),
_2,
_3,
)
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
unsafe {
let Self(_0, _1, _2, _3) = self.get_ref();
__TupleStructProjectionRef(
_pin_project::__private::Pin::new_unchecked(_0),
_pin_project::__private::Pin::new_unchecked(_1),
_2,
_3,
)
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> __TupleStructProjectionOwned<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
let Self(_0, _1, _2, _3) = &mut *__self_ptr;
let __result = __TupleStructProjectionOwned(
_pin_project::__private::PhantomData,
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_2),
_pin_project::__private::ptr::read(_3),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_1,
);
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
let _ = &this.2;
let _ = &this.3;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace)]
struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, U);
fn main() {}

View File

@@ -0,0 +1,236 @@
use pin_project::pin_project;
#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))]
enum Enum<T, U> {
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
)]
enum Proj<'pin, T, U>
where
Enum<T, U>: '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
)]
enum ProjRef<'pin, T, U>
where
Enum<T, U>: 'pin,
{
Struct { pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U) },
Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (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,
variant_size_differences,
clippy::large_enum_variant,
clippy::missing_docs_in_private_items
)]
enum ProjOwn<T, U> {
Struct { pinned: ::pin_project::__private::PhantomData<T>, unpinned: U },
Tuple(::pin_project::__private::PhantomData<T>, 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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
match self.get_unchecked_mut() {
Self::Struct { pinned, unpinned } => {
Proj::Struct {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
Self::Tuple(_0, _1) => {
Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
Self::Unit => Proj::Unit,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
match self.get_ref() {
Self::Struct { pinned, unpinned } => {
ProjRef::Struct {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
Self::Tuple(_0, _1) => {
ProjRef::Tuple(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
Self::Unit => ProjRef::Unit,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
match &mut *__self_ptr {
Self::Struct { pinned, unpinned } => {
let __result = ProjOwn::Struct {
pinned: _pin_project::__private::PhantomData,
unpinned: _pin_project::__private::ptr::read(unpinned),
};
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned,
);
}
__result
}
Self::Tuple(_0, _1) => {
let __result = ProjOwn::Tuple(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
Self::Unit => {
let __result = ProjOwn::Unit;
{}
__result
}
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,118 @@
use pin_project::pin_project;
#[pin(__private(project = Proj))]
enum Enum<T, U> {
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
)]
enum Proj<'pin, T, U>
where
Enum<T, U>: '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(
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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
match self.get_unchecked_mut() {
Self::Struct { pinned, unpinned } => {
Proj::Struct {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
Self::Tuple(_0, _1) => {
Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
Self::Unit => Proj::Unit,
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,68 @@
use pin_project::pin_project;
#[pin(__private())]
enum Enum<T, U> {
Struct { #[pin] pinned: T, unpinned: U },
Tuple(#[pin] T, 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<T, U> Enum<T, U> {}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,138 @@
use pin_project::pin_project;
#[pin(__private(project_replace = ProjOwn))]
enum Enum<T, U> {
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,
variant_size_differences,
clippy::large_enum_variant,
clippy::missing_docs_in_private_items
)]
enum ProjOwn<T, U> {
Struct { pinned: ::pin_project::__private::PhantomData<T>, unpinned: U },
Tuple(::pin_project::__private::PhantomData<T>, 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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
match &mut *__self_ptr {
Self::Struct { pinned, unpinned } => {
let __result = ProjOwn::Struct {
pinned: _pin_project::__private::PhantomData,
unpinned: _pin_project::__private::ptr::read(unpinned),
};
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned,
);
}
__result
}
Self::Tuple(_0, _1) => {
let __result = ProjOwn::Tuple(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
Self::Unit => {
let __result = ProjOwn::Unit;
{}
__result
}
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace = ProjOwn)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,118 @@
use pin_project::pin_project;
#[pin(__private(project_ref = ProjRef))]
enum Enum<T, U> {
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::ref_option_ref
)]
enum ProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
match self.get_ref() {
Self::Struct { pinned, unpinned } => {
ProjRef::Struct {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
Self::Tuple(_0, _1) => {
ProjRef::Tuple(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
Self::Unit => ProjRef::Unit,
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_ref = ProjRef)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,195 @@
use pin_project::pin_project;
#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))]
struct Struct<T, U> {
#[pin]
pinned: T,
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
)]
struct Proj<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
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
)]
struct ProjRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (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
)]
struct ProjOwn<T, U> {
pinned: ::pin_project::__private::PhantomData<T>,
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;
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
let Self { pinned, unpinned } = self.get_unchecked_mut();
Proj {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
let Self { pinned, unpinned } = self.get_ref();
ProjRef {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
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 = ProjOwn {
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<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,132 @@
use pin_project::pin_project;
#[pin(__private(project = Proj))]
struct Struct<T, U> {
#[pin]
pinned: T,
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
)]
struct Proj<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (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::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
let Self { pinned, unpinned } = self.get_unchecked_mut();
Proj {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
}
#[allow(dead_code)]
#[inline]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,115 @@
use pin_project::pin_project;
#[pin(__private())]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,161 @@
use pin_project::pin_project;
#[pin(__private(project_replace = ProjOwn))]
struct Struct<T, U> {
#[pin]
pinned: T,
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
)]
struct ProjOwn<T, U> {
pinned: ::pin_project::__private::PhantomData<T>,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
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 = ProjOwn {
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<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace = ProjOwn)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,132 @@
use pin_project::pin_project;
#[pin(__private(project_ref = ProjRef))]
struct Struct<T, U> {
#[pin]
pinned: T,
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::ref_option_ref
)]
struct ProjRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
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;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::mut_mut)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
let Self { pinned, unpinned } = self.get_ref();
ProjRef {
pinned: _pin_project::__private::Pin::new_unchecked(pinned),
unpinned,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_ref = ProjRef)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,180 @@
use pin_project::pin_project;
#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))]
struct TupleStruct<T, U>(#[pin] T, 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
)]
struct Proj<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[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
)]
struct ProjRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
#[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
)]
struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, 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<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
Proj(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_ref();
ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
let Self(_0, _1) = &mut *__self_ptr;
let __result = ProjOwn(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,123 @@
use pin_project::pin_project;
#[pin(__private(project = Proj))]
struct TupleStruct<T, U>(#[pin] T, 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
)]
struct Proj<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: '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)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
Proj(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = Proj)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,109 @@
use pin_project::pin_project;
#[pin(__private())]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,152 @@
use pin_project::pin_project;
#[pin(__private(project_replace = ProjOwn))]
struct TupleStruct<T, U>(#[pin] T, 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
)]
struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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,
)
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> ProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
let Self(_0, _1) = &mut *__self_ptr;
let __result = ProjOwn(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace = ProjOwn)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,123 @@
use pin_project::pin_project;
#[pin(__private(project_ref = ProjRef))]
struct TupleStruct<T, U>(#[pin] T, 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
)]
struct ProjRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: '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::mut_mut)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_ref();
ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1)
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_ref = ProjRef)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,165 @@
use pin_project::pin_project;
#[pin(__private(!Unpin, project = EnumProj, project_ref = EnumProjRef))]
enum Enum<T, U> {
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
)]
enum EnumProj<'pin, T, U>
where
Enum<T, U>: '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
)]
enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
#[doc(hidden)]
unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(!Unpin, project = EnumProj, project_ref = EnumProjRef)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,111 @@
use pin_project::pin_project;
#[pin(__private(!Unpin))]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
#[doc(hidden)]
unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(!Unpin)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,105 @@
use pin_project::pin_project;
#[pin(__private(!Unpin))]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
#[doc(hidden)]
unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<
'pin,
_pin_project::__private::PhantomPinned,
>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(!Unpin)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,187 @@
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin(__private(PinnedDrop, project = EnumProj, project_ref = EnumProjRef))]
enum Enum<T, U> {
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
)]
enum EnumProj<'pin, T, U>
where
Enum<T, U>: '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
)]
enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
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]
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)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
impl<T, U> _pin_project::__private::Drop for Enum<T, U> {
#[allow(clippy::missing_inline_in_public_items)]
fn drop(&mut self) {
unsafe {
let __pinned_self = _pin_project::__private::Pin::new_unchecked(self);
_pin_project::__private::PinnedDrop::drop(__pinned_self);
}
}
}
};
#[doc(hidden)]
impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(
clippy::missing_const_for_fn,
clippy::needless_pass_by_value,
clippy::single_call_fn
)]
fn __drop_inner<T, U>(__self: Pin<&mut Enum<T, U>>) {
fn __drop_inner() {}
let _ = __self;
}
__drop_inner(self);
}
}
fn main() {}

View File

@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop, project = EnumProj, project_ref = EnumProjRef)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
#[pinned_drop]
impl<T, U> PinnedDrop for Enum<T, U> {
fn drop(self: Pin<&mut Self>) {
let _ = self;
}
}
fn main() {}

View File

@@ -0,0 +1,132 @@
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin(__private(PinnedDrop))]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
impl<T, U> _pin_project::__private::Drop for Struct<T, U> {
#[allow(clippy::missing_inline_in_public_items)]
fn drop(&mut self) {
unsafe {
let __pinned_self = _pin_project::__private::Pin::new_unchecked(self);
_pin_project::__private::PinnedDrop::drop(__pinned_self);
}
}
}
};
#[doc(hidden)]
impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(
clippy::missing_const_for_fn,
clippy::needless_pass_by_value,
clippy::single_call_fn
)]
fn __drop_inner<T, U>(__self: Pin<&mut Struct<T, U>>) {
fn __drop_inner() {}
let _ = __self;
}
__drop_inner(self);
}
}
fn main() {}

View File

@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
#[pinned_drop]
impl<T, U> PinnedDrop for Struct<T, U> {
fn drop(self: Pin<&mut Self>) {
let _ = self;
}
}
fn main() {}

View File

@@ -0,0 +1,126 @@
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin(__private(PinnedDrop))]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
impl<T, U> _pin_project::__private::Drop for TupleStruct<T, U> {
#[allow(clippy::missing_inline_in_public_items)]
fn drop(&mut self) {
unsafe {
let __pinned_self = _pin_project::__private::Pin::new_unchecked(self);
_pin_project::__private::PinnedDrop::drop(__pinned_self);
}
}
}
};
#[doc(hidden)]
impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(
clippy::missing_const_for_fn,
clippy::needless_pass_by_value,
clippy::single_call_fn
)]
fn __drop_inner<T, U>(__self: Pin<&mut TupleStruct<T, U>>) {
fn __drop_inner() {}
let _ = __self;
}
__drop_inner(self);
}
}
fn main() {}

View File

@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct TupleStruct<T, U>(#[pin] T, U);
#[pinned_drop]
impl<T, U> PinnedDrop for TupleStruct<T, U> {
fn drop(self: Pin<&mut Self>) {
let _ = self;
}
}
fn main() {}

View File

@@ -0,0 +1,138 @@
use pin_project::pin_project;
#[pin(__private(project_replace = EnumProjOwn))]
enum Enum<T, U> {
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,
variant_size_differences,
clippy::large_enum_variant,
clippy::missing_docs_in_private_items
)]
enum EnumProjOwn<T, U> {
Struct { pinned: ::pin_project::__private::PhantomData<T>, unpinned: U },
Tuple(::pin_project::__private::PhantomData<T>, 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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> EnumProjOwn<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
match &mut *__self_ptr {
Self::Struct { pinned, unpinned } => {
let __result = EnumProjOwn::Struct {
pinned: _pin_project::__private::PhantomData,
unpinned: _pin_project::__private::ptr::read(unpinned),
};
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
pinned,
);
}
__result
}
Self::Tuple(_0, _1) => {
let __result = EnumProjOwn::Tuple(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
Self::Unit => {
let __result = EnumProjOwn::Unit;
{}
__result
}
}
}
}
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Enum<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace = EnumProjOwn)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,145 @@
use pin_project::pin_project;
#[pin(__private(project_replace))]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items)]
struct __StructProjectionOwned<T, U> {
pinned: ::pin_project::__private::PhantomData<T>,
unpinned: U,
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> __StructProjectionOwned<T, U> {
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 = __StructProjectionOwned {
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<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __Struct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,139 @@
use pin_project::pin_project;
#[pin(__private(project_replace))]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items)]
struct __TupleStructProjectionOwned<T, U>(
::pin_project::__private::PhantomData<T>,
U,
);
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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,
)
}
}
#[allow(dead_code)]
#[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
) -> __TupleStructProjectionOwned<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
__self_ptr,
__replacement,
);
let Self(_0, _1) = &mut *__self_ptr;
let __result = __TupleStructProjectionOwned(
_pin_project::__private::PhantomData,
_pin_project::__private::ptr::read(_1),
);
{
let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
_0,
);
}
__result
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
#[allow(missing_debug_implementations, unnameable_types)]
struct __TupleStruct<'pin, T, U> {
__pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
'pin,
(
_pin_project::__private::PhantomData<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project_replace)]
struct TupleStruct<T, U>(#[pin] T, U);
fn main() {}

View File

@@ -0,0 +1,170 @@
use pin_project::pin_project;
#[pin(__private(project = EnumProj, project_ref = EnumProjRef))]
pub enum Enum<T, U> {
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(crate) enum EnumProj<'pin, T, U>
where
Enum<T, U>: '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(crate) enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
pub(crate) 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(crate) 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<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
__field1: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Enum<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(project = EnumProj, project_ref = EnumProjRef)]
pub enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
fn main() {}

View File

@@ -0,0 +1,115 @@
use pin_project::pin_project;
#[pin(__private())]
pub struct Struct<T, U> {
#[pin]
pub pinned: T,
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<T, U>: '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<T, U>: 'pin,
{
pub pinned: ::pin_project::__private::Pin<&'pin (T)>,
pub unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
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<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__Struct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
pub struct Struct<T, U> {
#[pin]
pub pinned: T,
pub unpinned: U,
}
fn main() {}

View File

@@ -0,0 +1,109 @@
use pin_project::pin_project;
#[pin(__private())]
pub struct TupleStruct<T, U>(#[pin] pub T, pub 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 __TupleStructProjection<'pin, T, U>(
pub ::pin_project::__private::Pin<&'pin mut (T)>,
pub &'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[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<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
pub(crate) fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_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<T, U>(this: &TupleStruct<T, U>) {
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<T>,
_pin_project::__private::PhantomData<U>,
),
>,
__field0: T,
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
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<T, U>
where
_pin_project::__private::PinnedFieldsOf<
__TupleStruct<'pin, T, U>,
>: _pin_project::__private::Unpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
fn main() {}

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
pub struct TupleStruct<T, U>(#[pin] pub T, pub U);
fn main() {}

View File

@@ -0,0 +1,152 @@
use pin_project::{pin_project, UnsafeUnpin};
#[pin(__private(UnsafeUnpin, project = EnumProj, project_ref = EnumProjRef))]
enum Enum<T, U> {
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
)]
enum EnumProj<'pin, T, U>
where
Enum<T, U>: '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
)]
enum EnumProjRef<'pin, T, U>
where
Enum<T, U>: '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<T, U> Enum<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<'pin, Self>,
>: _pin_project::UnsafeUnpin,
{}
trait EnumMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
unsafe impl<T: Unpin, U> UnsafeUnpin for Enum<T, U> {}
fn main() {}

View File

@@ -0,0 +1,18 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::{pin_project, UnsafeUnpin};
#[pin_project(UnsafeUnpin, project = EnumProj, project_ref = EnumProjRef)]
enum Enum<T, U> {
Struct {
#[pin]
pinned: T,
unpinned: U,
},
Tuple(#[pin] T, U),
Unit,
}
unsafe impl<T: Unpin, U> UnsafeUnpin for Enum<T, U> {}
fn main() {}

View File

@@ -0,0 +1,98 @@
use pin_project::{pin_project, UnsafeUnpin};
#[pin(__private(UnsafeUnpin))]
struct Struct<T, U> {
#[pin]
pinned: T,
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)]
struct __StructProjection<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
unpinned: &'pin mut (U),
}
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __StructProjectionRef<'pin, T, U>
where
Struct<T, U>: 'pin,
{
pinned: ::pin_project::__private::Pin<&'pin (T)>,
unpinned: &'pin (U),
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
#[inline]
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]
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,
}
}
}
}
#[forbid(unaligned_references, safe_packed_borrows)]
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
let _ = &this.pinned;
let _ = &this.unpinned;
}
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<'pin, Self>,
>: _pin_project::UnsafeUnpin,
{}
trait StructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {}
impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {}
fn main() {}

View File

@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::{pin_project, UnsafeUnpin};
#[pin_project(UnsafeUnpin)]
struct Struct<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {}
fn main() {}

View File

@@ -0,0 +1,92 @@
use pin_project::{pin_project, UnsafeUnpin};
#[pin(__private(UnsafeUnpin))]
struct TupleStruct<T, U>(#[pin] T, 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)]
struct __TupleStructProjection<'pin, T, U>(
::pin_project::__private::Pin<&'pin mut (T)>,
&'pin mut (U),
)
where
TupleStruct<T, U>: 'pin;
#[allow(dead_code, clippy::missing_docs_in_private_items, clippy::ref_option_ref)]
struct __TupleStructProjectionRef<'pin, T, U>(
::pin_project::__private::Pin<&'pin (T)>,
&'pin (U),
)
where
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
#[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
unsafe {
let Self(_0, _1) = self.get_unchecked_mut();
__TupleStructProjection(
_pin_project::__private::Pin::new_unchecked(_0),
_1,
)
}
}
#[allow(dead_code)]
#[inline]
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<T, U>(this: &TupleStruct<T, U>) {
let _ = &this.0;
let _ = &this.1;
}
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
where
_pin_project::__private::PinnedFieldsOf<
_pin_project::__private::Wrapper<'pin, Self>,
>: _pin_project::UnsafeUnpin,
{}
trait TupleStructMustNotImplDrop {}
#[allow(clippy::drop_bounds, drop_bounds)]
impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {}
impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {}
#[doc(hidden)]
impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
}
};
unsafe impl<T: Unpin, U> UnsafeUnpin for TupleStruct<T, U> {}
fn main() {}

View File

@@ -0,0 +1,10 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::{pin_project, UnsafeUnpin};
#[pin_project(UnsafeUnpin)]
struct TupleStruct<T, U>(#[pin] T, U);
unsafe impl<T: Unpin, U> UnsafeUnpin for TupleStruct<T, U> {}
fn main() {}

10
vendor/pin-project/tests/expandtest.rs vendored Normal file
View File

@@ -0,0 +1,10 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![cfg(not(miri))]
#[rustversion::attr(not(nightly), ignore)]
#[test]
fn expandtest() {
let args = &["--all-features"];
macrotest::expand_args("tests/expand/**/*.rs", args);
}

View File

@@ -0,0 +1,275 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// 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]
#[derive(Debug)]
pub struct DefaultStruct<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing named struct.
#[::pin_project::pin_project(
project = DefaultStructNamedProj,
project_ref = DefaultStructNamedProjRef,
)]
#[derive(Debug)]
#[allow(clippy::exhaustive_structs)] // for the type itself
pub struct DefaultStructNamed<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing default tuple struct.
#[::pin_project::pin_project]
#[allow(clippy::exhaustive_structs)] // for the type itself
#[derive(Debug)]
pub struct DefaultTupleStruct<T, U>(#[pin] pub T, pub U);
/// Testing named tuple struct.
#[::pin_project::pin_project(
project = DefaultTupleStructNamedProj,
project_ref = DefaultTupleStructNamedProjRef,
)]
#[allow(clippy::exhaustive_structs)] // for the type itself
#[derive(Debug)]
pub struct DefaultTupleStructNamed<T, U>(#[pin] pub T, pub U);
/// Testing enum.
#[allow(clippy::exhaustive_enums)] // for the type itself
#[::pin_project::pin_project(
project = DefaultEnumProj,
project_ref = DefaultEnumProjRef,
)]
#[derive(Debug)]
pub enum DefaultEnum<T, U> {
/// Struct variant.
Struct {
/// Pinned field.
#[pin]
pinned: T,
/// Unpinned field.
unpinned: U,
},
/// Tuple variant.
Tuple(#[pin] T, U),
/// Unit variant.
Unit,
}
/// Testing pinned drop struct.
#[allow(clippy::exhaustive_structs)] // for the type itself
#[::pin_project::pin_project(PinnedDrop)]
#[derive(Debug)]
pub struct PinnedDropStruct<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
#[::pin_project::pinned_drop]
impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
#[allow(clippy::absolute_paths)]
fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
}
/// Testing pinned drop tuple struct.
#[allow(clippy::exhaustive_structs)] // for the type itself
#[::pin_project::pin_project(PinnedDrop)]
#[derive(Debug)]
pub struct PinnedDropTupleStruct<T, U>(#[pin] pub T, pub U);
#[::pin_project::pinned_drop]
impl<T, U> PinnedDrop for PinnedDropTupleStruct<T, U> {
#[allow(clippy::absolute_paths)]
fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
}
/// Testing pinned drop enum.
#[allow(clippy::absolute_paths, clippy::exhaustive_enums)] // for the type itself
#[::pin_project::pin_project(
PinnedDrop,
project = PinnedDropEnumProj,
project_ref = PinnedDropEnumProjRef,
)]
#[derive(Debug)]
pub enum PinnedDropEnum<T: ::pin_project::__private::Unpin, U> {
/// Struct variant.
Struct {
/// Pinned field.
#[pin]
pinned: T,
/// Unpinned field.
unpinned: U,
},
/// Tuple variant.
Tuple(#[pin] T, U),
/// Unit variant.
Unit,
}
#[::pin_project::pinned_drop]
#[allow(clippy::absolute_paths)]
impl<T: ::pin_project::__private::Unpin, U> PinnedDrop for PinnedDropEnum<T, U> {
fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
}
/// Testing default struct with replace.
#[allow(clippy::exhaustive_structs)] // for the type itself
#[::pin_project::pin_project(project_replace)]
#[derive(Debug)]
pub struct ReplaceStruct<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing named struct with replace.
#[::pin_project::pin_project(
project = ReplaceStructNamedProj,
project_ref = ReplaceStructNamedProjRef,
project_replace = ReplaceStructNamedProjOwn,
)]
#[allow(clippy::exhaustive_structs)] // for the type itself
#[derive(Debug)]
pub struct ReplaceStructNamed<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing default struct with replace.
#[::pin_project::pin_project(project_replace)]
#[derive(Debug)]
#[allow(clippy::exhaustive_structs)] // for the type itself
pub struct ReplaceTupleStruct<T, U>(#[pin] pub T, pub U);
/// Testing named struct with replace.
#[::pin_project::pin_project(
project = ReplaceTupleStructNamedProj,
project_ref = ReplaceTupleStructNamedProjRef,
project_replace = ReplaceTupleStructNamedProjOwn,
)]
#[derive(Debug)]
#[allow(clippy::exhaustive_structs)] // for the type itself
pub struct ReplaceTupleStructNamed<T, U>(#[pin] pub T, pub U);
/// Testing enum with replace.
#[allow(clippy::exhaustive_enums)] // for the type itself
#[::pin_project::pin_project(
project = ReplaceEnumProj,
project_ref = ReplaceEnumProjRef,
project_replace = ReplaceEnumProjOwn,
)]
#[derive(Debug)]
pub enum ReplaceEnum<T, U> {
/// Struct variant.
Struct {
/// Pinned field.
#[pin]
pinned: T,
/// Unpinned field.
unpinned: U,
},
/// Tuple variant.
Tuple(#[pin] T, U),
/// Unit variant.
Unit,
}
/// Testing struct with unsafe `Unpin`.
#[::pin_project::pin_project(UnsafeUnpin)]
#[allow(clippy::exhaustive_structs)] // for the type itself
#[derive(Debug)]
pub struct UnsafeUnpinStruct<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing tuple struct with unsafe `Unpin`.
#[::pin_project::pin_project(UnsafeUnpin)]
#[allow(clippy::exhaustive_structs)] // for the type itself
#[derive(Debug)]
pub struct UnsafeUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
/// Testing enum unsafe `Unpin`.
#[allow(clippy::exhaustive_enums)] // for the type itself
#[::pin_project::pin_project(
UnsafeUnpin,
project = UnsafeUnpinEnumProj,
project_ref = UnsafeUnpinEnumProjRef,
)]
#[derive(Debug)]
pub enum UnsafeUnpinEnum<T, U> {
/// Struct variant.
Struct {
/// Pinned field.
#[pin]
pinned: T,
/// Unpinned field.
unpinned: U,
},
/// Tuple variant.
Tuple(#[pin] T, U),
/// Unit variant.
Unit,
}
/// Testing struct with `!Unpin`.
#[::pin_project::pin_project(!Unpin)]
#[derive(Debug)]
#[allow(clippy::exhaustive_structs)] // for the type itself
pub struct NotUnpinStruct<T, U> {
/// Pinned field.
#[pin]
pub pinned: T,
/// Unpinned field.
pub unpinned: U,
}
/// Testing tuple struct with `!Unpin`.
#[allow(clippy::exhaustive_structs)] // for the type itself
#[::pin_project::pin_project(!Unpin)]
#[derive(Debug)]
pub struct NotUnpinTupleStruct<T, U>(#[pin] pub T, pub U);
/// Testing enum with `!Unpin`.
#[allow(clippy::exhaustive_enums)] // for the type itself
#[::pin_project::pin_project(
!Unpin,
project = NotUnpinEnumProj,
project_ref = NotUnpinEnumProjRef,
)]
#[derive(Debug)]
pub enum NotUnpinEnum<T, U> {
/// Struct variant.
Struct {
/// Pinned field.
#[pin]
pinned: T,
/// Unpinned field.
unpinned: U,
},
/// Tuple variant.
Tuple(#[pin] T, U),
/// Unit variant.
Unit,
}

View File

@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
include!("basic-safe-part.rs");
#[allow(unused_qualifications, clippy::absolute_paths, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinStruct<T, U>
{
}
#[allow(unused_qualifications, clippy::absolute_paths, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinTupleStruct<T, U>
{
}
#[allow(unused_qualifications, clippy::absolute_paths, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinEnum<T, U>
{
}

895
vendor/pin-project/tests/pin_project.rs vendored Normal file
View File

@@ -0,0 +1,895 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![allow(
dead_code,
unreachable_pub,
clippy::items_after_statements,
clippy::no_effect_underscore_binding,
clippy::undocumented_unsafe_blocks
)]
#[macro_use]
mod auxiliary;
use std::{
marker::{PhantomData, PhantomPinned},
panic,
pin::Pin,
};
use pin_project::{UnsafeUnpin, pin_project, pinned_drop};
#[test]
fn projection() {
#[pin_project(
project = StructProj,
project_ref = StructProjRef,
project_replace = StructProjOwn,
)]
struct Struct<T, U> {
#[pin]
f1: T,
f2: U,
}
let mut s = Struct { f1: 1, f2: 2 };
let mut s_orig = Pin::new(&mut s);
let s = s_orig.as_mut().project();
let _: Pin<&mut i32> = s.f1;
assert_eq!(*s.f1, 1);
let _: &mut i32 = s.f2;
assert_eq!(*s.f2, 2);
assert_eq!(s_orig.as_ref().f1, 1);
assert_eq!(s_orig.as_ref().f2, 2);
let mut s = Struct { f1: 1, f2: 2 };
let mut s = Pin::new(&mut s);
{
let StructProj { f1, f2 } = s.as_mut().project();
let _: Pin<&mut i32> = f1;
let _: &mut i32 = f2;
}
{
let StructProjRef { f1, f2 } = s.as_ref().project_ref();
let _: Pin<&i32> = f1;
let _: &i32 = f2;
}
{
let StructProjOwn { f1, f2 } = s.as_mut().project_replace(Struct { f1: 3, f2: 4 });
let _: PhantomData<i32> = f1;
let _: i32 = f2;
assert_eq!(f2, 2);
assert_eq!(s.f1, 3);
assert_eq!(s.f2, 4);
}
#[pin_project(project_replace)]
struct TupleStruct<T, U>(#[pin] T, U);
let mut s = TupleStruct(1, 2);
let s = Pin::new(&mut s).project();
let _: Pin<&mut i32> = s.0;
assert_eq!(*s.0, 1);
let _: &mut i32 = s.1;
assert_eq!(*s.1, 2);
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
#[derive(Eq, PartialEq, Debug)]
enum Enum<A, B, C, D> {
Tuple(#[pin] A, B),
Struct {
#[pin]
f1: C,
f2: D,
},
Unit,
}
let mut e = Enum::Tuple(1, 2);
let mut e = Pin::new(&mut e);
match e.as_mut().project() {
EnumProj::Tuple(x, y) => {
let x: Pin<&mut i32> = x;
assert_eq!(*x, 1);
let y: &mut i32 = y;
assert_eq!(*y, 2);
}
EnumProj::Struct { f1, f2 } => {
let _: Pin<&mut i32> = f1;
let _: &mut i32 = f2;
unreachable!();
}
EnumProj::Unit => unreachable!(),
}
assert_eq!(&*e, &Enum::Tuple(1, 2));
let mut e = Enum::Struct { f1: 3, f2: 4 };
let mut e = Pin::new(&mut e);
match e.as_mut().project() {
EnumProj::Tuple(x, y) => {
let _: Pin<&mut i32> = x;
let _: &mut i32 = y;
unreachable!();
}
EnumProj::Struct { f1, f2 } => {
let _: Pin<&mut i32> = f1;
assert_eq!(*f1, 3);
let _: &mut i32 = f2;
assert_eq!(*f2, 4);
}
EnumProj::Unit => unreachable!(),
}
if let EnumProj::Struct { f1, f2 } = e.as_mut().project() {
let _: Pin<&mut i32> = f1;
assert_eq!(*f1, 3);
let _: &mut i32 = f2;
assert_eq!(*f2, 4);
}
}
#[test]
fn enum_project_set() {
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
#[derive(Eq, PartialEq, Debug)]
enum Enum {
V1(#[pin] u8),
V2(bool),
}
let mut e = Enum::V1(25);
let mut e_orig = Pin::new(&mut e);
let e_proj = e_orig.as_mut().project();
match e_proj {
EnumProj::V1(val) => {
let new_e = Enum::V2(val.as_ref().get_ref() == &25);
e_orig.set(new_e);
}
EnumProj::V2(_) => unreachable!(),
}
assert_eq!(e, Enum::V2(true));
}
#[test]
fn where_clause() {
#[pin_project]
struct Struct<T>
where
T: Copy,
{
f: T,
}
#[pin_project]
struct TupleStruct<T>(T)
where
T: Copy;
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum<T>
where
T: Copy,
{
V(T),
}
}
#[test]
fn where_clause_and_associated_type_field() {
#[pin_project(project_replace)]
struct Struct1<I>
where
I: Iterator,
{
#[pin]
f1: I,
f2: I::Item,
}
#[pin_project(project_replace)]
struct Struct2<I, J>
where
I: Iterator<Item = J>,
{
#[pin]
f1: I,
f2: J,
}
#[pin_project(project_replace)]
struct Struct3<T>
where
T: 'static,
{
f: T,
}
trait Static: 'static {}
impl<T> Static for Struct3<T> {}
#[pin_project(project_replace)]
struct TupleStruct<I>(#[pin] I, I::Item)
where
I: Iterator;
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum<I>
where
I: Iterator,
{
V1(#[pin] I),
V2(I::Item),
}
}
#[test]
fn derive_copy() {
#[pin_project(project_replace)]
#[derive(Clone, Copy)]
struct Struct<T> {
f: T,
}
fn is_copy<T: Copy>() {}
is_copy::<Struct<u8>>();
}
#[test]
fn move_out() {
struct NotCopy;
#[pin_project(project_replace)]
struct Struct {
f: NotCopy,
}
let x = Struct { f: NotCopy };
let _val: NotCopy = x.f;
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum {
V(NotCopy),
}
let x = Enum::V(NotCopy);
#[allow(clippy::infallible_destructuring_match)]
let _val: NotCopy = match x {
Enum::V(val) => val,
};
}
#[test]
fn trait_bounds_on_type_generics() {
#[pin_project(project_replace)]
pub struct Struct1<'a, T: ?Sized> {
f: &'a mut T,
}
#[pin_project(project_replace)]
pub struct Struct2<'a, T: ::core::fmt::Debug> {
f: &'a mut T,
}
#[pin_project(project_replace)]
pub struct Struct3<'a, T: core::fmt::Debug> {
f: &'a mut T,
}
#[pin_project(project_replace)]
pub struct Struct4<'a, T: core::fmt::Debug + core::fmt::Display> {
f: &'a mut T,
}
#[pin_project(project_replace)]
pub struct Struct5<'a, T: core::fmt::Debug + ?Sized> {
f: &'a mut T,
}
#[pin_project(project_replace)]
pub struct Struct6<'a, T: core::fmt::Debug = [u8; 16]> {
f: &'a mut T,
}
let _: Struct6<'_> = Struct6 { f: &mut [0_u8; 16] };
#[pin_project(project_replace)]
pub struct Struct7<T: 'static> {
f: T,
}
trait Static: 'static {}
impl<T> Static for Struct7<T> {}
#[pin_project(project_replace)]
pub struct Struct8<'a, 'b: 'a> {
f1: &'a u8,
f2: &'b u8,
}
#[pin_project(project_replace)]
pub struct TupleStruct<'a, T: ?Sized>(&'a mut T);
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum<'a, T: ?Sized> {
V(&'a mut T),
}
}
#[test]
fn overlapping_lifetime_names() {
#[pin_project(project_replace)]
pub struct Struct1<'pin, T> {
#[pin]
f: &'pin mut T,
}
#[pin_project(project_replace)]
pub struct Struct2<'pin, 'pin_, 'pin__> {
#[pin]
f: &'pin &'pin_ &'pin__ (),
}
pub trait Trait<'a> {}
#[pin_project(project_replace)]
pub struct Hrtb<'pin___, T>
where
for<'pin> &'pin T: Unpin,
T: for<'pin> Trait<'pin>,
for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin,
{
#[pin]
f: &'pin___ mut T,
}
#[pin_project(PinnedDrop)]
pub struct PinnedDropStruct<'pin> {
#[pin]
f: &'pin (),
}
#[pinned_drop]
impl PinnedDrop for PinnedDropStruct<'_> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(UnsafeUnpin)]
pub struct UnsafeUnpinStruct<'pin> {
#[pin]
f: &'pin (),
}
unsafe impl UnsafeUnpin for UnsafeUnpinStruct<'_> {}
#[pin_project(!Unpin)]
pub struct NotUnpinStruct<'pin> {
#[pin]
f: &'pin (),
}
}
#[test]
fn combine() {
#[pin_project(PinnedDrop, UnsafeUnpin)]
pub struct PinnedDropWithUnsafeUnpin<T> {
#[pin]
f: T,
}
#[pinned_drop]
impl<T> PinnedDrop for PinnedDropWithUnsafeUnpin<T> {
fn drop(self: Pin<&mut Self>) {}
}
unsafe impl<T: Unpin> UnsafeUnpin for PinnedDropWithUnsafeUnpin<T> {}
#[pin_project(PinnedDrop, !Unpin)]
pub struct PinnedDropWithNotUnpin<T> {
#[pin]
f: T,
}
#[pinned_drop]
impl<T> PinnedDrop for PinnedDropWithNotUnpin<T> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(UnsafeUnpin, project_replace)]
pub struct UnsafeUnpinWithReplace<T> {
#[pin]
f: T,
}
unsafe impl<T: Unpin> UnsafeUnpin for UnsafeUnpinWithReplace<T> {}
#[pin_project(!Unpin, project_replace)]
pub struct NotUnpinWithReplace<T> {
#[pin]
f: T,
}
}
#[test]
fn private_type_in_public_type() {
#[pin_project(project_replace)]
pub struct PublicStruct<T> {
#[pin]
inner: PrivateStruct<T>,
}
struct PrivateStruct<T>(T);
}
#[allow(clippy::needless_lifetimes)]
#[test]
fn lifetime_project() {
#[pin_project(project_replace)]
struct Struct1<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
#[pin_project(project_replace)]
struct Struct2<'a, T, U> {
#[pin]
pinned: &'a T,
unpinned: U,
}
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum<T, U> {
V {
#[pin]
pinned: T,
unpinned: U,
},
}
impl<T, U> Struct1<T, U> {
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a T> {
self.project_ref().pinned
}
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut T> {
self.project().pinned
}
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&T> {
self.project_ref().pinned
}
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut T> {
self.project().pinned
}
}
impl<'b, T, U> Struct2<'b, T, U> {
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a &'b T> {
self.project_ref().pinned
}
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut &'b T> {
self.project().pinned
}
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&&'b T> {
self.project_ref().pinned
}
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut &'b T> {
self.project().pinned
}
}
impl<T, U> Enum<T, U> {
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a T> {
match self.project_ref() {
EnumProjRef::V { pinned, .. } => pinned,
}
}
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut T> {
match self.project() {
EnumProj::V { pinned, .. } => pinned,
}
}
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&T> {
match self.project_ref() {
EnumProjRef::V { pinned, .. } => pinned,
}
}
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut T> {
match self.project() {
EnumProj::V { pinned, .. } => pinned,
}
}
}
}
mod visibility {
use pin_project::pin_project;
#[pin_project(project_replace)]
pub(crate) struct S {
pub f: u8,
}
}
#[test]
fn visibility() {
let mut x = visibility::S { f: 0 };
let x = Pin::new(&mut x);
let y = x.as_ref().project_ref();
let _: &u8 = y.f;
let y = x.project();
let _: &mut u8 = y.f;
}
#[test]
fn trivial_bounds() {
#[pin_project(project_replace)]
pub struct NoGenerics {
#[pin]
f: PhantomPinned,
}
assert_not_unpin!(NoGenerics);
}
#[test]
fn dst() {
#[pin_project]
struct Struct1<T: ?Sized> {
f: T,
}
let mut x = Struct1 { f: 0_u8 };
let x: Pin<&mut Struct1<dyn core::fmt::Debug>> = Pin::new(&mut x);
let _: &mut (dyn core::fmt::Debug) = x.project().f;
#[pin_project]
struct Struct2<T: ?Sized> {
#[pin]
f: T,
}
let mut x = Struct2 { f: 0_u8 };
let x: Pin<&mut Struct2<dyn core::fmt::Debug + Unpin>> = Pin::new(&mut x);
let _: Pin<&mut (dyn core::fmt::Debug + Unpin)> = x.project().f;
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
#[pin_project]
struct Struct3<T>
where
T: ?Sized,
{
f: T,
}
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
#[pin_project]
struct Struct4<T>
where
T: ?Sized,
{
#[pin]
f: T,
}
#[pin_project(UnsafeUnpin)]
struct Struct5<T: ?Sized> {
f: T,
}
#[pin_project(UnsafeUnpin)]
struct Struct6<T: ?Sized> {
#[pin]
f: T,
}
#[pin_project(PinnedDrop)]
struct Struct7<T: ?Sized> {
f: T,
}
#[pinned_drop]
impl<T: ?Sized> PinnedDrop for Struct7<T> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct Struct8<T: ?Sized> {
#[pin]
f: T,
}
#[pinned_drop]
impl<T: ?Sized> PinnedDrop for Struct8<T> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(!Unpin)]
struct Struct9<T: ?Sized> {
f: T,
}
#[pin_project(!Unpin)]
struct Struct10<T: ?Sized> {
#[pin]
f: T,
}
#[pin_project]
struct Struct11<'a, T: ?Sized, U: ?Sized> {
f1: &'a mut T,
f2: U,
}
#[pin_project]
struct TupleStruct1<T: ?Sized>(T);
#[pin_project]
struct TupleStruct2<T: ?Sized>(#[pin] T);
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
#[pin_project]
struct TupleStruct3<T>(T)
where
T: ?Sized;
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
#[pin_project]
struct TupleStruct4<T>(#[pin] T)
where
T: ?Sized;
#[pin_project(UnsafeUnpin)]
struct TupleStruct5<T: ?Sized>(T);
#[pin_project(UnsafeUnpin)]
struct TupleStruct6<T: ?Sized>(#[pin] T);
#[pin_project(PinnedDrop)]
struct TupleStruct7<T: ?Sized>(T);
#[pinned_drop]
impl<T: ?Sized> PinnedDrop for TupleStruct7<T> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct TupleStruct8<T: ?Sized>(#[pin] T);
#[pinned_drop]
impl<T: ?Sized> PinnedDrop for TupleStruct8<T> {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(!Unpin)]
struct TupleStruct9<T: ?Sized>(T);
#[pin_project(!Unpin)]
struct TupleStruct10<T: ?Sized>(#[pin] T);
#[pin_project]
struct TupleStruct11<'a, T: ?Sized, U: ?Sized>(&'a mut T, U);
}
#[test]
fn dyn_type() {
#[pin_project]
struct Struct1 {
f: dyn core::fmt::Debug,
}
#[pin_project]
struct Struct2 {
#[pin]
f: dyn core::fmt::Debug,
}
#[pin_project]
struct Struct3 {
f: dyn core::fmt::Debug + Send,
}
#[pin_project]
struct Struct4 {
#[pin]
f: dyn core::fmt::Debug + Send,
}
#[pin_project]
struct TupleStruct1(dyn core::fmt::Debug);
#[pin_project]
struct TupleStruct2(#[pin] dyn core::fmt::Debug);
#[pin_project]
struct TupleStruct3(dyn core::fmt::Debug + Send);
#[pin_project]
struct TupleStruct4(#[pin] dyn core::fmt::Debug + Send);
}
// TODO: how do we handle this? Should propagate #[repr(...)] to ProjectionOwned? The layout will be different from the original anyway due to PhantomData.
#[allow(clippy::trailing_empty_array)]
#[test]
fn parse_self() {
macro_rules! mac {
($($tt:tt)*) => {
$($tt)*
};
}
pub trait Trait {
type Assoc;
}
#[allow(clippy::type_repetition_in_bounds)]
#[pin_project(project_replace)]
pub struct Generics<T: Trait<Assoc = Self>>
where
Self: Trait<Assoc = Self>,
<Self as Trait>::Assoc: Sized,
mac!(Self): Trait<Assoc = mac!(Self)>,
{
_f: T,
}
impl<T: Trait<Assoc = Self>> Trait for Generics<T> {
type Assoc = Self;
}
#[pin_project(project_replace)]
pub struct Struct {
_f1: Box<Self>,
_f2: Box<<Self as Trait>::Assoc>,
_f3: Box<mac!(Self)>,
_f4: [(); Self::ASSOC],
_f5: [(); Self::assoc()],
_f6: [(); mac!(Self::assoc())],
}
impl Struct {
const ASSOC: usize = 1;
const fn assoc() -> usize {
0
}
}
impl Trait for Struct {
type Assoc = Self;
}
#[pin_project(project_replace)]
struct Tuple(
Box<Self>,
Box<<Self as Trait>::Assoc>,
Box<mac!(Self)>,
[(); Self::ASSOC],
[(); Self::assoc()],
[(); mac!(Self::assoc())],
);
impl Tuple {
const ASSOC: usize = 1;
const fn assoc() -> usize {
0
}
}
impl Trait for Tuple {
type Assoc = Self;
}
#[pin_project(project = EnumProj, project_ref = EnumProjRef, project_replace = EnumProjOwn)]
enum Enum {
Struct {
_f1: Box<Self>,
_f2: Box<<Self as Trait>::Assoc>,
_f3: Box<mac!(Self)>,
_f4: [(); Self::ASSOC],
_f5: [(); Self::assoc()],
_f6: [(); mac!(Self::assoc())],
},
Tuple(
Box<Self>,
Box<<Self as Trait>::Assoc>,
Box<mac!(Self)>,
[(); Self::ASSOC],
[(); Self::assoc()],
[(); mac!(Self::assoc())],
),
}
impl Enum {
const ASSOC: usize = 1;
const fn assoc() -> usize {
0
}
}
impl Trait for Enum {
type Assoc = Self;
}
}
#[test]
fn no_infer_outlives() {
trait Trait<X> {
type Y;
}
struct Struct1<A>(A);
impl<X, T> Trait<X> for Struct1<T> {
type Y = Option<T>;
}
#[pin_project(project_replace)]
struct Struct2<A, B> {
_f: <Struct1<A> as Trait<B>>::Y,
}
}
// https://github.com/rust-lang/rust/issues/47949
// https://github.com/taiki-e/pin-project/pull/194#discussion_r419098111
#[allow(clippy::many_single_char_names)]
#[test]
fn project_replace_panic() {
#[pin_project(project_replace)]
struct S<T, U> {
#[pin]
pinned: T,
unpinned: U,
}
struct D<'a>(&'a mut bool, bool);
impl Drop for D<'_> {
fn drop(&mut self) {
*self.0 = true;
if self.1 {
panic!();
}
}
}
let (mut a, mut b, mut c, mut d) = (false, false, false, false);
let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
let mut x = S { pinned: D(&mut a, true), unpinned: D(&mut b, false) };
let _y = Pin::new(&mut x)
.project_replace(S { pinned: D(&mut c, false), unpinned: D(&mut d, false) });
// Previous `x.pinned` was dropped and panicked when `project_replace` is
// called, so this is unreachable.
unreachable!();
}));
assert!(res.is_err());
assert!(a);
assert!(b);
assert!(c);
assert!(d);
let (mut a, mut b, mut c, mut d) = (false, false, false, false);
let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
let mut x = S { pinned: D(&mut a, false), unpinned: D(&mut b, true) };
{
let _y = Pin::new(&mut x)
.project_replace(S { pinned: D(&mut c, false), unpinned: D(&mut d, false) });
// `_y` (previous `x.unpinned`) live to the end of this scope, so
// this is not unreachable.
// unreachable!();
}
unreachable!();
}));
assert!(res.is_err());
assert!(a);
assert!(b);
assert!(c);
assert!(d);
}

283
vendor/pin-project/tests/pinned_drop.rs vendored Normal file
View File

@@ -0,0 +1,283 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[test]
fn safe_project() {
#[pin_project(PinnedDrop)]
struct Struct<'a> {
was_dropped: &'a mut bool,
#[pin]
field: u8,
}
#[pinned_drop]
impl PinnedDrop for Struct<'_> {
fn drop(self: Pin<&mut Self>) {
**self.project().was_dropped = true;
}
}
let mut was_dropped = false;
drop(Struct { was_dropped: &mut was_dropped, field: 42 });
assert!(was_dropped);
}
#[test]
fn self_call() {
#[pin_project(PinnedDrop)]
struct S<T>(T);
trait Trait {
fn self_ref(&self) {}
fn self_pin_ref(self: Pin<&Self>) {}
fn self_mut(&mut self) {}
fn self_pin_mut(self: Pin<&mut Self>) {}
fn assoc_fn(_this: Pin<&mut Self>) {}
}
impl<T> Trait for S<T> {}
#[pinned_drop]
impl<T> PinnedDrop for S<T> {
fn drop(mut self: Pin<&mut Self>) {
self.self_ref();
self.as_ref().self_pin_ref();
self.self_mut();
self.as_mut().self_pin_mut();
Self::assoc_fn(self.as_mut());
<Self>::assoc_fn(self.as_mut());
}
}
}
#[test]
fn self_ty() {
#[pin_project(PinnedDrop)]
struct Struct {
f: (),
}
#[pinned_drop]
impl PinnedDrop for Struct {
#[allow(irrefutable_let_patterns)]
#[allow(clippy::match_single_binding)]
fn drop(mut self: Pin<&mut Self>) {
// expr
let _: Self = Self { f: () };
// pat
match *self {
Self { f: () } => {}
}
if let Self { f: () } = *self {}
let Self { f: () } = *self;
}
}
#[pin_project(PinnedDrop)]
struct TupleStruct(());
#[pinned_drop]
impl PinnedDrop for TupleStruct {
#[allow(irrefutable_let_patterns)]
fn drop(mut self: Pin<&mut Self>) {
// expr
let _: Self = Self(());
// pat
match *self {
Self(()) => {}
}
if let Self(()) = *self {}
let Self(()) = *self;
}
}
#[pin_project(PinnedDrop, project = EnumProj, project_ref = EnumProjRef)]
enum Enum {
Struct { f: () },
Tuple(()),
Unit,
}
#[pinned_drop]
impl PinnedDrop for Enum {
fn drop(mut self: Pin<&mut Self>) {
// expr
let _: Self = Self::Struct { f: () };
let _: Self = Self::Tuple(());
let _: Self = Self::Unit;
// pat
match *self {
Self::Struct { f: () } | Self::Tuple(()) | Self::Unit => {}
}
if let Self::Struct { f: () } = *self {}
if let Self::Tuple(()) = *self {}
if let Self::Unit = *self {}
}
}
}
#[test]
fn self_inside_macro_containing_fn() {
macro_rules! mac {
($($tt:tt)*) => {
$($tt)*
};
}
#[pin_project(PinnedDrop)]
struct S(());
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
mac!({
#[allow(dead_code)]
struct S(());
impl S {
fn _f(self) -> Self {
self
}
}
});
}
}
}
// See also `ui/pinned_drop/self.rs`.
#[test]
fn self_inside_macro_def() {
#[pin_project(PinnedDrop)]
struct S(());
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
macro_rules! mac {
() => {{
let _ = self;
let _ = Self(());
}};
}
mac!();
}
}
}
#[test]
fn self_arg_inside_macro_call() {
#[pin_project(PinnedDrop)]
struct Struct {
f: (),
}
#[pinned_drop]
impl PinnedDrop for Struct {
fn drop(self: Pin<&mut Self>) {
let _: Vec<_> = vec![self.f];
}
}
}
#[test]
fn self_ty_inside_macro_call() {
macro_rules! mac {
($($tt:tt)*) => {
$($tt)*
};
}
#[pin_project(PinnedDrop)]
struct Struct<T: Send>
where
mac!(Self): Send,
{
_f: T,
}
impl<T: Send> Struct<T> {
const ASSOC1: usize = 1;
fn assoc1() {}
}
trait Trait {
type Assoc2;
const ASSOC2: usize;
fn assoc2();
}
impl<T: Send> Trait for Struct<T> {
type Assoc2 = u8;
const ASSOC2: usize = 2;
fn assoc2() {}
}
#[pinned_drop]
impl<T: Send> PinnedDrop for Struct<T>
where
mac!(Self): Send,
{
#[allow(path_statements)]
#[allow(clippy::no_effect)]
fn drop(self: Pin<&mut Self>) {
// inherent items
mac!(Self::ASSOC1;);
mac!(<Self>::ASSOC1;);
mac!(Self::assoc1(););
mac!(<Self>::assoc1(););
// trait items
mac!(let _: <Self as Trait>::Assoc2;);
mac!(Self::ASSOC2;);
mac!(<Self>::ASSOC2;);
mac!(<Self as Trait>::ASSOC2;);
mac!(Self::assoc2(););
mac!(<Self>::assoc2(););
mac!(<Self as Trait>::assoc2(););
}
}
}
#[test]
fn inside_macro() {
#[pin_project(PinnedDrop)]
struct S(());
macro_rules! mac {
($expr:expr) => {
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
let _ = $expr;
}
}
};
}
mac!(1);
}
mod self_path {
use super::*;
#[pin_project(PinnedDrop)]
struct S<T: Unpin>(T);
fn f() {}
#[pinned_drop]
impl<T: Unpin> PinnedDrop for self::S<T> {
fn drop(mut self: Pin<&mut Self>) {
self::f();
let _: self::S<()> = self::S(());
let _: self::S<Pin<&mut Self>> = self::S(self.as_mut());
let self::S(()) = self::S(());
let self::S(&mut Self(_)) = self::S(&mut *self);
}
}
}

154
vendor/pin-project/tests/proper_unpin.rs vendored Normal file
View File

@@ -0,0 +1,154 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![allow(dead_code)]
#[macro_use]
mod auxiliary;
pub mod default {
use std::marker::PhantomPinned;
use pin_project::pin_project;
struct Inner<T> {
f: T,
}
assert_unpin!(Inner<()>);
assert_not_unpin!(Inner<PhantomPinned>);
#[pin_project]
struct Struct<T, U> {
#[pin]
f1: Inner<T>,
f2: U,
}
assert_unpin!(Struct<(), ()>);
assert_unpin!(Struct<(), PhantomPinned>);
assert_not_unpin!(Struct<PhantomPinned, ()>);
assert_not_unpin!(Struct<PhantomPinned, PhantomPinned>);
#[pin_project(project = EnumProj, project_ref = EnumProjRef)]
enum Enum<T, U> {
V1 {
#[pin]
f1: Inner<T>,
f2: U,
},
}
assert_unpin!(Enum<(), ()>);
assert_unpin!(Enum<(), PhantomPinned>);
assert_not_unpin!(Enum<PhantomPinned, ()>);
assert_not_unpin!(Enum<PhantomPinned, PhantomPinned>);
#[pin_project]
struct TrivialBounds {
#[pin]
f: PhantomPinned,
}
assert_not_unpin!(TrivialBounds);
#[pin_project]
struct PinRef<'a, T, U> {
#[pin]
f1: &'a mut Inner<T>,
f2: U,
}
assert_unpin!(PinRef<'_, PhantomPinned, PhantomPinned>);
}
pub mod cfg {
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[pin_project]
struct Foo<T> {
#[cfg(any())]
#[pin]
f: T,
#[cfg(not(any()))]
f: T,
}
assert_unpin!(Foo<PhantomPinned>);
#[pin_project]
struct Bar<T> {
#[cfg(any())]
f: T,
#[cfg(not(any()))]
#[pin]
f: T,
}
assert_unpin!(Bar<()>);
assert_not_unpin!(Bar<PhantomPinned>);
}
pub mod cfg_attr {
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[cfg_attr(any(), pin_project)]
struct Foo<T> {
f: T,
}
assert_unpin!(Foo<()>);
assert_not_unpin!(Foo<PhantomPinned>);
#[cfg_attr(not(any()), pin_project)]
struct Bar<T> {
#[cfg_attr(not(any()), pin)]
f: T,
}
assert_unpin!(Bar<()>);
assert_not_unpin!(Bar<PhantomPinned>);
}
// pin_project(!Unpin)
pub mod not_unpin {
use std::marker::PhantomPinned;
use pin_project::pin_project;
struct Inner<T> {
f: T,
}
#[pin_project(!Unpin)]
struct Struct<T, U> {
#[pin]
inner: Inner<T>,
other: U,
}
assert_not_unpin!(Struct<(), ()>);
assert_not_unpin!(Struct<(), PhantomPinned>);
assert_not_unpin!(Struct<PhantomPinned, ()>);
assert_not_unpin!(Struct<PhantomPinned, PhantomPinned>);
#[pin_project(!Unpin)]
struct TrivialBounds {
#[pin]
f: PhantomPinned,
}
assert_not_unpin!(TrivialBounds);
#[pin_project(!Unpin)]
struct PinRef<'a, T, U> {
#[pin]
inner: &'a mut Inner<T>,
other: U,
}
assert_not_unpin!(PinRef<'_, (), ()>);
}

51
vendor/pin-project/tests/repr_packed.rs vendored Normal file
View File

@@ -0,0 +1,51 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// unaligned_references did not exist in older compilers and safe_packed_borrows was removed in the latest compilers.
// https://github.com/rust-lang/rust/pull/82525
#![allow(unknown_lints, renamed_and_removed_lints)]
#![forbid(unaligned_references, safe_packed_borrows)]
use std::cell::Cell;
// Ensure that the compiler doesn't copy the fields
// of #[repr(packed)] types during drop, if the field has alignment 1
// (that is, any reference to the field is guaranteed to have proper alignment)
// We are currently unable to statically prevent the usage of #[pin_project]
// on #[repr(packed)] types composed entirely of fields of alignment 1.
// This shouldn't lead to undefined behavior, as long as the compiler doesn't
// try to move the field anyway during drop.
//
// This tests validates that the compiler is doing what we expect.
#[test]
fn weird_repr_packed() {
// We keep track of the field address during
// drop using a thread local, to avoid changing
// the layout of our #[repr(packed)] type.
thread_local! {
static FIELD_ADDR: Cell<usize> = Cell::new(0);
}
#[repr(packed)]
struct Struct {
field: u8,
}
impl Drop for Struct {
fn drop(&mut self) {
FIELD_ADDR.with(|f| {
f.set(&self.field as *const u8 as usize);
});
}
}
let field_addr = {
// We let this field drop by going out of scope,
// rather than explicitly calling drop(foo).
// Calling drop(foo) causes 'foo' to be moved
// into the 'drop' function, resulting in a different
// address.
let x = Struct { field: 27 };
&x.field as *const u8 as usize
};
assert_eq!(field_addr, FIELD_ADDR.with(Cell::get));
}

View File

@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Even if allows private_in_public, these are errors.
#![allow(private_interfaces, dead_code)]
pub enum PublicEnum {
V(PrivateEnum), //~ ERROR E0446
}
enum PrivateEnum {
V(u8),
}
mod foo {
pub(crate) enum CrateEnum {
V(PrivateEnum), //~ ERROR E0446
}
enum PrivateEnum {
V(u8),
}
}
fn main() {}

View File

@@ -0,0 +1,13 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
#[cfg_attr(any(), pin_project::pin_project)]
struct Foo<T> {
f: T,
}
fn main() {
let mut x = Foo { f: 0_u8 };
let _ = Pin::new(&mut x).project(); //~ ERROR E0599
}

View File

@@ -0,0 +1,5 @@
error[E0599]: no method named `project` found for struct `Pin<&mut Foo<u8>>` in the current scope
--> tests/ui/cfg/cfg_attr-resolve.rs:12:30
|
12 | let _ = Pin::new(&mut x).project(); //~ ERROR E0599
| ^^^^^^^ method not found in `Pin<&mut Foo<u8>>`

View File

@@ -0,0 +1,27 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::pin_project;
#[cfg_attr(not(any()), pin_project)]
struct Foo<T> {
#[cfg_attr(any(), pin)]
f: T,
}
#[cfg_attr(not(any()), pin_project)]
struct Bar<T> {
#[cfg_attr(not(any()), pin)]
f: T,
}
fn main() {
let mut x = Foo { f: 0_u8 };
let x = Pin::new(&mut x).project();
let _: Pin<&mut u8> = x.f; //~ ERROR E0308
let mut x = Bar { f: 0_u8 };
let x = Pin::new(&mut x).project();
let _: &mut u8 = x.f; //~ ERROR E0308
}

View File

@@ -0,0 +1,25 @@
error[E0308]: mismatched types
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:22:27
|
22 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308
| ------------ ^^^ expected `Pin<&mut u8>`, found `&mut u8`
| |
| expected due to this
|
= note: expected struct `Pin<&mut u8>`
found mutable reference `&mut u8`
error[E0308]: mismatched types
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:26:22
|
26 | let _: &mut u8 = x.f; //~ ERROR E0308
| ------- ^^^ expected `&mut u8`, found `Pin<&mut u8>`
| |
| expected due to this
|
= note: expected mutable reference `&mut u8`
found struct `Pin<&mut u8>`
help: consider mutably borrowing here
|
26 | let _: &mut u8 = &mut x.f; //~ ERROR E0308
| ++++

View File

@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use auxiliary_macro::hidden_repr;
use pin_project::pin_project;
#[pin_project]
#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types
struct S {
#[cfg(not(any()))]
#[pin]
f: u32,
#[cfg(any())]
#[pin]
f: u8,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[pin_project] attribute may not be used on #[repr(packed)] types
--> tests/ui/cfg/packed_sneaky-span-issue-1.rs:7:15
|
7 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types
| ^^^^^^

View File

@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use auxiliary_macro::hidden_repr;
use pin_project::pin_project;
#[pin_project]
#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types
struct S {
#[cfg(any())]
#[pin]
f: u32,
#[cfg(not(any()))]
#[pin]
f: u8,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[pin_project] attribute may not be used on #[repr(packed)] types
--> tests/ui/cfg/packed_sneaky-span-issue-2.rs:7:15
|
7 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types
| ^^^^^^

View File

@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use auxiliary_macro::hidden_repr_cfg_not_any;
use pin_project::pin_project;
// `#[hidden_repr_cfg_not_any(packed)]` generates `#[cfg_attr(not(any()), repr(packed))]`.
#[pin_project]
#[hidden_repr_cfg_not_any(packed)] //~ ERROR may not be used on #[repr(packed)] types
struct S {
#[pin]
f: u32,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[pin_project] attribute may not be used on #[repr(packed)] types
--> tests/ui/cfg/packed_sneaky.rs:8:27
|
8 | #[hidden_repr_cfg_not_any(packed)] //~ ERROR may not be used on #[repr(packed)] types
| ^^^^^^

View File

@@ -0,0 +1,13 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project]
struct S {
//~^ ERROR may not be used on structs with zero fields
#[cfg(any())]
#[pin]
f: u8,
}
fn main() {}

View File

@@ -0,0 +1,11 @@
error: #[pin_project] attribute may not be used on structs with zero fields
--> tests/ui/cfg/unsupported.rs:6:10
|
6 | struct S {
| __________^
7 | | //~^ ERROR may not be used on structs with zero fields
8 | | #[cfg(any())]
9 | | #[pin]
10 | | f: u8,
11 | | }
| |_^

View File

@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(!Unpin)] //~ ERROR E0119
struct Foo<T, U> {
#[pin]
f1: T,
f2: U,
}
impl<T, U> Unpin for Foo<T, U> where T: Unpin {}
#[pin_project(!Unpin)] //~ ERROR E0119
struct Bar<T, U> {
#[pin]
f1: T,
f2: U,
}
impl<T, U> Unpin for Bar<T, U> {}
#[pin_project(!Unpin)] //~ ERROR E0119
struct Baz<T, U> {
#[pin]
f1: T,
f2: U,
}
impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {}
fn main() {}

View File

@@ -0,0 +1,26 @@
error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:5:15
|
5 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^ conflicting implementation for `Foo<_, _>`
...
12 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {}
| --------------------------------------------- first implementation here
error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:14:15
|
14 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^ conflicting implementation for `Bar<_, _>`
...
21 | impl<T, U> Unpin for Bar<T, U> {}
| ------------------------------ first implementation here
error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:23:15
|
23 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^ conflicting implementation for `Baz<_, _>`
...
30 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {}
| -------------------------------------------- first implementation here

View File

@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::{pin_project, UnsafeUnpin};
#[pin_project(!Unpin)] //~ ERROR E0119
struct Foo<T, U> {
#[pin]
f1: T,
f2: U,
}
unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {}
#[pin_project(!Unpin)] //~ ERROR E0119
struct Bar<T, U> {
#[pin]
f1: T,
f2: U,
}
unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {}
#[pin_project(!Unpin)] //~ ERROR E0119
struct Baz<T, U> {
#[pin]
f1: T,
f2: U,
}
unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {}
fn main() {}

View File

@@ -0,0 +1,32 @@
error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Foo<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:5:1
|
5 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>`
...
12 | unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {}
| ---------------------------------------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Bar<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:14:1
|
14 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>`
...
21 | unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {}
| ------------------------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Baz<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:23:1
|
23 | #[pin_project(!Unpin)] //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>`
...
30 | unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {}
| --------------------------------------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

Some files were not shown because too many files have changed in this diff Show More