Skip to content

Commit 223d5eb

Browse files
committed
Add tests
Tests both `T` and `E` for niche variant optimization lints
1 parent 08b85a1 commit 223d5eb

File tree

2 files changed

+270
-57
lines changed

2 files changed

+270
-57
lines changed

tests/ui/lint/lint-ctypes-enum.rs

Lines changed: 113 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,38 +55,120 @@ union TransparentUnion<T: Copy> {
5555

5656
struct Rust<T>(T);
5757

58+
struct NoField;
59+
60+
#[repr(transparent)]
61+
struct Field(());
62+
63+
#[non_exhaustive]
64+
enum NonExhaustive {}
65+
5866
extern "C" {
59-
fn zf(x: Z);
60-
fn uf(x: U); //~ ERROR `extern` block uses type `U`
61-
fn bf(x: B); //~ ERROR `extern` block uses type `B`
62-
fn tf(x: T); //~ ERROR `extern` block uses type `T`
63-
fn repr_c(x: ReprC);
64-
fn repr_u8(x: U8);
65-
fn repr_isize(x: Isize);
66-
fn option_ref(x: Option<&'static u8>);
67-
fn option_fn(x: Option<extern "C" fn()>);
68-
fn nonnull(x: Option<std::ptr::NonNull<u8>>);
69-
fn unique(x: Option<std::ptr::Unique<u8>>);
70-
fn nonzero_u8(x: Option<num::NonZero<u8>>);
71-
fn nonzero_u16(x: Option<num::NonZero<u16>>);
72-
fn nonzero_u32(x: Option<num::NonZero<u32>>);
73-
fn nonzero_u64(x: Option<num::NonZero<u64>>);
74-
fn nonzero_u128(x: Option<num::NonZero<u128>>);
75-
//~^ ERROR `extern` block uses type `u128`
76-
fn nonzero_usize(x: Option<num::NonZero<usize>>);
77-
fn nonzero_i8(x: Option<num::NonZero<i8>>);
78-
fn nonzero_i16(x: Option<num::NonZero<i16>>);
79-
fn nonzero_i32(x: Option<num::NonZero<i32>>);
80-
fn nonzero_i64(x: Option<num::NonZero<i64>>);
81-
fn nonzero_i128(x: Option<num::NonZero<i128>>);
82-
//~^ ERROR `extern` block uses type `i128`
83-
fn nonzero_isize(x: Option<num::NonZero<isize>>);
84-
fn transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
85-
fn transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
86-
fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
87-
//~^ ERROR `extern` block uses type
88-
fn repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type
89-
fn no_result(x: Result<(), num::NonZero<i32>>); //~ ERROR `extern` block uses type
67+
fn zf(x: Z);
68+
fn uf(x: U); //~ ERROR `extern` block uses type `U`
69+
fn bf(x: B); //~ ERROR `extern` block uses type `B`
70+
fn tf(x: T); //~ ERROR `extern` block uses type `T`
71+
fn repr_c(x: ReprC);
72+
fn repr_u8(x: U8);
73+
fn repr_isize(x: Isize);
74+
fn option_ref(x: Option<&'static u8>);
75+
fn option_fn(x: Option<extern "C" fn()>);
76+
fn option_nonnull(x: Option<std::ptr::NonNull<u8>>);
77+
fn option_unique(x: Option<std::ptr::Unique<u8>>);
78+
fn option_nonzero_u8(x: Option<num::NonZero<u8>>);
79+
fn option_nonzero_u16(x: Option<num::NonZero<u16>>);
80+
fn option_nonzero_u32(x: Option<num::NonZero<u32>>);
81+
fn option_nonzero_u64(x: Option<num::NonZero<u64>>);
82+
fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
83+
//~^ ERROR `extern` block uses type `u128`
84+
fn option_nonzero_usize(x: Option<num::NonZero<usize>>);
85+
fn option_nonzero_i8(x: Option<num::NonZero<i8>>);
86+
fn option_nonzero_i16(x: Option<num::NonZero<i16>>);
87+
fn option_nonzero_i32(x: Option<num::NonZero<i32>>);
88+
fn option_nonzero_i64(x: Option<num::NonZero<i64>>);
89+
fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
90+
//~^ ERROR `extern` block uses type `i128`
91+
fn option_nonzero_isize(x: Option<num::NonZero<isize>>);
92+
fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
93+
fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
94+
fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
95+
//~^ ERROR `extern` block uses type
96+
fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type
97+
98+
fn result_ref_t(x: Result<&'static u8, ()>);
99+
fn result_fn_t(x: Result<extern "C" fn(), ()>);
100+
fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>);
101+
fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>);
102+
fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>);
103+
fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>);
104+
fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>);
105+
fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>);
106+
fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
107+
//~^ ERROR `extern` block uses type `u128`
108+
fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>);
109+
fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>);
110+
fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>);
111+
fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>);
112+
fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>);
113+
fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
114+
//~^ ERROR `extern` block uses type `i128`
115+
fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>);
116+
fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>);
117+
fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>);
118+
fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>);
119+
//~^ ERROR `extern` block uses type
120+
fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
121+
//~^ ERROR `extern` block uses type
122+
fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>);
123+
fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>);
124+
fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>);
125+
fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>);
126+
//~^ ERROR `extern` block uses type
127+
fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>);
128+
//~^ ERROR `extern` block uses type
129+
fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>);
130+
fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>);
131+
//~^ ERROR `extern` block uses type
132+
fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
133+
//~^ ERROR `extern` block uses type
134+
135+
fn result_ref_e(x: Result<(), &'static u8>);
136+
fn result_fn_e(x: Result<(), extern "C" fn()>);
137+
fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>);
138+
fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>);
139+
fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>);
140+
fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>);
141+
fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>);
142+
fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>);
143+
fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
144+
//~^ ERROR `extern` block uses type `u128`
145+
fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>);
146+
fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>);
147+
fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>);
148+
fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>);
149+
fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>);
150+
fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
151+
//~^ ERROR `extern` block uses type `i128`
152+
fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>);
153+
fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>);
154+
fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>);
155+
fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>);
156+
//~^ ERROR `extern` block uses type
157+
fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
158+
//~^ ERROR `extern` block uses type
159+
fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>);
160+
fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>);
161+
fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>);
162+
fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>);
163+
//~^ ERROR `extern` block uses type
164+
fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>);
165+
//~^ ERROR `extern` block uses type
166+
fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>);
167+
fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>);
168+
//~^ ERROR `extern` block uses type
169+
fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
170+
//~^ ERROR `extern` block uses type
171+
90172
}
91173

