1 error: `extern` fn uses type `Foo`, which is not FFI-safe
2 --> $DIR/lint-ctypes-fn.rs:63:35
4 LL | pub extern "C" fn ptr_type1(size: *const Foo) { }
5 | ^^^^^^^^^^ not FFI-safe
7 note: lint level defined here
8 --> $DIR/lint-ctypes-fn.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: type defined here
15 --> $DIR/lint-ctypes-fn.rs:34:1
20 error: `extern` fn uses type `Foo`, which is not FFI-safe
21 --> $DIR/lint-ctypes-fn.rs:66:35
23 LL | pub extern "C" 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: type defined here
29 --> $DIR/lint-ctypes-fn.rs:34:1
34 error: `extern` fn uses type `[u32]`, which is not FFI-safe
35 --> $DIR/lint-ctypes-fn.rs:69:33
37 LL | pub extern "C" fn slice_type(p: &[u32]) { }
40 = help: consider using a raw pointer instead
41 = note: slices have no C equivalent
43 error: `extern` fn uses type `str`, which is not FFI-safe
44 --> $DIR/lint-ctypes-fn.rs:72:31
46 LL | pub extern "C" 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` fn uses type `std::boxed::Box<u32>`, which is not FFI-safe
53 --> $DIR/lint-ctypes-fn.rs:75:31
55 LL | pub extern "C" 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` fn uses type `char`, which is not FFI-safe
62 --> $DIR/lint-ctypes-fn.rs:78:32
64 LL | pub extern "C" fn char_type(p: char) { }
67 = help: consider using `u32` or `libc::wchar_t` instead
68 = note: the `char` type has no C equivalent
70 error: `extern` fn uses type `i128`, which is not FFI-safe
71 --> $DIR/lint-ctypes-fn.rs:81:32
73 LL | pub extern "C" fn i128_type(p: i128) { }
76 = note: 128-bit integers don't currently have a known stable ABI
78 error: `extern` fn uses type `u128`, which is not FFI-safe
79 --> $DIR/lint-ctypes-fn.rs:84:32
81 LL | pub extern "C" fn u128_type(p: u128) { }
84 = note: 128-bit integers don't currently have a known stable ABI
86 error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
87 --> $DIR/lint-ctypes-fn.rs:87:33
89 LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
90 | ^^^^^^^^^^ not FFI-safe
92 = help: consider using a struct instead
93 = note: tuples have unspecified layout
95 error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
96 --> $DIR/lint-ctypes-fn.rs:90:34
98 LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
99 | ^^^^^^^ not FFI-safe
101 = help: consider using a struct instead
102 = note: tuples have unspecified layout
104 error: `extern` fn uses type `ZeroSize`, which is not FFI-safe
105 --> $DIR/lint-ctypes-fn.rs:93:32
107 LL | pub extern "C" fn zero_size(p: ZeroSize) { }
108 | ^^^^^^^^ not FFI-safe
110 = help: consider adding a member to this struct
111 = note: this struct has no fields
112 note: type defined here
113 --> $DIR/lint-ctypes-fn.rs:26:1
115 LL | pub struct ZeroSize;
116 | ^^^^^^^^^^^^^^^^^^^^
118 error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
119 --> $DIR/lint-ctypes-fn.rs:96:40
121 LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { }
122 | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
124 = note: composed only of `PhantomData`
125 note: type defined here
126 --> $DIR/lint-ctypes-fn.rs:61:1
128 LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
129 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131 error: `extern` fn uses type `std::marker::PhantomData<bool>`, which is not FFI-safe
132 --> $DIR/lint-ctypes-fn.rs:99:51
134 LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
135 | ^^^^^^^^^^^^^^^^^ not FFI-safe
137 = note: composed only of `PhantomData`
139 error: `extern` fn uses type `fn()`, which is not FFI-safe
140 --> $DIR/lint-ctypes-fn.rs:104:30
142 LL | pub extern "C" fn fn_type(p: RustFn) { }
143 | ^^^^^^ not FFI-safe
145 = help: consider using an `extern fn(...) -> ...` function pointer instead
146 = note: this function pointer has Rust-specific calling convention
148 error: `extern` fn uses type `fn()`, which is not FFI-safe
149 --> $DIR/lint-ctypes-fn.rs:107:31
151 LL | pub extern "C" fn fn_type2(p: fn()) { }
154 = help: consider using an `extern fn(...) -> ...` function pointer instead
155 = note: this function pointer has Rust-specific calling convention
157 error: `extern` fn uses type `std::boxed::Box<u32>`, which is not FFI-safe
158 --> $DIR/lint-ctypes-fn.rs:110:35
160 LL | pub extern "C" fn fn_contained(p: RustBadRet) { }
161 | ^^^^^^^^^^ not FFI-safe
163 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
164 = note: this struct has unspecified layout
166 error: `extern` fn uses type `i128`, which is not FFI-safe
167 --> $DIR/lint-ctypes-fn.rs:113:39
169 LL | pub extern "C" fn transparent_i128(p: TransparentI128) { }
170 | ^^^^^^^^^^^^^^^ not FFI-safe
172 = note: 128-bit integers don't currently have a known stable ABI
174 error: `extern` fn uses type `str`, which is not FFI-safe
175 --> $DIR/lint-ctypes-fn.rs:116:38
177 LL | pub extern "C" fn transparent_str(p: TransparentStr) { }
178 | ^^^^^^^^^^^^^^ not FFI-safe
180 = help: consider using `*const u8` and a length instead
181 = note: string slices have no C equivalent
183 error: `extern` fn uses type `std::boxed::Box<u32>`, which is not FFI-safe
184 --> $DIR/lint-ctypes-fn.rs:119:37
186 LL | pub extern "C" fn transparent_fn(p: TransparentBadFn) { }
187 | ^^^^^^^^^^^^^^^^ not FFI-safe
189 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
190 = note: this struct has unspecified layout
192 error: `extern` fn uses type `Foo`, which is not FFI-safe
193 --> $DIR/lint-ctypes-fn.rs:161:44
195 LL | pub extern "C" fn unused_generic1<T>(size: *const Foo) { }
196 | ^^^^^^^^^^ not FFI-safe
198 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
199 = note: this struct has unspecified layout
200 note: type defined here
201 --> $DIR/lint-ctypes-fn.rs:34:1
206 error: `extern` fn uses type `std::marker::PhantomData<bool>`, which is not FFI-safe
207 --> $DIR/lint-ctypes-fn.rs:164:43
209 LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
210 | ^^^^^^^^^^^^^^^^^ not FFI-safe
212 = note: composed only of `PhantomData`
214 error: `extern` fn uses type `Foo`, which is not FFI-safe
215 --> $DIR/lint-ctypes-fn.rs:171:48
217 LL | pub extern "C" fn used_generic2<T>(x: T, size: *const Foo) { }
218 | ^^^^^^^^^^ not FFI-safe
220 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
221 = note: this struct has unspecified layout
222 note: type defined here
223 --> $DIR/lint-ctypes-fn.rs:34:1
228 error: `extern` fn uses type `std::vec::Vec<T>`, which is not FFI-safe
229 --> $DIR/lint-ctypes-fn.rs:178:39
231 LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
232 | ^^^^^^ not FFI-safe
234 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
235 = note: this struct has unspecified layout
237 error: `extern` fn uses type `std::vec::Vec<T>`, which is not FFI-safe
238 --> $DIR/lint-ctypes-fn.rs:181:41
240 LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
241 | ^^^^^^ not FFI-safe
243 = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
244 = note: this struct has unspecified layout
246 error: aborting due to 24 previous errors