-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add initial implementation of a stable API #229
Conversation
stable-abi
feature
Alright, so after thinking on what @matsadler said, I've decided to make the compiled C fallback optional (behind a With that all said and done, I think this is close to being good to go. Just testing out a few more things on some gems in prod. |
The windows failures are unrelated, and will be fixed in #221. Going to go ahead and merge this. To be clear, this PR adds an opt-in ❤️ |
As part of #227, this PR implements a the basis for a stable ABI for Ruby on Rust. For companies that run
ruby-head
in production, ABI instability is a serious priority, since without having stability it's hard (if not impossible) to test out certain changes to Ruby.This can be incredibly disruptive to both Ruby core, as well as Rust gem authors. The goal here is to always Just Work™️ with ruby-head, but without sacrificing performance on stable Ruby.
The core idea consists of two main parts.
1) C Macro + Inline Function Support
In Rust, we don't get access to the suite of Ruby C macros or inline functions in libruby. So we have to either:
This PR makes it so rb-sys does both, so we get the best of both worlds. On known stable versions of Ruby, we use the hand-written Rust implementations of the Ruby macros. On
ruby-head
, we use the compiled C glue code.2) Make internal Ruby data structures opaque
This PR also adds a new
stable-abi
feature for rb-sys, which will make the internal layout of various Ruby structs opaque (i.e. RString and RArray). With this feature enabled, it will become impossible for upstream crates to have ABI instability when using the opaque struct.For now, this feature is off by default (with some deprecation warnings) to allow for adoption (with. In v1.0, it will be enabled by default.