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