90540 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
1ba93fdfd2 Update bundled_gems 2025-03-12 11:05:39 +09:00
Peter Zhu
1cdec3240b Fix memory leak in rb_reg_search_set_match
https://github.com/ruby/ruby/pull/12801 changed regexp matches to reuse
the backref, which causes memory to leak if the original registers of the
match is not freed.

For example, the following script leaks memory:

    10.times do
      1_000_000.times do
        "aaaaaaaaaaa".gsub(/a/, "")
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    774256
    1535152
    2297360
    3059280
    3821296
    4583552
    5160304
    5091456
    5114256
    4980192

After:

    12480
    11440
    11696
    11632
    11632
    11760
    11824
    11824
    11824
    11888
2025-03-11 21:55:03 -04:00
Burdette Lamar
1b2cc9c2b8
[DOC] Tweaks for Hash#slice 2025-03-11 21:54:49 -04:00
BurdetteLamar
86eff8565b [DOC] Tweaks for Hash#to_a 2025-03-11 21:54:06 -04:00
BurdetteLamar
5208d2f440 [DOC] Tweaks for Hash#shift 2025-03-11 21:52:38 -04:00
git
19a1370b34 Update bundled gems list at 97231e4d7ece859ab7c7d81033e74d [ci skip] 2025-03-11 23:31:45 +00:00
Hiroshi SHIBATA
97231e4d7e Update bundled_gems 2025-03-12 08:31:16 +09:00
Burdette Lamar
b52f789520
[DOC] Tweaks for Hash#select! (#12904) 2025-03-11 15:19:38 -04:00
Burdette Lamar
a5f29213dc
[DOC] Tweaks for Hash#select (#12903) 2025-03-11 15:18:47 -04:00
Burdette Lamar
51e2ff1ef7
[DOC] Tweaks for Hash#reject! 2025-03-11 15:18:06 -04:00
Nobuyoshi Nakada
3278e3b6f3
[Bug #21177] Win32: Allow longer path name 2025-03-12 00:46:05 +09:00
Peter Zhu
e51411ff1f Fix flaky test_latest_gc_info_need_major_by
The test could flake because a major GC could be triggered due to allocation
for caches or other things, which would cause the test to fail.
2025-03-11 11:44:07 -04:00
Burdette Lamar
497f409ba4
[DOC] Tweaks for Hash#reject (#12876) 2025-03-11 11:43:50 -04:00
Burdette Lamar
e99026784a
[DOC] Tweaks for Hash#update 2025-03-11 11:43:20 -04:00
Peter Zhu
47c3ae6962 Bump tolerance for weak reference test from 1 to 2
The test fails sometimes with:

    TestGc#test_latest_gc_info_weak_references_count [test/ruby/test_gc.rb:421]:
    Expected 2 to be <= 1.
2025-03-10 20:00:47 -04:00
Jean Boussier
ba5fb74583 Fix Socket.tcp_with_fast_fallback to be usable from a Ractor
[Bug #21179]

```
socket.rb:1046:in 'Socket::HostnameResolutionStore#get_addrinfo': can not access non-shareable objects in constant
Socket::HostnameResolutionStore::PRIORITY_ON_V6 by non-main ractor. (Ractor::IsolationError)
	from socket.rb:724:in 'block in Socket.tcp_with_fast_fallback'
	from socket.rb:720:in 'Socket.tcp_with_fast_fallback'
```
2025-03-10 22:57:44 +01:00
git
e418ba0928 Update default gems list at 6b4453e332d67b5fb8f6932244fff9 [ci skip] 2025-03-10 16:58:51 +00:00
Koichi ITO
6b4453e332 [ruby/prism] Support itblock for Prism::Translation::Parser
## Summary

`itblock` node is added to support the `it` block parameter syntax introduced in Ruby 3.4.

```console
$ ruby -Ilib -rprism -rprism/translation/parser34 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { it }"; \
                                                      p Prism::Translation::Parser34.new.tokenize(buffer)[0]'
s(:itblock,
  s(:send, nil, :proc), :it,
  s(:lvar, :it))
```

This node design is similar to the `numblock` node, which was introduced for the numbered parameter syntax in Ruby 2.7.

```
$ ruby -Ilib -rprism -rprism/translation/parser34 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { _1 }"; \
                                                      p Prism::Translation::Parser34.new.tokenize(buffer)[0]'
s(:numblock,
  s(:send, nil, :proc), 1,
  s(:lvar, :_1))
```

The difference is that while numbered parameters can have multiple parameters, the `it` block parameter syntax allows only a single parameter.

In Ruby 3.3, the conventional node prior to the `it` block parameter syntax is returned.

```console
$ ruby -Ilib -rprism -rprism/translation/parser33 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { it }"; \
                                                      p Prism::Translation::Parser33.new.tokenize(buffer)[0]'
s(:block,
  s(:send, nil, :proc),
  s(:args),
  s(:send, nil, :it))
```

## Development Note

The Parser gem does not yet support the `it` block parameter syntax. This is the first case where Prism's node design precedes that of the Parser gem.
When implementing https://github.com/whitequark/parser/issues/962, this node design will need to be taken into consideration.

https://github.com/ruby/prism/commit/c141e1420a
2025-03-10 16:57:46 +00:00
Nobuyoshi Nakada
97c133a859 [ruby/optparse] bump up to 0.7.0.dev.1 [ci skip]
https://github.com/ruby/optparse/commit/f4d64b0b17
2025-03-10 11:06:55 +00:00
Nobuyoshi Nakada
13fa6cc6a3 [ruby/optparse] [DOC] Extract description from README
https://github.com/ruby/optparse/commit/83e8c23d68
2025-03-10 11:01:03 +00:00
Kouhei Yanagita
3cd3f76679 [ruby/optparse] Fix LESS environment variable setup in OptionParser#help_exit
If the original value of LESS ends with an option starting with "--",
simply appending "Fe" would result in an invalid option string.

https://github.com/ruby/optparse/commit/30571f91d3
2025-03-10 10:21:29 +00:00
Koichi ITO
f4c16c57aa [ruby/optparse] Make the result of tty? obtainable with flexible stdout
In mock testing for stdout, `StringIO.new` is sometimes used to redirect the output.
In such cases, the assignment is done with `$stdout = StringIO.new`, not the constant `STDOUT`.
e.g., https://github.com/rubocop/rubocop/blob/v1.71.1/lib/rubocop/rspec/shared_contexts.rb#L154-L164

After assigning `StringIO.new`, `$stdout.tty?` returns `false`,
allowing the standard output destination to be switched during test execution.

```ruby
STDOUT.tty?       # => true
StringIO.new.tty? # => false
```

However, since `STDOUT.tty?` returns `true`, a failure occurred in environments
where the environment variables `RUBY_PAGER` or `PAGER` are set.
e.g., https://github.com/rubocop/rubocop/pull/13784

To address this, `STDOUT` has been updated to `$stdout` so that the result of `tty?` can be flexibly overridden.

A potential concern is that `$stdout`, unlike `STDOUT`,
does not always represent the standard output at the time the Ruby process started.
However, no concrete examples of issues related to this have been identified.

`STDOUT.tty?` is the logic of optparse introduced in https://github.com/ruby/optparse/pull/70.

This PR replaces `STDOUT` with `$stdout` throughout, based on the assumption
that `$stdout` is sufficient for use with optparse.

https://github.com/ruby/optparse/commit/262cf6f9ac
2025-03-10 10:19:58 +00:00
Nobuyoshi Nakada
45e8dc1e85 [ruby/optparse] [DOC] Mention about post-check
https://github.com/ruby/optparse/commit/e1957d7392
2025-03-10 09:55:29 +00:00
Nobuyoshi Nakada
9e265b583b [ruby/optparse] Add post-check of value
Fix https://github.com/ruby/optparse/pull/80

https://github.com/ruby/optparse/commit/050a87d029
2025-03-10 09:55:29 +00:00
Nobuyoshi Nakada
b51450f3bd [ruby/optparse] Update argument check with save navigation operator
https://github.com/ruby/optparse/commit/71e2b31824
2025-03-10 08:03:55 +00:00
Nobuyoshi Nakada
dad0f876a9 [ruby/optparse] Remove extra blank lines [ci skip]
https://github.com/ruby/optparse/commit/d7dec6808f
2025-03-10 08:03:54 +00:00
Nobuyoshi Nakada
9de9cb53c0 [ruby/optparse] [DOC] Update documents to use single quotes instead of backqoutes
https://github.com/ruby/optparse/commit/5e71a70cb5
2025-03-10 07:56:44 +00:00
David Rodríguez
1a985d36a7 [rubygems/rubygems] Adapt specs to extraction of irb from ruby-core
This gets our daily Bundler CI back to green.

https://github.com/rubygems/rubygems/commit/1bb70f75d2
2025-03-10 12:43:36 +09:00
David Rodríguez
0ca5240d58 [rubygems/rubygems] bundle console deprecation was canceled
https://github.com/rubygems/rubygems/commit/1c237a4c3f
2025-03-10 12:43:36 +09:00
David Rodríguez
9d5a3c0314 [rubygems/rubygems] Reduce duplicate of some spec gemfiles
https://github.com/rubygems/rubygems/commit/bd42c840c6
2025-03-10 12:43:36 +09:00
David Rodríguez
e21e5bc814 [rubygems/rubygems] Fix gem rdoc not working with newer versions of rdoc
https://github.com/rubygems/rubygems/commit/369f9b9311
2025-03-10 12:43:36 +09:00
Tara Bass
4323674fe4 [rubygems/rubygems] Don't treat a git-sourced gem install as complete if only the '.git' directory is present. This recovers cases where a git-sourced install can be left in a partially installed state.
https://github.com/rubygems/rubygems/commit/d132b7008d
2025-03-10 12:43:36 +09:00
Sean Collins
71e340881f [rubygems/rubygems] Switch inject to use shorthand hash syntax
https://github.com/rubygems/rubygems/commit/ba5a62fd04
2025-03-10 12:43:36 +09:00
Sean Collins
8acf0d7bcc [rubygems/rubygems] Use shorthand hash syntax for bundle add
https://github.com/rubygems/rubygems/commit/9691097036
2025-03-10 12:43:36 +09:00
Hiroshi SHIBATA
afbc6649cd Revert "Omit irb related examples temporary"
This reverts commit 750e6195040ec3f9d0b172ac1a49a49d9b7d8ba0.
2025-03-10 12:43:36 +09:00
Hiroshi SHIBATA
ce4abf2a2b Revert "Move irb detection to top-level before(:each) block"
This reverts commit 261f8023842b6f90007df68dfc3d88a01a9337a2.
2025-03-10 12:43:36 +09:00
Nobuyoshi Nakada
cdf36d6bfd [ruby/optparse] Allow non-string enum list #79
Command line arguments are strings, convert enum list elements to
strings to match.

https://github.com/ruby/optparse/commit/c5ec052efc
2025-03-09 14:32:17 +00:00
Nobuyoshi Nakada
213c27825a [ruby/optparse] Add test for enum arguments
https://github.com/ruby/optparse/commit/0a0e977b7c
2025-03-09 14:32:17 +00:00
Nobuyoshi Nakada
0c73328aff [ruby/optparse] Use \A instead of ^ as the beginning of string
https://github.com/ruby/optparse/commit/a3f1029815
2025-03-09 14:09:16 +00:00
Nobuyoshi Nakada
49199445f5 [ruby/optparse] [DOC] Manage rdoc options only in .rdoc_options file
Make `rdoc .` and `rake rdoc` consistent.

https://github.com/ruby/optparse/commit/61b4ea0704
2025-03-09 14:03:55 +00:00
Nobuyoshi Nakada
f6c146abca
Remove a stale test file [ci skip] 2025-03-09 12:16:17 +09:00
ydah
5965978efb Merge the new_yield method into the rb_node_yield_new method 2025-03-09 11:26:56 +09:00
ydah
caa7eaecc5 Refactor parser rules to remove inline_operation 2025-03-09 02:56:26 +09:00
ydah
24945defa5 Remove redundant semantic action in bvar rule 2025-03-08 22:20:11 +09:00
Jean Boussier
a14d9b8d57 string.c: Improve fstring_hash to reduce collisions
`rb_str_hash` doesn't include the encoding for ASCII only strings
because ASCII only strings are equal regardless of their encoding.

But in the case if the `fstring_table`, two identical ASCII strings
with different encodings aren't equal.

Given it's common to have both `:foo` (or `def foo`) and `"foo"`
in the same source code, this causes a lot of collisions in the
`fstring_table`.
2025-03-08 10:56:02 +01:00
ydah
eae0fe37c0 Implement CLASS NODE locations
The following Location information has been added This is the information required for parse.y to be a universal parser:

```
❯ ruby --parser=prism --dump=parsetree -e "class A < B; end"
@ ProgramNode (location: (1,0)-(1,16))
+-- locals: []
+-- statements:
    @ StatementsNode (location: (1,0)-(1,16))
    +-- body: (length: 1)
        +-- @ ClassNode (location: (1,0)-(1,16))
            +-- locals: []
            +-- class_keyword_loc: (1,0)-(1,5) = "class"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            +-- constant_path:
            |   @ ConstantReadNode (location: (1,6)-(1,7))
            |   +-- name: :A
            +-- inheritance_operator_loc: (1,8)-(1,9) = "<"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            +-- superclass:
            |   @ ConstantReadNode (location: (1,10)-(1,11))
            |   +-- name: :B
            +-- body: nil
            +-- end_keyword_loc: (1,13)-(1,16) = "end"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            +-- name: :A
```
2025-03-08 18:26:40 +09:00
Alan Wu
98790faae3 YJIT: Add Counter::invalidate_everything
When YJIT is forced to discard all the code, that's bad for
performance, so there should be an easy way to know about it.
2025-03-07 20:23:32 -05:00
kyontan
3c92fe13f8
[DOC] Fix minor miscalculation of stack size 2025-03-07 16:18:25 -05:00
Burdette Lamar
17f6a68962
[DOC] Tweaks for Hash#rehash 2025-03-07 09:38:51 -05:00
BurdetteLamar
8774530ce1 [DOC] Tweaks for Hash#rassoc 2025-03-07 09:36:51 -05:00