1- error: `extern` block uses type `Foo `, which is not FFI-safe
2- --> $DIR/lint-ctypes.rs:47:28
1+ error: `extern` block uses type `&[u32] `, which is not FFI-safe
2+ --> $DIR/lint-ctypes.rs:70:26
33 |
4- LL | pub fn ptr_type1(size: *const Foo);
5- | ^^^^^^^^^^ not FFI-safe
6- |
7- = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
8- = note: this struct has unspecified layout
9- note: the type is defined here
10- --> $DIR/lint-ctypes.rs:25:1
4+ LL | pub fn slice_type(p: &[u32]);
5+ | ^^^^^^ not FFI-safe
116 |
12- LL | pub struct Foo;
13- | ^^^^^^^^^^^^^^
7+ = help: consider using a raw pointer instead
8+ = note: this reference to an unsized type contains metadata, which makes it incompatible with a C pointer
149note: the lint level is defined here
15- --> $DIR/lint-ctypes.rs:4 :9
10+ --> $DIR/lint-ctypes.rs:5 :9
1611 |
1712LL | #![deny(improper_ctypes)]
1813 | ^^^^^^^^^^^^^^^
1914
20- error: `extern` block uses type `Foo`, which is not FFI-safe
21- --> $DIR/lint-ctypes.rs:48:28
22- |
23- LL | pub fn ptr_type2(size: *const Foo);
24- | ^^^^^^^^^^ not FFI-safe
25- |
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:25:1
30- |
31- LL | pub struct Foo;
32- | ^^^^^^^^^^^^^^
33-
34- error: `extern` block uses type `((),)`, which is not FFI-safe
35- --> $DIR/lint-ctypes.rs:50:25
36- |
37- LL | pub fn ptr_tuple(p: *const ((),));
38- | ^^^^^^^^^^^^ not FFI-safe
39- |
40- = help: consider using a struct instead
41- = note: tuples have unspecified layout
42-
43- error: `extern` block uses type `[u32]`, which is not FFI-safe
44- --> $DIR/lint-ctypes.rs:51:26
45- |
46- LL | pub fn slice_type(p: &[u32]);
47- | ^^^^^^ not FFI-safe
48- |
49- = help: consider using a raw pointer instead
50- = note: slices have no C equivalent
51-
52- error: `extern` block uses type `str`, which is not FFI-safe
53- --> $DIR/lint-ctypes.rs:52:24
15+ error: `extern` block uses type `&str`, which is not FFI-safe
16+ --> $DIR/lint-ctypes.rs:71:24
5417 |
5518LL | pub fn str_type(p: &str);
5619 | ^^^^ not FFI-safe
5720 |
5821 = help: consider using `*const u8` and a length instead
59- = note: string slices have no C equivalent
60-
61- error: `extern` block uses type `Box<u32>`, which is not FFI-safe
62- --> $DIR/lint-ctypes.rs:53:24
63- |
64- LL | pub fn box_type(p: Box<u32>);
65- | ^^^^^^^^ not FFI-safe
66- |
67- = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
68- = note: this struct has unspecified layout
22+ = note: this reference to an unsized type contains metadata, which makes it incompatible with a C pointer
6923
7024error: `extern` block uses type `char`, which is not FFI-safe
71- --> $DIR/lint-ctypes.rs:55 :25
25+ --> $DIR/lint-ctypes.rs:74 :25
7226 |
7327LL | pub fn char_type(p: char);
7428 | ^^^^ not FFI-safe
7529 |
7630 = help: consider using `u32` or `libc::wchar_t` instead
7731 = note: the `char` type has no C equivalent
7832
79- error: `extern` block uses type `dyn Bar`, which is not FFI-safe
80- --> $DIR/lint-ctypes.rs:56 :26
33+ error: `extern` block uses type `& dyn Bar`, which is not FFI-safe
34+ --> $DIR/lint-ctypes.rs:75 :26
8135 |
8236LL | pub fn trait_type(p: &dyn Bar);
8337 | ^^^^^^^^ not FFI-safe
8438 |
85- = note: trait objects have no C equivalent
39+ = note: this reference to an unsized type contains metadata, which makes it incompatible with a C pointer
8640
8741error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
88- --> $DIR/lint-ctypes.rs:57 :26
42+ --> $DIR/lint-ctypes.rs:76 :26
8943 |
9044LL | pub fn tuple_type(p: (i32, i32));
9145 | ^^^^^^^^^^ not FFI-safe
@@ -94,7 +48,7 @@ LL | pub fn tuple_type(p: (i32, i32));
9448 = note: tuples have unspecified layout
9549
9650error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
97- --> $DIR/lint-ctypes.rs:58 :27
51+ --> $DIR/lint-ctypes.rs:77 :27
9852 |
9953LL | pub fn tuple_type2(p: I32Pair);
10054 | ^^^^^^^ not FFI-safe
@@ -103,42 +57,42 @@ LL | pub fn tuple_type2(p: I32Pair);
10357 = note: tuples have unspecified layout
10458
10559error: `extern` block uses type `ZeroSize`, which is not FFI-safe
106- --> $DIR/lint-ctypes.rs:59 :25
60+ --> $DIR/lint-ctypes.rs:78 :25
10761 |
10862LL | pub fn zero_size(p: ZeroSize);
10963 | ^^^^^^^^ not FFI-safe
11064 |
11165 = help: consider adding a member to this struct
11266 = note: this struct has no fields
11367note: the type is defined here
114- --> $DIR/lint-ctypes.rs:21 :1
68+ --> $DIR/lint-ctypes.rs:24 :1
11569 |
11670LL | pub struct ZeroSize;
11771 | ^^^^^^^^^^^^^^^^^^^
11872
11973error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
120- --> $DIR/lint-ctypes.rs:60 :33
74+ --> $DIR/lint-ctypes.rs:79 :33
12175 |
12276LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
12377 | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
12478 |
12579 = note: composed only of `PhantomData`
12680note: the type is defined here
127- --> $DIR/lint-ctypes.rs:44 :1
81+ --> $DIR/lint-ctypes.rs:63 :1
12882 |
12983LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
13084 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13185
13286error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe
133- --> $DIR/lint-ctypes.rs:63 :12
87+ --> $DIR/lint-ctypes.rs:82 :12
13488 |
13589LL | -> ::std::marker::PhantomData<bool>;
13690 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
13791 |
13892 = note: composed only of `PhantomData`
13993
14094error: `extern` block uses type `fn()`, which is not FFI-safe
141- --> $DIR/lint-ctypes.rs:64 :23
95+ --> $DIR/lint-ctypes.rs:83 :23
14296 |
14397LL | pub fn fn_type(p: RustFn);
14498 | ^^^^^^ not FFI-safe
@@ -147,34 +101,42 @@ LL | pub fn fn_type(p: RustFn);
147101 = note: this function pointer has Rust-specific calling convention
148102
149103error: `extern` block uses type `fn()`, which is not FFI-safe
150- --> $DIR/lint-ctypes.rs:65 :24
104+ --> $DIR/lint-ctypes.rs:84 :24
151105 |
152106LL | pub fn fn_type2(p: fn());
153107 | ^^^^ not FFI-safe
154108 |
155109 = help: consider using an `extern fn(...) -> ...` function pointer instead
156110 = note: this function pointer has Rust-specific calling convention
157111
158- error: `extern` block uses type `str`, which is not FFI-safe
159- --> $DIR/lint-ctypes.rs:67 :31
112+ error: `extern` block uses type `& str`, which is not FFI-safe
113+ --> $DIR/lint-ctypes.rs:86 :31
160114 |
161115LL | pub fn transparent_str(p: TransparentStr);
162116 | ^^^^^^^^^^^^^^ not FFI-safe
163117 |
164118 = help: consider using `*const u8` and a length instead
165- = note: string slices have no C equivalent
119+ = note: this reference to an unsized type contains metadata, which makes it incompatible with a C pointer
166120
167121error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
168- --> $DIR/lint-ctypes.rs:69 :27
122+ --> $DIR/lint-ctypes.rs:88 :27
169123 |
170124LL | pub fn raw_array(arr: [u8; 8]);
171125 | ^^^^^^^ not FFI-safe
172126 |
173127 = help: consider passing a pointer to the array
174128 = note: passing raw arrays by value is not FFI-safe
175129
130+ error: `extern` block uses type `&UnsizedStructBecauseDyn`, which is not FFI-safe
131+ --> $DIR/lint-ctypes.rs:91:47
132+ |
133+ LL | pub fn struct_unsized_ptr_has_metadata(p: &UnsizedStructBecauseDyn);
134+ | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
135+ |
136+ = note: this reference to an unsized type contains metadata, which makes it incompatible with a C pointer
137+
176138error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
177- --> $DIR/lint-ctypes.rs:71 :26
139+ --> $DIR/lint-ctypes.rs:93 :26
178140 |
179141LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
180142 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -183,13 +145,13 @@ LL | pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
183145 = note: enum has no representation hint
184146
185147error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe
186- --> $DIR/lint-ctypes.rs:73 :26
148+ --> $DIR/lint-ctypes.rs:95 :26
187149 |
188150LL | pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
189151 | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
190152 |
191153 = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
192154 = note: enum has no representation hint
193155
194- error: aborting due to 19 previous errors
156+ error: aborting due to 16 previous errors
195157
0 commit comments