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

extern fn uses type core::panic::PanicInfo, which is not FFI-safe #84

Closed
cmsd2 opened this issue Nov 7, 2019 · 1 comment · Fixed by #85
Closed

extern fn uses type core::panic::PanicInfo, which is not FFI-safe #84

cmsd2 opened this issue Nov 7, 2019 · 1 comment · Fixed by #85

Comments

@cmsd2
Copy link
Contributor

cmsd2 commented Nov 7, 2019

https://github.com/rust-osdev/bootloader/blob/master/src/main.rs#L368

does the panic handler really need to be extern "C"?

it causes a warning due to PanicInfo not being ffi-safe:

   Compiling bootloader v0.8.2 (/Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bootloader-0.8.2)
warning: `extern` fn uses type `core::panic::PanicInfo`, which is not FFI-safe
   --> src/main.rs:368:31
    |
368 | pub extern "C" fn panic(info: &PanicInfo) -> ! {
    |                               ^^^^^^^^^^ not FFI-safe
    |
    = note: `#[warn(improper_ctypes)]` on by default
    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
    = note: this struct has unspecified layout

    Finished release [optimized + debuginfo] target(s) in 3.16s
@phil-opp
Copy link
Member

Thanks for reporting! I think the extern "C" calling convention is a relict from the time when no panic_handler attribute existed and one had to define a so-called language item manually. It should be safe to remove the extern "C". Would you mind creating a pull request?

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 a pull request may close this issue.

2 participants