summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/lint-ctypes.stderr
blob: bfec40e1955357e6d56cc18ade0b18d01ccee6ef (plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
error: `extern` block uses type `Foo`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:48:28
   |
LL |     pub fn ptr_type1(size: *const Foo);
   |                            ^^^^^^^^^^ not FFI-safe
   |
note: the lint level is defined here
  --> $DIR/lint-ctypes.rs:4:9
   |
LL | #![deny(improper_ctypes)]
   |         ^^^^^^^^^^^^^^^
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> $DIR/lint-ctypes.rs:26:1
   |
LL | pub struct Foo;
   | ^^^^^^^^^^^^^^

error: `extern` block uses type `Foo`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:49:28
   |
LL |     pub fn ptr_type2(size: *const Foo);
   |                            ^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> $DIR/lint-ctypes.rs:26:1
   |
LL | pub struct Foo;
   | ^^^^^^^^^^^^^^

error: `extern` block uses type `((),)`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:51:25
   |
LL |     pub fn ptr_tuple(p: *const ((),));
   |                         ^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider using a struct instead
   = note: tuples have unspecified layout

error: `extern` block uses type `[u32]`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:52:26
   |
LL |     pub fn slice_type(p: &[u32]);
   |                          ^^^^^^ not FFI-safe
   |
   = help: consider using a raw pointer instead
   = note: slices have no C equivalent

error: `extern` block uses type `str`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:53:24
   |
LL |     pub fn str_type(p: &str);
   |                        ^^^^ not FFI-safe
   |
   = help: consider using `*const u8` and a length instead
   = note: string slices have no C equivalent

error: `extern` block uses type `Box<u32>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:54:24
   |
LL |     pub fn box_type(p: Box<u32>);
   |                        ^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: `extern` block uses type `Option<Box<u32>>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:55:28
   |
LL |     pub fn opt_box_type(p: Option<Box<u32>>);
   |                            ^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
   = note: enum has no representation hint

error: `extern` block uses type `char`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:57:25
   |
LL |     pub fn char_type(p: char);
   |                         ^^^^ not FFI-safe
   |
   = help: consider using `u32` or `libc::wchar_t` instead
   = note: the `char` type has no C equivalent

error: `extern` block uses type `i128`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:58:25
   |
LL |     pub fn i128_type(p: i128);
   |                         ^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `u128`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:59:25
   |
LL |     pub fn u128_type(p: u128);
   |                         ^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `dyn Bar`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:60:26
   |
LL |     pub fn trait_type(p: &dyn Bar);
   |                          ^^^^^^^^ not FFI-safe
   |
   = note: trait objects have no C equivalent

error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:61:26
   |
LL |     pub fn tuple_type(p: (i32, i32));
   |                          ^^^^^^^^^^ not FFI-safe
   |
   = help: consider using a struct instead
   = note: tuples have unspecified layout

error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:62:27
   |
LL |     pub fn tuple_type2(p: I32Pair);
   |                           ^^^^^^^ not FFI-safe
   |
   = help: consider using a struct instead
   = note: tuples have unspecified layout

error: `extern` block uses type `ZeroSize`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:63:25
   |
LL |     pub fn zero_size(p: ZeroSize);
   |                         ^^^^^^^^ not FFI-safe
   |
   = help: consider adding a member to this struct
   = note: this struct has no fields
note: the type is defined here
  --> $DIR/lint-ctypes.rs:22:1
   |
LL | pub struct ZeroSize;
   | ^^^^^^^^^^^^^^^^^^^

error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:64:33
   |
LL |     pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`
note: the type is defined here
  --> $DIR/lint-ctypes.rs:45:1
   |
LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:67:12
   |
LL |         -> ::std::marker::PhantomData<bool>;
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` block uses type `fn()`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:68:23
   |
LL |     pub fn fn_type(p: RustFn);
   |                       ^^^^^^ not FFI-safe
   |
   = help: consider using an `extern fn(...) -> ...` function pointer instead
   = note: this function pointer has Rust-specific calling convention

error: `extern` block uses type `fn()`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:69:24
   |
LL |     pub fn fn_type2(p: fn());
   |                        ^^^^ not FFI-safe
   |
   = help: consider using an `extern fn(...) -> ...` function pointer instead
   = note: this function pointer has Rust-specific calling convention

error: `extern` block uses type `Box<u32>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:70:28
   |
LL |     pub fn fn_contained(p: RustBadRet);
   |                            ^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: `extern` block uses type `i128`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:71:32
   |
LL |     pub fn transparent_i128(p: TransparentI128);
   |                                ^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `str`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:72:31
   |
LL |     pub fn transparent_str(p: TransparentStr);
   |                               ^^^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider using `*const u8` and a length instead
   = note: string slices have no C equivalent

error: `extern` block uses type `Box<u32>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:73:30
   |
LL |     pub fn transparent_fn(p: TransparentBadFn);
   |                              ^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:74:27
   |
LL |     pub fn raw_array(arr: [u8; 8]);
   |                           ^^^^^^^ not FFI-safe
   |
   = help: consider passing a pointer to the array
   = note: passing raw arrays by value is not FFI-safe

error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:76:26
   |
LL |     pub fn no_niche_a(a: Option<UnsafeCell<extern fn()>>);
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
   = note: enum has no representation hint

error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:78:26
   |
LL |     pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
   = note: enum has no representation hint

error: `extern` block uses type `u128`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:81:34
   |
LL |     pub static static_u128_type: u128;
   |                                  ^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: `extern` block uses type `u128`, which is not FFI-safe
  --> $DIR/lint-ctypes.rs:82:40
   |
LL |     pub static static_u128_array_type: [u128; 16];
   |                                        ^^^^^^^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: aborting due to 27 previous errors