Skip to content

Conversation

@ianks
Copy link
Collaborator

@ianks ianks commented Dec 14, 2025

Summary

  • Fix CString lifetime issue in memory tests that could cause undefined behavior when the temporary CString was dropped before rb_str_new_cstr finished reading from it
  • Add Ruby 4.0.0-preview2 support via Nix flake with nixpkgs-ruby for version management
  • Suppress new unpredictable_function_pointer_comparisons Rust lint in generated bindings

Previously, the CString was being created inline and immediately dropped,
causing undefined behavior when rb_str_new_cstr tried to read from the
dangling pointer. Now we keep the CString alive until after the FFI call.
Suppress the new Rust lint warning for function pointer comparisons
in generated bindings.
- Add nixpkgs-ruby input for better Ruby version management
- Configure Ruby 4.0.0-preview2 via .ruby-version file
- Refactor devShell to use explicit pkgs prefix
- Remove bundler (included with Ruby)
- Update flake.lock with new dependencies
Add .envrc for automatic Nix flake loading and .ruby-version
to specify Ruby 4.0.0-preview2.
Add continue-on-error for truffleruby matrix entries due to known
compatibility issues. Remove allow_failure after 2025-01-01.
Update tests to invoke crate::ruby_sysinit (platform-agnostic wrapper for rb_w32_sysinit)
and add a stack marker (using std::ptr::addr_of_mut) passed to crate::ruby_init_stack
before calling ruby_setup. Ensures proper stdio/VM initialization and correct GC stack
scanning, especially on Windows.
Unpin several gems in Gemfile (rake, minitest, rake-compiler,
rake-compiler-dock, racc, base64, standard) to allow flexible versions.
Remove the Ruby-version guard around the standard gem so it's always
included. Add tsort as a dependency.
@ianks ianks changed the title Add Ruby 4.0 support and fix CString lifetime in tests Small improvements for Ruby 4.0 support Dec 14, 2025
The ensure block was inside the each iterator without a begin block,
which is invalid Ruby syntax and causes a parse error with older Ruby
parsers.
- Fix conditional grouping in cargo_test_task so CI/--verbose check
  evaluates correctly when deciding test args.
- Add parentheses around ternary and comparisons to avoid ambiguity.
- Use super(<<~MSG) to pass heredoc safely.
- Simplify string interpolation in mkmf and normalize require_relative paths.
@ianks ianks merged commit e9ccfb5 into main Dec 14, 2025
4 checks passed
@ianks ianks deleted the test-4-0 branch December 14, 2025 05:48
- os: windows-2025
rust_toolchain: stable
include:
# TODO: Remove allow_failure after 2025-01-01 (known compatibility issues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe after 2026-01-01?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants