• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use pin_project::pin_project;
2 #[pin(
3     __private(
4         project = EnumProj,
5         project_ref = EnumProjRef,
6         project_replace = EnumProjOwn
7     )
8 )]
9 enum Enum<T, U> {
10     Struct { #[pin] pinned1: T, #[pin] pinned2: T, unpinned1: U, unpinned2: U },
11     Tuple(#[pin] T, #[pin] T, U, U),
12     Unit,
13 }
14 #[allow(box_pointers)]
15 #[allow(deprecated)]
16 #[allow(explicit_outlives_requirements)]
17 #[allow(single_use_lifetimes)]
18 #[allow(unreachable_pub)]
19 #[allow(unused_tuple_struct_fields)]
20 #[allow(clippy::unknown_clippy_lints)]
21 #[allow(clippy::pattern_type_mismatch)]
22 #[allow(clippy::redundant_pub_crate)]
23 #[allow(clippy::type_repetition_in_bounds)]
24 #[allow(dead_code)]
25 #[allow(clippy::mut_mut)]
26 enum EnumProj<'pin, T, U>
27 where
28     Enum<T, U>: 'pin,
29 {
30     Struct {
31         pinned1: ::pin_project::__private::Pin<&'pin mut (T)>,
32         pinned2: ::pin_project::__private::Pin<&'pin mut (T)>,
33         unpinned1: &'pin mut (U),
34         unpinned2: &'pin mut (U),
35     },
36     Tuple(
37         ::pin_project::__private::Pin<&'pin mut (T)>,
38         ::pin_project::__private::Pin<&'pin mut (T)>,
39         &'pin mut (U),
40         &'pin mut (U),
41     ),
42     Unit,
43 }
44 #[allow(box_pointers)]
45 #[allow(deprecated)]
46 #[allow(explicit_outlives_requirements)]
47 #[allow(single_use_lifetimes)]
48 #[allow(unreachable_pub)]
49 #[allow(unused_tuple_struct_fields)]
50 #[allow(clippy::unknown_clippy_lints)]
51 #[allow(clippy::pattern_type_mismatch)]
52 #[allow(clippy::redundant_pub_crate)]
53 #[allow(clippy::type_repetition_in_bounds)]
54 #[allow(dead_code)]
55 #[allow(clippy::ref_option_ref)]
56 enum EnumProjRef<'pin, T, U>
57 where
58     Enum<T, U>: 'pin,
59 {
60     Struct {
61         pinned1: ::pin_project::__private::Pin<&'pin (T)>,
62         pinned2: ::pin_project::__private::Pin<&'pin (T)>,
63         unpinned1: &'pin (U),
64         unpinned2: &'pin (U),
65     },
66     Tuple(
67         ::pin_project::__private::Pin<&'pin (T)>,
68         ::pin_project::__private::Pin<&'pin (T)>,
69         &'pin (U),
70         &'pin (U),
71     ),
72     Unit,
73 }
74 #[allow(box_pointers)]
75 #[allow(deprecated)]
76 #[allow(explicit_outlives_requirements)]
77 #[allow(single_use_lifetimes)]
78 #[allow(unreachable_pub)]
79 #[allow(unused_tuple_struct_fields)]
80 #[allow(clippy::unknown_clippy_lints)]
81 #[allow(clippy::pattern_type_mismatch)]
82 #[allow(clippy::redundant_pub_crate)]
83 #[allow(clippy::type_repetition_in_bounds)]
84 #[allow(dead_code)]
85 #[allow(variant_size_differences)]
86 #[allow(clippy::large_enum_variant)]
87 enum EnumProjOwn<T, U> {
88     Struct {
89         pinned1: ::pin_project::__private::PhantomData<T>,
90         pinned2: ::pin_project::__private::PhantomData<T>,
91         unpinned1: U,
92         unpinned2: U,
93     },
94     Tuple(
95         ::pin_project::__private::PhantomData<T>,
96         ::pin_project::__private::PhantomData<T>,
97         U,
98         U,
99     ),
100     Unit,
101 }
102 #[allow(box_pointers)]
103 #[allow(deprecated)]
104 #[allow(explicit_outlives_requirements)]
105 #[allow(single_use_lifetimes)]
106 #[allow(unreachable_pub)]
107 #[allow(unused_tuple_struct_fields)]
108 #[allow(clippy::unknown_clippy_lints)]
109 #[allow(clippy::pattern_type_mismatch)]
110 #[allow(clippy::redundant_pub_crate)]
111 #[allow(clippy::type_repetition_in_bounds)]
112 #[allow(unused_qualifications)]
113 #[allow(clippy::semicolon_if_nothing_returned)]
114 #[allow(clippy::use_self)]
115 #[allow(clippy::used_underscore_binding)]
116 const _: () = {
117     #[allow(unused_extern_crates)]
118     extern crate pin_project as _pin_project;
119     impl<T, U> Enum<T, U> {
120         #[allow(dead_code)]
project<'pin>( self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U>121         fn project<'pin>(
122             self: _pin_project::__private::Pin<&'pin mut Self>,
123         ) -> EnumProj<'pin, T, U> {
124             unsafe {
125                 match self.get_unchecked_mut() {
126                     Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
127                         EnumProj::Struct {
128                             pinned1: _pin_project::__private::Pin::new_unchecked(
129                                 pinned1,
130                             ),
131                             pinned2: _pin_project::__private::Pin::new_unchecked(
132                                 pinned2,
133                             ),
134                             unpinned1,
135                             unpinned2,
136                         }
137                     }
138                     Self::Tuple(_0, _1, _2, _3) => {
139                         EnumProj::Tuple(
140                             _pin_project::__private::Pin::new_unchecked(_0),
141                             _pin_project::__private::Pin::new_unchecked(_1),
142                             _2,
143                             _3,
144                         )
145                     }
146                     Self::Unit => EnumProj::Unit,
147                 }
148             }
149         }
150         #[allow(dead_code)]
151         #[allow(clippy::missing_const_for_fn)]
project_ref<'pin>( self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U>152         fn project_ref<'pin>(
153             self: _pin_project::__private::Pin<&'pin Self>,
154         ) -> EnumProjRef<'pin, T, U> {
155             unsafe {
156                 match self.get_ref() {
157                     Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
158                         EnumProjRef::Struct {
159                             pinned1: _pin_project::__private::Pin::new_unchecked(
160                                 pinned1,
161                             ),
162                             pinned2: _pin_project::__private::Pin::new_unchecked(
163                                 pinned2,
164                             ),
165                             unpinned1,
166                             unpinned2,
167                         }
168                     }
169                     Self::Tuple(_0, _1, _2, _3) => {
170                         EnumProjRef::Tuple(
171                             _pin_project::__private::Pin::new_unchecked(_0),
172                             _pin_project::__private::Pin::new_unchecked(_1),
173                             _2,
174                             _3,
175                         )
176                     }
177                     Self::Unit => EnumProjRef::Unit,
178                 }
179             }
180         }
181         #[allow(dead_code)]
project_replace( self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> EnumProjOwn<T, U>182         fn project_replace(
183             self: _pin_project::__private::Pin<&mut Self>,
184             __replacement: Self,
185         ) -> EnumProjOwn<T, U> {
186             unsafe {
187                 let __self_ptr: *mut Self = self.get_unchecked_mut();
188                 let __guard = _pin_project::__private::UnsafeOverwriteGuard::new(
189                     __self_ptr,
190                     __replacement,
191                 );
192                 match &mut *__self_ptr {
193                     Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
194                         let __result = EnumProjOwn::Struct {
195                             pinned1: _pin_project::__private::PhantomData,
196                             pinned2: _pin_project::__private::PhantomData,
197                             unpinned1: _pin_project::__private::ptr::read(unpinned1),
198                             unpinned2: _pin_project::__private::ptr::read(unpinned2),
199                         };
200                         {
201                             let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
202                                 pinned2,
203                             );
204                             let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
205                                 pinned1,
206                             );
207                         }
208                         __result
209                     }
210                     Self::Tuple(_0, _1, _2, _3) => {
211                         let __result = EnumProjOwn::Tuple(
212                             _pin_project::__private::PhantomData,
213                             _pin_project::__private::PhantomData,
214                             _pin_project::__private::ptr::read(_2),
215                             _pin_project::__private::ptr::read(_3),
216                         );
217                         {
218                             let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
219                                 _1,
220                             );
221                             let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(
222                                 _0,
223                             );
224                         }
225                         __result
226                     }
227                     Self::Unit => {
228                         let __result = EnumProjOwn::Unit;
229                         {}
230                         __result
231                     }
232                 }
233             }
234         }
235     }
236     #[allow(missing_debug_implementations)]
237     struct __Enum<'pin, T, U> {
238         __pin_project_use_generics: _pin_project::__private::AlwaysUnpin<
239             'pin,
240             (
241                 _pin_project::__private::PhantomData<T>,
242                 _pin_project::__private::PhantomData<U>,
243             ),
244         >,
245         __field0: T,
246         __field1: T,
247         __field2: T,
248         __field3: T,
249     }
250     impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
251     where
252         __Enum<'pin, T, U>: _pin_project::__private::Unpin,
253     {}
254     #[doc(hidden)]
255     unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U>
256     where
257         __Enum<'pin, T, U>: _pin_project::__private::Unpin,
258     {}
259     trait EnumMustNotImplDrop {}
260     #[allow(clippy::drop_bounds, drop_bounds)]
261     impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {}
262     impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
263     #[doc(hidden)]
264     impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> {
drop(self: _pin_project::__private::Pin<&mut Self>)265         unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {}
266     }
267 };
main()268 fn main() {}
269