-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathpin-data.expanded.rs
More file actions
123 lines (123 loc) · 3.97 KB
/
Copy pathpin-data.expanded.rs
File metadata and controls
123 lines (123 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use core::marker::PhantomPinned;
use pin_init::*;
struct Foo {
array: [u8; 1024 * 1024],
_pin: PhantomPinned,
}
/// Pin-projections of [`Foo`]
#[allow(dead_code, non_snake_case)]
#[doc(hidden)]
struct FooProjection<'__pin> {
array: &'__pin mut [u8; 1024 * 1024],
_pin: ::core::pin::Pin<&'__pin mut PhantomPinned>,
___pin_phantom_data: ::core::marker::PhantomData<&'__pin mut ()>,
}
impl Foo {
/// Pin-projects all fields of `Self`.
///
/// These fields are structurally pinned:
/// - `_pin`
///
/// These fields are **not** structurally pinned:
/// - `array`
#[inline]
fn project<'__pin>(
self: ::core::pin::Pin<&'__pin mut Self>,
) -> FooProjection<'__pin> {
let this = unsafe { ::core::pin::Pin::get_unchecked_mut(self) };
FooProjection {
array: &mut this.array,
_pin: unsafe { ::core::pin::Pin::new_unchecked(&mut this._pin) },
___pin_phantom_data: ::core::marker::PhantomData,
}
}
}
const _: () = {
#[doc(hidden)]
struct __ThePinData {
__phantom: ::pin_init::__internal::PhantomInvariant<Foo>,
}
impl ::core::clone::Clone for __ThePinData {
fn clone(&self) -> Self {
*self
}
}
impl ::core::marker::Copy for __ThePinData {}
#[allow(dead_code)]
#[expect(clippy::missing_safety_doc)]
impl __ThePinData {
/// Type inference helper function.
#[inline(always)]
fn __make_closure<__F, __E>(self, f: __F) -> __F
where
__F: FnOnce(
*mut Foo,
) -> ::core::result::Result<::pin_init::__internal::InitOk, __E>,
{
f
}
/// # Safety
///
/// - `slot` is valid and properly aligned.
/// - `(*slot).#field_name` is properly aligned.
/// - `(*slot).#field_name` points to uninitialized and exclusively accessed
/// memory.
#[allow(non_snake_case)]
#[inline(always)]
unsafe fn array(
self,
slot: *mut Foo,
) -> ::pin_init::__internal::Slot<
::pin_init::__internal::Unpinned,
[u8; 1024 * 1024],
> {
unsafe { ::pin_init::__internal::Slot::new(&raw mut (*slot).array) }
}
/// # Safety
///
/// - `slot` is valid and properly aligned.
/// - `(*slot).#field_name` is properly aligned.
/// - `(*slot).#field_name` points to uninitialized and exclusively accessed
/// memory.
#[allow(non_snake_case)]
#[inline(always)]
unsafe fn _pin(
self,
slot: *mut Foo,
) -> ::pin_init::__internal::Slot<
::pin_init::__internal::Pinned,
PhantomPinned,
> {
unsafe { ::pin_init::__internal::Slot::new(&raw mut (*slot)._pin) }
}
}
unsafe impl ::pin_init::__internal::HasPinData for Foo {
type PinData = __ThePinData;
unsafe fn __pin_data() -> Self::PinData {
__ThePinData {
__phantom: ::pin_init::__internal::PhantomInvariant::new(),
}
}
}
#[allow(dead_code, non_snake_case)]
struct __Unpin<'__pin> {
__phantom_pin: ::pin_init::__internal::PhantomInvariantLifetime<'__pin>,
__phantom: ::pin_init::__internal::PhantomInvariant<Foo>,
_pin: PhantomPinned,
}
#[doc(hidden)]
impl<'__pin> ::core::marker::Unpin for Foo
where
__Unpin<'__pin>: ::core::marker::Unpin,
{}
trait MustNotImplDrop {}
#[expect(drop_bounds)]
impl<T: ::core::ops::Drop + ?::core::marker::Sized> MustNotImplDrop for T {}
impl MustNotImplDrop for Foo {}
#[expect(non_camel_case_types)]
trait UselessPinnedDropImpl_you_need_to_specify_PinnedDrop {}
impl<
T: ::pin_init::PinnedDrop + ?::core::marker::Sized,
> UselessPinnedDropImpl_you_need_to_specify_PinnedDrop for T {}
impl UselessPinnedDropImpl_you_need_to_specify_PinnedDrop for Foo {}
};