1 error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout
2 --> $DIR/lint-ctypes.rs:54:28
4 LL | pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `Foo`
7 note: lint level defined here
8 --> $DIR/lint-ctypes.rs:11:9
10 LL | #![deny(improper_ctypes)]
12 = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
13 note: type defined here
14 --> $DIR/lint-ctypes.rs:32:1
19 error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout
20 --> $DIR/lint-ctypes.rs:55:28
22 LL | pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `Foo`
25 = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
26 note: type defined here
27 --> $DIR/lint-ctypes.rs:32:1
32 error: `extern` block uses type `[u32]` which is not FFI-safe: slices have no C equivalent
33 --> $DIR/lint-ctypes.rs:56:26
35 LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]`
38 = help: consider using a raw pointer instead
40 error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent
41 --> $DIR/lint-ctypes.rs:57:24
43 LL | pub fn str_type(p: &str); //~ ERROR: uses type `str`
46 = help: consider using `*const u8` and a length instead
48 error: `extern` block uses type `std::boxed::Box<u32>` which is not FFI-safe: this struct has unspecified layout
49 --> $DIR/lint-ctypes.rs:58:24
51 LL | pub fn box_type(p: Box<u32>); //~ ERROR uses type `std::boxed::Box<u32>`
54 = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
56 error: `extern` block uses type `char` which is not FFI-safe: the `char` type has no C equivalent
57 --> $DIR/lint-ctypes.rs:59:25
59 LL | pub fn char_type(p: char); //~ ERROR uses type `char`
62 = help: consider using `u32` or `libc::wchar_t` instead
64 error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI
65 --> $DIR/lint-ctypes.rs:60:25
67 LL | pub fn i128_type(p: i128); //~ ERROR uses type `i128`
70 error: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI
71 --> $DIR/lint-ctypes.rs:61:25
73 LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128`
76 error: `extern` block uses type `std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent
77 --> $DIR/lint-ctypes.rs:62:26
79 LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `std::clone::Clone`
82 error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout
83 --> $DIR/lint-ctypes.rs:63:26
85 LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)`
88 = help: consider using a struct instead
90 error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout
91 --> $DIR/lint-ctypes.rs:64:27
93 LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
96 = help: consider using a struct instead
98 error: `extern` block uses type `ZeroSize` which is not FFI-safe: this struct has no fields
99 --> $DIR/lint-ctypes.rs:65:25
101 LL | pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields
104 = help: consider adding a member to this struct
105 note: type defined here
106 --> $DIR/lint-ctypes.rs:28:1
108 LL | pub struct ZeroSize;
109 | ^^^^^^^^^^^^^^^^^^^^
111 error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of PhantomData
112 --> $DIR/lint-ctypes.rs:66:33
114 LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of PhantomData
115 | ^^^^^^^^^^^^^^^^^^^^^^^
117 error: `extern` block uses type `std::marker::PhantomData<bool>` which is not FFI-safe: composed only of PhantomData
118 --> $DIR/lint-ctypes.rs:68:12
120 LL | -> ::std::marker::PhantomData<bool>; //~ ERROR: composed only of PhantomData
121 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123 error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention
124 --> $DIR/lint-ctypes.rs:69:23
126 LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific
129 = help: consider using an `fn "extern"(...) -> ...` function pointer instead
131 error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention
132 --> $DIR/lint-ctypes.rs:70:24
134 LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific
137 = help: consider using an `fn "extern"(...) -> ...` function pointer instead
139 error: `extern` block uses type `std::boxed::Box<u32>` which is not FFI-safe: this struct has unspecified layout
140 --> $DIR/lint-ctypes.rs:71:28
142 LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::Box<u32>`
145 = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
147 error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI
148 --> $DIR/lint-ctypes.rs:72:32
150 LL | pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128`
153 error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent
154 --> $DIR/lint-ctypes.rs:73:31
156 LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str`
159 = help: consider using `*const u8` and a length instead
161 error: `extern` block uses type `std::boxed::Box<u32>` which is not FFI-safe: this struct has unspecified layout
162 --> $DIR/lint-ctypes.rs:74:30
164 LL | pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `std::boxed::Box<u32>`
167 = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
169 error: aborting due to 20 previous errors