92174
pub fn main() {}

tests/ui/lint/lint-ctypes-enum.stderr

Lines changed: 157 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: `extern` block uses type `U`, which is not FFI-safe
2-
--> $DIR/lint-ctypes-enum.rs:60:13
2+
--> $DIR/lint-ctypes-enum.rs:68:14
33
|
4-
LL | fn uf(x: U);
5-
| ^ not FFI-safe
4+
LL | fn uf(x: U);
5+
| ^ not FFI-safe
66
|
77
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
88
= note: enum has no representation hint
@@ -18,10 +18,10 @@ LL | #![deny(improper_ctypes)]
1818
| ^^^^^^^^^^^^^^^
1919

2020
error: `extern` block uses type `B`, which is not FFI-safe
21-
--> $DIR/lint-ctypes-enum.rs:61:13
21+
--> $DIR/lint-ctypes-enum.rs:69:14
2222
|
23-
LL | fn bf(x: B);
24-
| ^ not FFI-safe
23+
LL | fn bf(x: B);
24+
| ^ not FFI-safe
2525
|
2626
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
2727
= note: enum has no representation hint
@@ -32,10 +32,10 @@ LL | enum B {
3232
| ^^^^^^
3333

3434
error: `extern` block uses type `T`, which is not FFI-safe
35-
--> $DIR/lint-ctypes-enum.rs:62:13
35+
--> $DIR/lint-ctypes-enum.rs:70:14
3636
|
37-
LL | fn tf(x: T);
38-
| ^ not FFI-safe
37+
LL | fn tf(x: T);
38+
| ^ not FFI-safe
3939
|
4040
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
4141
= note: enum has no representation hint
@@ -46,47 +46,178 @@ LL | enum T {
4646
| ^^^^^^
4747

4848
error: `extern` block uses type `u128`, which is not FFI-safe
49-
--> $DIR/lint-ctypes-enum.rs:74:23
49+
--> $DIR/lint-ctypes-enum.rs:82:31
5050
|
51-
LL | fn nonzero_u128(x: Option<num::NonZero<u128>>);
52-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
51+
LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
52+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
5353
|
5454
= note: 128-bit integers don't currently have a known stable ABI
5555

5656
error: `extern` block uses type `i128`, which is not FFI-safe
57-
--> $DIR/lint-ctypes-enum.rs:81:23
57+
--> $DIR/lint-ctypes-enum.rs:89:31
5858
|
59-
LL | fn nonzero_i128(x: Option<num::NonZero<i128>>);
60-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
59+
LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
60+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
6161
|
6262
= note: 128-bit integers don't currently have a known stable ABI
6363

6464
error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
65-
--> $DIR/lint-ctypes-enum.rs:86:28
65+
--> $DIR/lint-ctypes-enum.rs:94:36
6666
|
67-
LL | fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
68-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
67+
LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
68+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
6969
|
7070
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
7171
= note: enum has no representation hint
7272

7373
error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
74-
--> $DIR/lint-ctypes-enum.rs:88:20
74+
--> $DIR/lint-ctypes-enum.rs:96:28
7575
|
76-
LL | fn repr_rust(x: Option<Rust<num::NonZero<u8>>>);
77-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
76+
LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
77+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
7878
|
7979
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
8080
= note: enum has no representation hint
8181

82-
error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe
83-
--> $DIR/lint-ctypes-enum.rs:89:20
82+
error: `extern` block uses type `u128`, which is not FFI-safe
83+
--> $DIR/lint-ctypes-enum.rs:106:33
84+
|
85+
LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
86+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
87+
|
88+
= note: 128-bit integers don't currently have a known stable ABI
89+
90+
error: `extern` block uses type `i128`, which is not FFI-safe
91+
--> $DIR/lint-ctypes-enum.rs:113:33
92+
|
93+
LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
94+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
95+
|
96+
= note: 128-bit integers don't currently have a known stable ABI
97+
98+
error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe
99+
--> $DIR/lint-ctypes-enum.rs:118:38
100+
|
101+
LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>);
102+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
103+
|
104+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
105+
= note: enum has no representation hint
106+
107+
error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe
108+
--> $DIR/lint-ctypes-enum.rs:120:30
109+
|
110+
LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
111+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
112+
|
113+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
114+
= note: enum has no representation hint
115+
116+
error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe
117+
--> $DIR/lint-ctypes-enum.rs:125:53
118+
|
119+
LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>);
120+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
121+
|
122+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
123+
= note: enum has no representation hint
124+
125+
error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe
126+
--> $DIR/lint-ctypes-enum.rs:127:51
127+
|
128+
LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>);
129+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
130+
|
131+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
132+
= note: enum has no representation hint
133+
134+
error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe
135+
--> $DIR/lint-ctypes-enum.rs:130:49
136+
|
137+
LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>);
138+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
139+
|
140+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
141+
= note: enum has no representation hint
142+
143+
error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe
144+
--> $DIR/lint-ctypes-enum.rs:132:30
145+
|
146+
LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
147+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
148+
|
149+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
150+
= note: enum has no representation hint
151+
152+
error: `extern` block uses type `u128`, which is not FFI-safe
153+
--> $DIR/lint-ctypes-enum.rs:143:33
154+
|
155+
LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
156+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
157+
|
158+
= note: 128-bit integers don't currently have a known stable ABI
159+
160+
error: `extern` block uses type `i128`, which is not FFI-safe
161+
--> $DIR/lint-ctypes-enum.rs:150:33
162+
|
163+
LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
164+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
165+
|
166+
= note: 128-bit integers don't currently have a known stable ABI
167+
168+
error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
169+
--> $DIR/lint-ctypes-enum.rs:155:38
170+
|
171+
LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>);
172+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
173+
|
174+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
175+
= note: enum has no representation hint
176+
177+
error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe
178+
--> $DIR/lint-ctypes-enum.rs:157:30
179+
|
180+
LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
181+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
182+
|
183+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
184+
= note: enum has no representation hint
185+
186+
error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe
187+
--> $DIR/lint-ctypes-enum.rs:162:53
188+
|
189+
LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>);
190+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
191+
|
192+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
193+
= note: enum has no representation hint
194+
195+
error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe
196+
--> $DIR/lint-ctypes-enum.rs:164:51
197+
|
198+
LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>);
199+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
200+
|
201+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
202+
= note: enum has no representation hint
203+
204+
error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe
205+
--> $DIR/lint-ctypes-enum.rs:167:49
206+
|
207+
LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>);
208+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
209+
|
210+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
211+
= note: enum has no representation hint
212+
213+
error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe
214+
--> $DIR/lint-ctypes-enum.rs:169:30
84215
|
85-
LL | fn no_result(x: Result<(), num::NonZero<i32>>);
86-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
216+
LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
217+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
87218
|
88219
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
89220
= note: enum has no representation hint
90221

91-
error: aborting due to 8 previous errors
222+
error: aborting due to 23 previous errors
92223

0 commit comments

Comments
 (0)