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

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 18, 2020

Relevant to dtolnay/cxx#290.

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 dtolnay merged commit 1e70b58 into master Dec 18, 2020
@dtolnay dtolnay deleted the repr branch December 18, 2020 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant