#![warn(improper_ctypes, improper_ctypes_definitions)]

use anyhow::anyhow;

#[no_mangle]
pub extern "C" fn anyhow1(err: anyhow::Error) {
    println!("{:?}", err);
}

#[no_mangle]
pub extern "C" fn anyhow2(err: &mut Option<anyhow::Error>) {
    *err = Some(anyhow!("ffi error"));
}

#[no_mangle]
pub extern "C" fn anyhow3() -> Option<anyhow::Error> {
    Some(anyhow!("ffi error"))
}

Add test of anyhow::Error in ffi signature
Add test of anyhow::Error in ffi signature

Currently:

    warning: `extern` fn uses type `anyhow::Error`, which is not FFI-safe
     --> tests/test_ffi.rs:6:32
      |
    6 | pub extern "C" fn anyhow1(err: anyhow::Error) {
      |                                ^^^^^^^^^^^^^ not FFI-safe
      |
    note: the lint level is defined here
     --> tests/test_ffi.rs:1:26
      |
    1 | #![warn(improper_ctypes, improper_ctypes_definitions)]
      |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
      = note: this struct has unspecified layout

    warning: `extern` fn uses type `Option<anyhow::Error>`, which is not FFI-safe
      --> tests/test_ffi.rs:16:32
       |
    16 | pub extern "C" fn anyhow3() -> Option<anyhow::Error> {
       |                                ^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
       |
       = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
       = note: enum has no representation hint
