✨ feat: add Ruby 4.1 version support for ruby-head compatibility #697
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