1 use pin_project::pin_project;
2 #[pin(__private(project_replace))]
3 struct Struct<T, U> {
4     #[pin]
5     pinned1: T,
6     #[pin]
7     pinned2: T,
8     unpinned1: U,
9     unpinned2: U,
10 }
11 #[allow(box_pointers)]
12 #[allow(deprecated)]
13 #[allow(explicit_outlives_requirements)]
14 #[allow(single_use_lifetimes)]
15 #[allow(unreachable_pub)]
16 #[allow(clippy::unknown_clippy_lints)]
17 #[allow(clippy::pattern_type_mismatch)]
18 #[allow(clippy::redundant_pub_crate)]
19 #[allow(clippy::semicolon_if_nothing_returned)]
20 #[allow(clippy::used_underscore_binding)]
21 const _: () = {
22     #[allow(box_pointers)]
23     #[allow(deprecated)]
24     #[allow(explicit_outlives_requirements)]
25     #[allow(single_use_lifetimes)]
26     #[allow(unreachable_pub)]
27     #[allow(clippy::unknown_clippy_lints)]
28     #[allow(clippy::pattern_type_mismatch)]
29     #[allow(clippy::redundant_pub_crate)]
30     #[allow(dead_code)]
31     #[allow(clippy::mut_mut)]
32     #[allow(clippy::type_repetition_in_bounds)]
33     struct __StructProjection<'pin, T, U>
34     where
35         Struct<T, U>: 'pin,
36     {
37         pinned1: ::pin_project::__private::Pin<&'pin mut (T)>,
38         pinned2: ::pin_project::__private::Pin<&'pin mut (T)>,
39         unpinned1: &'pin mut (U),
40         unpinned2: &'pin mut (U),
41     }
42     #[allow(box_pointers)]
43     #[allow(deprecated)]
44     #[allow(explicit_outlives_requirements)]
45     #[allow(single_use_lifetimes)]
46     #[allow(unreachable_pub)]
47     #[allow(clippy::unknown_clippy_lints)]
48     #[allow(clippy::pattern_type_mismatch)]
49     #[allow(clippy::redundant_pub_crate)]
50     #[allow(dead_code)]
51     #[allow(clippy::ref_option_ref)]
52     #[allow(clippy::type_repetition_in_bounds)]
53     struct __StructProjectionRef<'pin, T, U>
54     where
55         Struct<T, U>: 'pin,
56     {
57         pinned1: ::pin_project::__private::Pin<&'pin (T)>,
58         pinned2: ::pin_project::__private::Pin<&'pin (T)>,
59         unpinned1: &'pin (U),
60         unpinned2: &'pin (U),
61     }
62     #[allow(box_pointers)]
63     #[allow(deprecated)]
64     #[allow(explicit_outlives_requirements)]
65     #[allow(single_use_lifetimes)]
66     #[allow(unreachable_pub)]
67     #[allow(clippy::unknown_clippy_lints)]
68     #[allow(clippy::pattern_type_mismatch)]
69     #[allow(clippy::redundant_pub_crate)]
70     #[allow(dead_code)]
71     struct __StructProjectionOwned<T, U> {
72         pinned1: ::pin_project::__private::PhantomData<T>,
73         pinned2: ::pin_project::__private::PhantomData<T>,
74         unpinned1: U,
75         unpinned2: U,
76     }
77     impl<T, U> Struct<T, U> {
project<'pin>( self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U>78         fn project<'pin>(
79             self: ::pin_project::__private::Pin<&'pin mut Self>,
80         ) -> __StructProjection<'pin, T, U> {
81             unsafe {
82                 let Self {
83                     pinned1,
84                     pinned2,
85                     unpinned1,
86                     unpinned2,
87                 } = self.get_unchecked_mut();
88                 __StructProjection {
89                     pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1),
90                     pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2),
91                     unpinned1,
92                     unpinned2,
93                 }
94             }
95         }
96         #[allow(clippy::missing_const_for_fn)]
project_ref<'pin>( self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U>97         fn project_ref<'pin>(
98             self: ::pin_project::__private::Pin<&'pin Self>,
99         ) -> __StructProjectionRef<'pin, T, U> {
100             unsafe {
101                 let Self {
102                     pinned1,
103                     pinned2,
104                     unpinned1,
105                     unpinned2,
106                 } = self.get_ref();
107                 __StructProjectionRef {
108                     pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1),
109                     pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2),
110                     unpinned1,
111                     unpinned2,
112                 }
113             }
114         }
project_replace( self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned<T, U>115         fn project_replace(
116             self: ::pin_project::__private::Pin<&mut Self>,
117             __replacement: Self,
118         ) -> __StructProjectionOwned<T, U> {
119             unsafe {
120                 let __self_ptr: *mut Self = self.get_unchecked_mut();
121                 let __guard = ::pin_project::__private::UnsafeOverwriteGuard {
122                     target: __self_ptr,
123                     value: ::pin_project::__private::ManuallyDrop::new(__replacement),
124                 };
125                 let Self {
126                     pinned1,
127                     pinned2,
128                     unpinned1,
129                     unpinned2,
130                 } = &mut *__self_ptr;
131                 let __result = __StructProjectionOwned {
132                     pinned1: ::pin_project::__private::PhantomData,
133                     pinned2: ::pin_project::__private::PhantomData,
134                     unpinned1: ::pin_project::__private::ptr::read(unpinned1),
135                     unpinned2: ::pin_project::__private::ptr::read(unpinned2),
136                 };
137                 {
138                     let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned2);
139                     let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1);
140                 }
141                 __result
142             }
143         }
144     }
145     #[forbid(safe_packed_borrows)]
__assert_not_repr_packed<T, U>(this: &Struct<T, U>)146     fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
147         let _ = &this.pinned1;
148         let _ = &this.pinned2;
149         let _ = &this.unpinned1;
150         let _ = &this.unpinned2;
151     }
152     #[allow(missing_debug_implementations)]
153     struct __Struct<'pin, T, U> {
154         __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<
155             'pin,
156             (
157                 ::pin_project::__private::PhantomData<T>,
158                 ::pin_project::__private::PhantomData<U>,
159             ),
160         >,
161         __field0: T,
162         __field1: T,
163     }
164     impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where
165         __Struct<'pin, T, U>: ::pin_project::__private::Unpin
166     {
167     }
168     #[doc(hidden)]
169     unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where
170         __Struct<'pin, T, U>: ::pin_project::__private::Unpin
171     {
172     }
173     trait StructMustNotImplDrop {}
174     #[allow(clippy::drop_bounds, drop_bounds)]
175     impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {}
176     impl<T, U> StructMustNotImplDrop for Struct<T, U> {}
177     #[doc(hidden)]
178     impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> {
drop(self: ::pin_project::__private::Pin<&mut Self>)179         unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
180     }
181 };
main()182 fn main() {}
183