Skip to content

Commit b3f6511

Browse files
committed
Add a test against Result<(), ()>
1 parent 014ddac commit b3f6511

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
@@ -170,7 +170,8 @@ extern "C" {
170170
//~^ ERROR `extern` block uses type
171171
fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
172172
//~^ ERROR `extern` block uses type
173-
173+
fn result_unit_t_e(x: Result<(), ()>);
174+
//~^ ERROR `extern` block uses type
174175
}
175176

176177
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)