1 error: `extern` block uses type `Foo`, which is not FFI-safe
2 --> $DIR/lint-ctypes.rs:48:28
4 LL | pub fn ptr_type1(size: *const Foo);
5 | ^^^^^^^^^^ not FFI-safe
7 note: the lint level is defined here
8 --> $DIR/lint-ctypes.rs:4:9
10 LL | #![deny(improper_ctypes)]
12 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
13 = note: this struct has unspecified layout
14 note: the type is defined here
15 --> $DIR/lint-ctypes.rs:26:1
20 error: `extern` block uses type `Foo`, which is not FFI-safe
21 --> $DIR/lint-ctypes.rs:49:28
23 LL | pub fn ptr_type2(size: *const Foo);
24 | ^^^^^^^^^^ not FFI-safe
26 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
27 = note: this struct has unspecified layout
28 note: the type is defined here
29 --> $DIR/lint-ctypes.rs:26:1
34 error: `extern` block uses type `[u32]`, which is not FFI-safe
35 --> $DIR/lint-ctypes.rs:50:26
37 LL | pub fn slice_type(p: &[u32]);
40 = help: consider using a raw pointer instead
41 = note: slices have no C equivalent
43 error: `extern` block uses type `str`, which is not FFI-safe
44 --> $DIR/lint-ctypes.rs:51:24
46 LL | pub fn str_type(p: &str);
49 = help: consider using `*const u8` and a length instead
50 = note: string slices have no C equivalent
52 error: `extern` block uses type `Box<u32>`, which is not FFI-safe
53 --> $DIR/lint-ctypes.rs:52:24
55 LL | pub fn box_type(p: Box<u32>);
56 | ^^^^^^^^ not FFI-safe
58 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
59 = note: this struct has unspecified layout
61 error: `extern` block uses type `Option<Box<u32>>`, which is not FFI-safe
62 --> $DIR/lint-ctypes.rs:53:28
64 LL | pub fn opt_box_type(p: Option<Box<u32>>);
65 | ^^^^^^^^^^^^^^^^ not FFI-safe
67 = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
68 = note: enum has no representation hint
70 error: `extern` block uses type `char`, which is not FFI-safe
71 --> $DIR/lint-ctypes.rs:55:25
73 LL | pub fn char_type(p: char);
76 = help: consider using `u32` or `libc::wchar_t` instead
77 = note: the `char` type has no C equivalent
79 error: `extern` block uses type `i128`, which is not FFI-safe
80 --> $DIR/lint-ctypes.rs:56:25
82 LL | pub fn i128_type(p: i128);
85 = note: 128-bit integers don't currently have a known stable ABI
87 error: `extern` block uses type `u128`, which is not FFI-safe
88 --> $DIR/lint-ctypes.rs:57:25
90 LL | pub fn u128_type(p: u128);
93 = note: 128-bit integers don't currently have a known stable ABI
95 error: `extern` block uses type `dyn Bar`, which is not FFI-safe
96 --> $DIR/lint-ctypes.rs:58:26
98 LL | pub fn trait_type(p: &dyn Bar);
99 | ^^^^^^^^ not FFI-safe
101 = note: trait objects have no C equivalent
103 error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
104 --> $DIR/lint-ctypes.rs:59:26
106 LL | pub fn tuple_type(p: (i32, i32));
107 | ^^^^^^^^^^ not FFI-safe
109 = help: consider using a struct instead
110 = note: tuples have unspecified layout
112 error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
113 --> $DIR/lint-ctypes.rs:60:27
115 LL | pub fn tuple_type2(p: I32Pair);
116 | ^^^^^^^ not FFI-safe
118 = help: consider using a struct instead
119 = note: tuples have unspecified layout
121 error: `extern` block uses type `ZeroSize`, which is not FFI-safe
122 --> $DIR/lint-ctypes.rs:61:25
124 LL | pub fn zero_size(p: ZeroSize);
125 | ^^^^^^^^ not FFI-safe
127 = help: consider adding a member to this struct
128 = note: this struct has no fields
129 note: the type is defined here
130 --> $DIR/lint-ctypes.rs:22:1
132 LL | pub struct ZeroSize;
133 | ^^^^^^^^^^^^^^^^^^^^
135 error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
136 --> $DIR/lint-ctypes.rs:62:33
138 LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
139 | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
141 = note: composed only of `PhantomData`
142 note: the type is defined here
143 --> $DIR/lint-ctypes.rs:45:1
145 LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
146 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148 error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe
149 --> $DIR/lint-ctypes.rs:65:12
151 LL | -> ::std::marker::PhantomData<bool>;
152 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
154 = note: composed only of `PhantomData`
156 error: `extern` block uses type `fn()`, which is not FFI-safe
157 --> $DIR/lint-ctypes.rs:66:23
159 LL | pub fn fn_type(p: RustFn);
160 | ^^^^^^ not FFI-safe
162 = help: consider using an `extern fn(...) -> ...` function pointer instead
163 = note: this function pointer has Rust-specific calling convention
165 error: `extern` block uses type `fn()`, which is not FFI-safe
166 --> $DIR/lint-ctypes.rs:67:24
168 LL | pub fn fn_type2(p: fn());
171 = help: consider using an `extern fn(...) -> ...` function pointer instead
172 = note: this function pointer has Rust-specific calling convention
174 error: `extern` block uses type `Box<u32>`, which is not FFI-safe
175 --> $DIR/lint-ctypes.rs:68:28
177 LL | pub fn fn_contained(p: RustBadRet);
178 | ^^^^^^^^^^ not FFI-safe
180 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
181 = note: this struct has unspecified layout
183 error: `extern` block uses type `i128`, which is not FFI-safe
184 --> $DIR/lint-ctypes.rs:69:32
186 LL | pub fn transparent_i128(p: TransparentI128);
187 | ^^^^^^^^^^^^^^^ not FFI-safe
189 = note: 128-bit integers don't currently have a known stable ABI
191 error: `extern` block uses type `str`, which is not FFI-safe
192 --> $DIR/lint-ctypes.rs:70:31
194 LL | pub fn transparent_str(p: TransparentStr);
195 | ^^^^^^^^^^^^^^ not FFI-safe
197 = help: consider using `*const u8` and a length instead
198 = note: string slices have no C equivalent
200 error: `extern` block uses type `Box<u32>`, which is not FFI-safe
201 --> $DIR/lint-ctypes.rs:71:30
203 LL | pub fn transparent_fn(p: TransparentBadFn);
204 | ^^^^^^^^^^^^^^^^ not FFI-safe
206 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
207 = note: this struct has unspecified layout
209 error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
210 --> $DIR/lint-ctypes.rs:72:27
212 LL | pub fn raw_array(arr: [u8; 8]);
213 | ^^^^^^^ not FFI-safe
215 = help: consider passing a pointer to the array
216 = note: passing raw arrays by value is not FFI-safe
218 error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
219 --> $DIR/lint-ctypes.rs:74:26
221 LL | pub fn no_niche_a(a: Option<UnsafeCell<extern fn()>>);
222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
224 = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
225 = note: enum has no representation hint
227 error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe
228 --> $DIR/lint-ctypes.rs:76:26
230 LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
231 | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
233 = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
234 = note: enum has no representation hint
236 error: `extern` block uses type `u128`, which is not FFI-safe
237 --> $DIR/lint-ctypes.rs:79:34
239 LL | pub static static_u128_type: u128;
242 = note: 128-bit integers don't currently have a known stable ABI
244 error: `extern` block uses type `u128`, which is not FFI-safe
245 --> $DIR/lint-ctypes.rs:80:40
247 LL | pub static static_u128_array_type: [u128; 16];
248 | ^^^^^^^^^^ not FFI-safe
250 = note: 128-bit integers don't currently have a known stable ABI
252 error: aborting due to 26 previous errors