summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/lint-ctypes-fn.stderr
blob: a05206bf18dbb011af416e73a1836858013a1f57 (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
error: `extern` fn uses type `[u32]`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:73:33
   |
LL | pub extern "C" fn slice_type(p: &[u32]) { }
   |                                 ^^^^^^ not FFI-safe
   |
   = help: consider using a raw pointer instead
   = note: slices have no C equivalent
note: the lint level is defined here
  --> $DIR/lint-ctypes-fn.rs:4:9
   |
LL | #![deny(improper_ctypes_definitions)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `str`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:76:31
   |
LL | pub extern "C" 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` fn uses type `Box<[u8]>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:83:34
   |
LL | pub extern "C" fn boxed_slice(p: Box<[u8]>) { }
   |                                  ^^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `Box<str>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:86:35
   |
LL | pub extern "C" fn boxed_string(p: Box<str>) { }
   |                                   ^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `Box<dyn Trait>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:89:34
   |
LL | pub extern "C" fn boxed_trait(p: Box<dyn Trait>) { }
   |                                  ^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: box cannot be represented as a single pointer

error: `extern` fn uses type `char`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:92:32
   |
LL | pub extern "C" 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` fn uses type `i128`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:95:32
   |
LL | pub extern "C" fn i128_type(p: i128) { }
   |                                ^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

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

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

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

error: `extern` fn uses type `ZeroSize`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:107:32
   |
LL | pub extern "C" 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-fn.rs:28:1
   |
LL | pub struct ZeroSize;
   | ^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:110:40
   |
LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { }
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`
note: the type is defined here
  --> $DIR/lint-ctypes-fn.rs:63:1
   |
LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:113:51
   |
LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
   |                                                   ^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` fn uses type `fn()`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:118:30
   |
LL | pub extern "C" 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` fn uses type `fn()`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:121:31
   |
LL | pub extern "C" 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` fn uses type `i128`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:126:39
   |
LL | pub extern "C" fn transparent_i128(p: TransparentI128) { }
   |                                       ^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: 128-bit integers don't currently have a known stable ABI

error: `extern` fn uses type `str`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:129:38
   |
LL | pub extern "C" 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` fn uses type `PhantomData<bool>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:175:43
   |
LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
   |                                           ^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: composed only of `PhantomData`

error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:188:39
   |
LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
   |                                       ^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
  --> $DIR/lint-ctypes-fn.rs:191:41
   |
LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
   |                                         ^^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

error: aborting due to 20 previous errors