Skip to content

Commit 26f85dc

Browse files
committed
Add a test against Result<(), ()>
1 parent f3e0a95 commit 26f85dc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ extern "C" {
171171
//~^ ERROR `extern` block uses type
172172
fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
173173
//~^ ERROR `extern` block uses type
174-
174+
fn result_unit_t_e(x: Result<(), ()>);
175+
//~^ ERROR `extern` block uses type
175176
}
176177

177178
pub fn main() {}

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,14 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
237237
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
238238
= note: enum has no representation hint
239239

240-
error: aborting due to 25 previous errors
240+
error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe
241+
--> $DIR/lint-ctypes-enum.rs:174:27
242+
|
243+
LL | fn result_unit_t_e(x: Result<(), ()>);
244+
| ^^^^^^^^^^^^^^ not FFI-safe
245+
|
246+
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
247+
= note: enum has no representation hint
248+
249+
error: aborting due to 26 previous errors
241250

0 commit comments

Comments
 (0)