danielpclark / rutie

“The Tie Between Ruby and Rust.”
MIT License
939 stars 62 forks source link

Fixed not FFI-safe warnings #154

Closed ankane closed 2 years ago

ankane commented 2 years ago

Hi, thanks for this project!

This PR fixes not FFI-safe warnings when Rutie structs are used as return types.

You can reproduce the warning by building the Ruby example in this repo.

cd examples/rutie_ruby_example 
cargo build

Output

warning: `extern` fn uses type `rutie::RString`, which is not FFI-safe
  --> src/lib.rs:12:39
   |
12 |     fn pub_reverse(input: RString) -> RString {
   |                                       ^^^^^^^ not FFI-safe
   |
   = note: `#[warn(improper_ctypes_definitions)]` on by default
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout

warning: `rutie_ruby_example` (lib) generated 1 warning
danielpclark commented 2 years ago

Approved! Merged to master!

ankane commented 2 years ago

Thanks @danielpclark!