From 365865067d78f84795518157c031a6fc6b76ed05 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 15 Jul 2026 09:28:29 +0200 Subject: [PATCH 1/8] Move rb_obj_using_gen_fields_table_p into gc.c Break dependency of `shape.h` on `internal/struct.h` --- gc.c | 18 ++++++++++++++++++ shape.h | 19 ------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/gc.c b/gc.c index 4930ba63521911..4a39a7a65f0708 100644 --- a/gc.c +++ b/gc.c @@ -3156,6 +3156,24 @@ gc_mark_classext_iclass(rb_classext_t *ext, bool prime, VALUE box_value, void *a #define TYPED_DATA_REFS_OFFSET_LIST(d) (size_t *)(uintptr_t)RTYPEDDATA_TYPE(d)->function.dmark +static inline bool +rb_obj_using_gen_fields_table_p(VALUE obj) +{ + switch (BUILTIN_TYPE(obj)) { + case T_DATA: + return false; + + case T_STRUCT: + if (!FL_TEST_RAW(obj, RSTRUCT_GEN_FIELDS)) return false; + break; + + default: + break; + } + + return rb_obj_gen_fields_p(obj); +} + void rb_gc_move_obj_during_marking(VALUE from, VALUE to) { diff --git a/shape.h b/shape.h index f885bab74f6d85..567d488255e4b6 100644 --- a/shape.h +++ b/shape.h @@ -2,7 +2,6 @@ #define RUBY_SHAPE_H #include "internal/gc.h" -#include "internal/struct.h" typedef uint8_t attr_index_t; typedef uint32_t shape_id_t; @@ -479,24 +478,6 @@ rb_obj_gen_fields_p(VALUE obj) return rb_obj_shape_has_fields(obj); } -static inline bool -rb_obj_using_gen_fields_table_p(VALUE obj) -{ - switch (BUILTIN_TYPE(obj)) { - case T_DATA: - return false; - - case T_STRUCT: - if (!FL_TEST_RAW(obj, RSTRUCT_GEN_FIELDS)) return false; - break; - - default: - break; - } - - return rb_obj_gen_fields_p(obj); -} - static inline shape_id_t rb_shape_transition_layout(shape_id_t shape_id, shape_id_t layout) { From a885c897f3258a708021a714f585ae9c213a356c Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 15 Jul 2026 15:36:18 +0900 Subject: [PATCH 2/8] Disable SimpleCov in bundled gem tests net-imap's released test helper still calls the pre-1.0.0 `SimpleCov.formatters=` API, which raises NoMethodError with simplecov 1.0.0. Bundled gem coverage is not collected in CI, so opt out via SIMPLECOV_DISABLE and drop simplecov from the test gem installation. Co-Authored-By: Claude Fable 5 --- common.mk | 2 +- tool/test-bundled-gems.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common.mk b/common.mk index 20e6a7d98f9916..f3c279aeccf7f3 100644 --- a/common.mk +++ b/common.mk @@ -1609,7 +1609,7 @@ no-install-for-test-bundled-gems: no-update-default-gemspecs yes-install-for-test-bundled-gems: yes-update-default-gemspecs $(XRUBY) -C "$(srcdir)" -r./tool/lib/gem_env.rb bin/gem \ install --no-document --conservative \ - "hoe" "json-schema:5.1.0" "test-unit-rr" "simplecov" "rspec" "zeitwerk" \ + "hoe" "json-schema:5.1.0" "test-unit-rr" "rspec" "zeitwerk" \ "sinatra" "rack" "tilt" "mustermann" "base64" "compact_index" "rack-test" "logger" "kpeg" "tracer" "minitest-mock" test-bundled-gems-fetch: yes-test-bundled-gems-fetch diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 706f665b95de51..618ce4b909aa0f 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -9,6 +9,11 @@ ENV.delete("GNUMAKEFLAGS") +# net-imap's test helper enables SimpleCov, but its released versions still +# call the pre-1.0.0 `SimpleCov.formatters=` API that breaks with simplecov +# 1.0.0. Coverage of bundled gems is not collected in CI, so disable it. +ENV["SIMPLECOV_DISABLE"] = "1" + github_actions = ENV["GITHUB_ACTIONS"] == "true" DEFAULT_ALLOWED_FAILURES = RUBY_PLATFORM =~ /mswin|mingw/ ? [ From 5e00f17ae75d71a62ba428d7d472e6f50c0753c2 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 15 Jul 2026 15:36:33 +0900 Subject: [PATCH 3/8] Drop net-imap test revision pin The pin at 20d4f2c3 was added to run net-imap tests against a SimpleCov 1.0.0 compatible helper. With coverage disabled for bundled gem tests, the released gem can be used directly. Co-Authored-By: Claude Fable 5 --- gems/bundled_gems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/bundled_gems b/gems/bundled_gems index 3efa41dc454ea6..d9a6273a043d9b 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -12,7 +12,7 @@ rake 13.4.2 https://github.com/ruby/rake test-unit 3.7.8 https://github.com/test-unit/test-unit rexml 3.4.4 https://github.com/ruby/rexml rss 0.3.3 https://github.com/ruby/rss -net-imap 0.6.4.1 https://github.com/ruby/net-imap 20d4f2c39dcc12307a6b30b497565770e89b66e3 +net-imap 0.6.4.1 https://github.com/ruby/net-imap net-smtp 0.5.1 https://github.com/ruby/net-smtp matrix 0.4.3 https://github.com/ruby/matrix prime 0.1.4 https://github.com/ruby/prime From 4b6f5f299e81e0ff4e527f7b71fd11442634a93d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 15 Jul 2026 17:32:24 +0900 Subject: [PATCH 4/8] [ruby/date] Avoid NUL-terminated ISO 8601 component checks https://github.com/ruby/date/commit/98c72c840b --- ext/date/date_parse.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index a1600e47085502..37748a1da900d3 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -2325,6 +2325,16 @@ sec_fraction(VALUE f) #define SNUM 14 +#ifndef rb_streql_lit +static inline int +rb_streql_cstr(VALUE str, const char *lit, size_t len) +{ + if ((size_t)RSTRING_LEN(str) != len) return 0; + return memcmp(RSTRING_PTR(str), lit, len) == 0; +} +#define rb_streql_lit(str, lit) rb_streql_cstr(str, lit, sizeof(lit "") - 1) +#endif + static int iso8601_ext_datetime_cb(VALUE m, VALUE hash) { @@ -2339,14 +2349,14 @@ iso8601_ext_datetime_cb(VALUE m, VALUE hash) if (!NIL_P(s[1])) { if (!NIL_P(s[3])) set_hash("mday", str2num(s[3])); - if (strcmp(RSTRING_PTR(s[1]), "-") != 0) { + if (!rb_streql_lit(s[1], "-")) { y = str2num(s[1]); if (RSTRING_LEN(s[1]) < 4) y = comp_year69(y); set_hash("year", y); } if (NIL_P(s[2])) { - if (strcmp(RSTRING_PTR(s[1]), "-") != 0) + if (!rb_streql_lit(s[1], "-")) return 0; } else @@ -2425,14 +2435,14 @@ iso8601_bas_datetime_cb(VALUE m, VALUE hash) if (!NIL_P(s[3])) { set_hash("mday", str2num(s[3])); - if (strcmp(RSTRING_PTR(s[1]), "--") != 0) { + if (!rb_streql_lit(s[1], "--")) { y = str2num(s[1]); if (RSTRING_LEN(s[1]) < 4) y = comp_year69(y); set_hash("year", y); } if (*RSTRING_PTR(s[2]) == '-') { - if (strcmp(RSTRING_PTR(s[1]), "--") != 0) + if (!rb_streql_lit(s[1], "--")) return 0; } else From 902e86c1f56c2174e7ed6a438dc1d726842ffdee Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 15 Jul 2026 19:59:32 +0900 Subject: [PATCH 5/8] [Feature #22097] Update deprecated matchers --- spec/ruby/core/proc/refined_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ruby/core/proc/refined_spec.rb b/spec/ruby/core/proc/refined_spec.rb index 8e232e52b1c3c7..6f854df5bc4580 100644 --- a/spec/ruby/core/proc/refined_spec.rb +++ b/spec/ruby/core/proc/refined_spec.rb @@ -6,8 +6,8 @@ it "returns a new Proc with the refinements of the given module activated inside its body" do pr = -> s { s.shout } refined = pr.refined(ProcRefinedSpecs::StringShout) - refined.should be_an_instance_of(Proc) - refined.should_not equal(pr) + refined.should.instance_of?(Proc) + refined.should_not.equal?(pr) refined.call("hi").should == "HI!" end From 38c714f577a2f4e9b99290685beb109fba7e5b21 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 15 Jul 2026 12:27:21 +0200 Subject: [PATCH 6/8] Fix freeing of complex IMEMO/fields Followup: https://github.com/ruby/ruby/pull/17863 The only fields that need cleanup are complex ones, and the free function had to be updated. --- gc.c | 2 +- imemo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gc.c b/gc.c index 4a39a7a65f0708..ef193dc8efacf3 100644 --- a/gc.c +++ b/gc.c @@ -1380,7 +1380,7 @@ rb_gc_imemo_needs_cleanup_p(VALUE obj) return ((rb_imemo_tmpbuf_t *)obj)->ptr != NULL; case imemo_fields: - return FL_TEST_RAW(obj, OBJ_FIELD_HEAP); + return rb_obj_shape_complex_p(obj); } UNREACHABLE_RETURN(true); } diff --git a/imemo.c b/imemo.c index f416e219ed175b..4818876a3eae0e 100644 --- a/imemo.c +++ b/imemo.c @@ -613,7 +613,7 @@ static inline void imemo_fields_free(struct rb_fields *fields) { if (rb_obj_shape_complex_p((VALUE)fields)) { - st_free_table(&fields->as.complex.table); + st_free_embedded_table(&fields->as.complex.table); } } From ead9055ac4518649b97537d99cea385d02b224f1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 15 Jul 2026 20:27:45 +0900 Subject: [PATCH 7/8] [DOC] Fix NEWS entries for pack and unpack formats --- NEWS.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 943dbcb870dfa1..b39ba4bb674886 100644 --- a/NEWS.md +++ b/NEWS.md @@ -27,10 +27,8 @@ Note: We're only listing outstanding class updates. * Array - * `Array#pack` accepts a new format `R` and `r` for unpacking unsigned - and signed LEB128 encoded integers. [[Feature #21785]] - * `Array#pack` accepts a new format `^` that returns the current offset. - Useful when combined with variable width formats like LEB128. [[Feature #21796]] + * `Array#pack` accepts new formats `R` and `r` for unsigned and signed + LEB128 encoded integers. [[Feature #21785]] * ENV @@ -67,6 +65,14 @@ Note: We're only listing outstanding class updates. * A deprecated behavior, `Set#to_set`, `Range#to_set`, and `Enumerable#to_set` accepting arguments, was removed. [[Feature #21390]] +* String + + * `String#unpack` and `String#unpack1` accept new formats `R` and `r` + for unsigned and signed LEB128 encoded integers. [[Feature #21785]] + * `String#unpack` and `String#unpack1` accept a new format `^` that + returns the current offset. Useful when combined with variable + width formats like LEB128. [[Feature #21796]] + * Symbol * `Symbol#to_s` now returns a frozen string. [[Feature #22137]] From 06d4c1d1a53f560796420f2dc1ba79aadf058221 Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Wed, 15 Jul 2026 21:12:27 +0900 Subject: [PATCH 8/8] Add NEWS entry for Proc#refined --- NEWS.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b39ba4bb674886..26d5157c4aa535 100644 --- a/NEWS.md +++ b/NEWS.md @@ -52,7 +52,14 @@ Note: We're only listing outstanding class updates. * ObjectSpace - * `ObjectSpace._id2ref` was removed. [[Feature #22135]] + * `ObjectSpace._id2ref` was removed. [[Feature #22135]] + +* Proc + + * `Proc#refined` is added. It returns a new Proc that behaves like the + receiver but with the refinements activated by the given modules + ineffect inside its body, without affecting the original Proc. + [[Feature #22097]] * Regexp