oxidize-rb / rb-sys

Easily build Ruby native extensions in Rust
https://oxidize-rb.github.io/rb-sys/
Apache License 2.0
230 stars 35 forks source link

🔊 MEGA ISSUE - ABI stability for `ruby-head` #227

Closed ianks closed 1 year ago

ianks commented 1 year ago

At shopify, we test extensively against ruby-head in order to improve performance and improve Ruby for our apps. Unlike stable Ruby releases, ruby-head is subject to breaking ABI changes on a per-commit basis. This means that extensions that rely on libruby ABI compatibility (i.e. assuming certain struct layouts / fields being available) can break on a moments notice.

These breaking changes are currently very disruptive, because it prevents us from deploying new versions of ruby-head for our apps that use Rust gems (including the core monolith and SFR).

For example, a recent change to the RString struct and subsequent update to magnus made it so extensions would not compile, and thus CI going 🔴 .

To fix this, rb-sys should provide a ABI stability guarantees where it makes sense, so upstream crates like magnus do not have to rely on Ruby internal data structures to do their job (example). We can do this by providing implementations for the common C macros and inline functions libruby provides that are currently inaccessible from Rust.

ianks commented 1 year ago

cc: @matsadler putting this on your radar ❤️