Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support round tripping anyhow::Error over C FFI as void* #132

Merged
merged 2 commits into from Dec 18, 2020
Merged

Commits on Dec 18, 2020

  1. 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
    dtolnay committed Dec 18, 2020
    Copy the full SHA
    0a218a8 View commit details
    Browse the repository at this point in the history
  2. Mark Error repr transparent

    dtolnay committed Dec 18, 2020
    Copy the full SHA
    3105a73 View commit details
    Browse the repository at this point in the history