about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArvind Mukund <armu30@gmail.com>2024-03-18 19:45:40 -0700
committerArvind Mukund <armu30@gmail.com>2024-04-23 21:27:45 -0700
commitb3f6511755228ee3ff2e59c69f575454f6eb3108 (patch)
treeca511abdfd60a38995ab1163bf5ac9531c2a2b4c
parent014ddac9c98d827237c1179050e5f96312884254 (diff)
downloadrust-b3f6511755228ee3ff2e59c69f575454f6eb3108.tar.gz
rust-b3f6511755228ee3ff2e59c69f575454f6eb3108.zip
Add a test against Result<(), ()>
-rw-r--r--tests/ui/lint/lint-ctypes-enum.rs3
-rw-r--r--tests/ui/lint/lint-ctypes-enum.stderr11
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs
index b69ee82f8ae..19af1de9576 100644
--- a/tests/ui/lint/lint-ctypes-enum.rs
+++ b/tests/ui/lint/lint-ctypes-enum.rs
@@ -170,7 +170,8 @@ extern "C" {
     //~^ ERROR `extern` block uses type
     fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
     //~^ ERROR `extern` block uses type
-
+    fn result_unit_t_e(x: Result<(), ()>);
+    //~^ ERROR `extern` block uses type
 }
 
 pub fn main() {}
diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr
index ab1eb67c075..8d7b28bfb7d 100644
--- a/tests/ui/lint/lint-ctypes-enum.stderr
+++ b/tests/ui/lint/lint-ctypes-enum.stderr
@@ -237,5 +237,14 @@ LL |     fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
-error: aborting due to 25 previous errors
+error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe
+  --> $DIR/lint-ctypes-enum.rs:174:27
+   |
+LL |     fn result_unit_t_e(x: Result<(), ()>);
+   |                           ^^^^^^^^^^^^^^ not FFI-safe
+   |
+   = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+   = note: enum has no representation hint
+
+error: aborting due to 26 previous errors