✨ feat: add Ruby 4.1 version support for ruby-head compatibility#697
Merged
ianks merged 1 commit intooxidize-rb:mainfrom Jan 5, 2026
Merged
✨ feat: add Ruby 4.1 version support for ruby-head compatibility#697ianks merged 1 commit intooxidize-rb:mainfrom
ianks merged 1 commit intooxidize-rb:mainfrom
Conversation
Ruby 4.1 (ruby-head) introduces breaking C API changes that require conditional compilation in dependent crates. This adds 4.1 to the supported version arrays to enable ruby_lt_4_1, ruby_gte_4_1, and related cfg flags. Changes: - Add Version::new(4, 1) to SUPPORTED_RUBY_VERSIONS in rb-sys - Add (4, 0) and (4, 1) to COMPARABLE_RUBY_MINORS in rb-sys-env This enables crates like magnus to handle the rb_data_type_struct change where 'reserved' was replaced with 'handle_weak_references'. Closes oxidize-rb#696
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Ruby 4.1 version support to enable compatibility with ruby-head, which introduces breaking changes in the Ruby C API (specifically the replacement of the reserved field with handle_weak_references in rb_data_type_struct__bindgen_ty_1). The changes also fix a previously missing (4, 0) entry in the comparable minors array.
- Added Ruby 4.1 to supported version arrays in two key modules
- Fixed missing Ruby 4.0 entry in COMPARABLE_RUBY_MINORS array (synchronization fix)
- Enables version-based cfg flags for conditional compilation targeting Ruby 4.1
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/rb-sys/build/main.rs |
Added Version::new(4, 1) to SUPPORTED_RUBY_VERSIONS array and updated array size from 11 to 12 |
crates/rb-sys-env/src/ruby_version.rs |
Added (4, 0) and (4, 1) to COMPARABLE_RUBY_MINORS array and updated array size from 11 to 13, fixing previous missing (4, 0) entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ianks
approved these changes
Jan 5, 2026
This was referenced Jan 5, 2026
Closed
pboling
added a commit
to pboling/tree_stump
that referenced
this pull request
Jan 6, 2026
- Ruby 4.0, 4.1 compat - oxidize-rb/rb-sys#697
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds Ruby 4.1 to the supported version arrays, enabling version-based cfg flags for Ruby head compatibility.
Changes
crates/rb-sys/build/main.rsVersion::new(4, 1)toSUPPORTED_RUBY_VERSIONSarraycrates/rb-sys-env/src/ruby_version.rs(4, 0)and(4, 1)toCOMPARABLE_RUBY_MINORSarrayNew cfg flags available
After this change, the following cfg flags will be available when building with Ruby 4.1:
ruby_lt_4_1/ruby_lte_4_1/ruby_eq_4_1/ruby_gte_4_1/ruby_gt_4_1ruby_4_1/ruby_4_1_0(etc.)Motivation
Ruby 4.1 (ruby-head) introduces breaking changes in the Ruby C API that require conditional compilation in dependent crates. Specifically,
rb_data_type_struct__bindgen_ty_1replaced thereservedfield withhandle_weak_references.This change enables crates like
magnusto properly support both Ruby < 4.1 and Ruby >= 4.1.Testing
Closes #696