From b3f6511755228ee3ff2e59c69f575454f6eb3108 Mon Sep 17 00:00:00 2001 From: Arvind Mukund Date: Mon, 18 Mar 2024 19:45:40 -0700 Subject: [PATCH] Add a test against Result<(), ()> --- tests/ui/lint/lint-ctypes-enum.rs | 3 ++- tests/ui/lint/lint-ctypes-enum.stderr | 11 ++++++++++- 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>>); //~^ 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>>); = 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