From a5aa6fd791f9fd47cb01ccfb362f5e91e8038c58 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 5 Jan 2026 16:22:31 -0500 Subject: [PATCH 1/2] Bump Ruby to 4.0.0; update bindings & locks Update .ruby-version to Ruby 4.0.0. Add bindgen blocklist entries for INET_PORT_RESERVATION_INSTANCE and PINET_PORT_RESERVATION_INSTANCE to avoid generating bindings for those types. Refresh flake.lock with updated nixpkgs, nixpkgs-ruby and rust-overlay revisions/hashes. --- .ruby-version | 2 +- crates/rb-sys-build/src/bindings.rs | 2 ++ flake.lock | 18 +++++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.ruby-version b/.ruby-version index fb3198ba3..2f9dd5fd1 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-4.0.0-preview2 +ruby-4.0.0 diff --git a/crates/rb-sys-build/src/bindings.rs b/crates/rb-sys-build/src/bindings.rs index 4d0dbc012..cdf3ffd6a 100644 --- a/crates/rb-sys-build/src/bindings.rs +++ b/crates/rb-sys-build/src/bindings.rs @@ -167,6 +167,8 @@ fn default_bindgen(clang_args: Vec, rbconfig: &RbConfig) -> bindgen::Bui .blocklist_item("^__pthread_.*") .blocklist_item("^pthread_.*") .blocklist_item("^rb_native.*") + .blocklist_type("INET_PORT_RESERVATION_INSTANCE") + .blocklist_type("PINET_PORT_RESERVATION_INSTANCE") .opaque_type("^__sFILE$") .merge_extern_blocks(true) .generate_comments(true) diff --git a/flake.lock b/flake.lock index c42e6e2d5..db924c545 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1753939845, - "narHash": "sha256-K2ViRJfdVGE8tpJejs8Qpvvejks1+A4GQej/lBk5y7I=", + "lastModified": 1767379071, + "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "94def634a20494ee057c76998843c015909d6311", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", "type": "github" }, "original": { @@ -77,11 +77,11 @@ ] }, "locked": { - "lastModified": 1765587275, - "narHash": "sha256-vmT73WDxHIoVhMIO6KyxkAUsN3YQLZfnpLU/T79NUUw=", + "lastModified": 1766728475, + "narHash": "sha256-9y9WBiQONK9TgD4lu8SW6TpcfEaJTxEs1HjhC4s4vnY=", "owner": "bobvanderlinden", "repo": "nixpkgs-ruby", - "rev": "6ae67be3862a2442cce588bea8e5f7ae88b54870", + "rev": "f167828eab19c3a7e3faa066a140d92e307f7b16", "type": "github" }, "original": { @@ -119,11 +119,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1754016903, - "narHash": "sha256-mRB5OOx7H5kFwW8Qtc/7dO3qHsBQtZ/eYQEj93/Noo8=", + "lastModified": 1767581716, + "narHash": "sha256-FUbiUzdrGkLou37OGfb4vCLPnqdSIvtmJBxjh2iljiE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ddd488184f01603b712ddbb6dc9fe0b8447eb7fc", + "rev": "1d3f83babdd21e16bf5cfe0f1efcb4f49ee1bc2c", "type": "github" }, "original": { From 9024c57dfceb7eb148c2aaa70b64d1112194942a Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 5 Jan 2026 16:32:04 -0500 Subject: [PATCH 2/2] Fix Windows MinGW bindgen issues - Blocklist INET_PORT_RESERVATION_INSTANCE and PINET_PORT_RESERVATION_INSTANCE which have incorrect size detection on Windows MinGW - Disable layout tests and Debug impl for all Windows MinGW builds due to packed struct layout incompatibilities (affects Ruby 2.7+, 3.x, 4.x) --- crates/rb-sys-build/src/bindings.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/crates/rb-sys-build/src/bindings.rs b/crates/rb-sys-build/src/bindings.rs index cdf3ffd6a..7b727338b 100644 --- a/crates/rb-sys-build/src/bindings.rs +++ b/crates/rb-sys-build/src/bindings.rs @@ -141,19 +141,11 @@ fn clean_docs(rbconfig: &RbConfig, syntax: &mut syn::File) { } fn default_bindgen(clang_args: Vec, rbconfig: &RbConfig) -> bindgen::Builder { - // Disable layout tests and Debug impl for Ruby 2.7 and 3.0 on Windows MinGW due to type incompatibilities - let is_old_ruby_windows_mingw = if cfg!(target_os = "windows") && !is_msvc() { - if let Some((major, minor)) = rbconfig.major_minor() { - (major == 2 && minor == 7) || (major == 3 && minor == 0) - } else { - false - } - } else { - false - }; + // Disable layout tests and Debug impl on Windows MinGW due to packed struct layout incompatibilities + let is_windows_mingw = cfg!(target_os = "windows") && !is_msvc(); - let enable_layout_tests = !is_old_ruby_windows_mingw && cfg!(feature = "bindgen-layout-tests"); - let impl_debug = !is_old_ruby_windows_mingw && cfg!(feature = "bindgen-impl-debug"); + let enable_layout_tests = !is_windows_mingw && cfg!(feature = "bindgen-layout-tests"); + let impl_debug = !is_windows_mingw && cfg!(feature = "bindgen-impl-debug"); let mut bindings = bindgen::Builder::default() .rustified_enum(".*")