You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we have a lint mode which warns about the usage of rust types in extern blocks. This makes sure that by default you don't pass rust types into C functions. What we don't have is a lint going the other way which makes sure that C can't get Rust types from Rust. I believe that we need to expand the FFI lint to crawl extern functions as well as extern blocks.
The exact types which should be allowed is a little questionable. Some things that would be nice to have a defined ABI/FFI for would, but may currently not be working:
~T and &T, are these valid FFI types? The rust type system guarantees they are never null, but there's no guarantee that C handed you something that's not null.
&str - should this be valid to pass in/out? This would require something along the lines of rust.h
To be conservative, we could only allow primitives (minus int and uint) plus *T, but this is quite limiting and makes FFI a little more difficult.
Right now we have a lint mode which warns about the usage of rust types in
externblocks. This makes sure that by default you don't pass rust types into C functions. What we don't have is a lint going the other way which makes sure that C can't get Rust types from Rust. I believe that we need to expand the FFI lint to crawlexternfunctions as well asexternblocks.The exact types which should be allowed is a little questionable. Some things that would be nice to have a defined ABI/FFI for would, but may currently not be working:
Option<&T>andOption<~T>. See Nullable-pointerOptions aren't FFI-compatible with the base pointer types. #11303, but this is currently broken. Do we want to commit to this ABI and say that it's valid to use to interface with C?~Tand&T, are these valid FFI types? The rust type system guarantees they are never null, but there's no guarantee that C handed you something that's not null.&str- should this be valid to pass in/out? This would require something along the lines ofrust.hTo be conservative, we could only allow primitives (minus
intanduint) plus*T, but this is quite limiting and makes FFI a little more difficult.Nominating.