1 use pin_project::{pin_project, pinned_drop};
2 use std::pin::Pin;
3 # [pin (__private (PinnedDrop , project = EnumProj , project_ref = EnumProjRef))]
4 enum Enum<T, U> {
5 Struct {
6 #[pin]
7 pinned: T,
8 unpinned: U,
9 },
10 Tuple(#[pin] T, U),
11 Unit,
12 }
13 #[allow(box_pointers)]
14 #[allow(deprecated)]
15 #[allow(explicit_outlives_requirements)]
16 #[allow(single_use_lifetimes)]
17 #[allow(unreachable_pub)]
18 #[allow(clippy::unknown_clippy_lints)]
19 #[allow(clippy::pattern_type_mismatch)]
20 #[allow(clippy::redundant_pub_crate)]
21 #[allow(dead_code)]
22 #[allow(clippy::mut_mut)]
23 #[allow(clippy::type_repetition_in_bounds)]
24 enum EnumProj<'pin, T, U>
25 where
26 Enum<T, U>: 'pin,
27 {
28 Struct {
29 pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
30 unpinned: &'pin mut (U),
31 },
32 Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)),
33 Unit,
34 }
35 #[allow(box_pointers)]
36 #[allow(deprecated)]
37 #[allow(explicit_outlives_requirements)]
38 #[allow(single_use_lifetimes)]
39 #[allow(unreachable_pub)]
40 #[allow(clippy::unknown_clippy_lints)]
41 #[allow(clippy::pattern_type_mismatch)]
42 #[allow(clippy::redundant_pub_crate)]
43 #[allow(dead_code)]
44 #[allow(clippy::ref_option_ref)]
45 #[allow(clippy::type_repetition_in_bounds)]
46 enum EnumProjRef<'pin, T, U>
47 where
48 Enum<T, U>: 'pin,
49 {
50 Struct {
51 pinned: ::pin_project::__private::Pin<&'pin (T)>,
52 unpinned: &'pin (U),
53 },
54 Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)),
55 Unit,
56 }
57 #[allow(box_pointers)]
58 #[allow(deprecated)]
59 #[allow(explicit_outlives_requirements)]
60 #[allow(single_use_lifetimes)]
61 #[allow(unreachable_pub)]
62 #[allow(clippy::unknown_clippy_lints)]
63 #[allow(clippy::pattern_type_mismatch)]
64 #[allow(clippy::redundant_pub_crate)]
65 #[allow(clippy::semicolon_if_nothing_returned)]
66 #[allow(clippy::used_underscore_binding)]
67 const _: () = {
68 impl<T, U> Enum<T, U> {
project<'pin>( self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U>69 fn project<'pin>(
70 self: ::pin_project::__private::Pin<&'pin mut Self>,
71 ) -> EnumProj<'pin, T, U> {
72 unsafe {
73 match self.get_unchecked_mut() {
74 Self::Struct { pinned, unpinned } => EnumProj::Struct {
75 pinned: ::pin_project::__private::Pin::new_unchecked(pinned),
76 unpinned,
77 },
78 Self::Tuple(_0, _1) => {
79 EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1)
80 }
81 Self::Unit => EnumProj::Unit,
82 }
83 }
84 }
85 #[allow(clippy::missing_const_for_fn)]
project_ref<'pin>( self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U>86 fn project_ref<'pin>(
87 self: ::pin_project::__private::Pin<&'pin Self>,
88 ) -> EnumProjRef<'pin, T, U> {
89 unsafe {
90 match self.get_ref() {
91 Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
92 pinned: ::pin_project::__private::Pin::new_unchecked(pinned),
93 unpinned,
94 },
95 Self::Tuple(_0, _1) => {
96 EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1)
97 }
98 Self::Unit => EnumProjRef::Unit,
99 }
100 }
101 }
102 }
103 #[allow(missing_debug_implementations)]
104 struct __Enum<'pin, T, U> {
105 __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<
106 'pin,
107 (
108 ::pin_project::__private::PhantomData<T>,
109 ::pin_project::__private::PhantomData<U>,
110 ),
111 >,
112 __field0: T,
113 __field1: T,
114 }
115 impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where
116 __Enum<'pin, T, U>: ::pin_project::__private::Unpin
117 {
118 }
119 #[doc(hidden)]
120 unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where
121 __Enum<'pin, T, U>: ::pin_project::__private::Unpin
122 {
123 }
124 impl<T, U> ::pin_project::__private::Drop for Enum<T, U> {
drop(&mut self)125 fn drop(&mut self) {
126 unsafe {
127 let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self);
128 ::pin_project::__private::PinnedDrop::drop(__pinned_self);
129 }
130 }
131 }
132 };
133 impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> {
drop(self: Pin<&mut Self>)134 unsafe fn drop(self: Pin<&mut Self>) {
135 #[allow(clippy::needless_pass_by_value)]
136 fn __drop_inner<T, U>(__self: Pin<&mut Enum<T, U>>) {
137 fn __drop_inner() {}
138 let _ = __self;
139 }
140 __drop_inner(self);
141 }
142 }
main()143 fn main() {}
144