rbs 4.0.0.dev.5 → 4.0.1.dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +1 -0
  3. data/.github/workflows/c-check.yml +8 -4
  4. data/.github/workflows/comments.yml +3 -1
  5. data/.github/workflows/dependabot.yml +1 -1
  6. data/.github/workflows/ruby.yml +10 -0
  7. data/.github/workflows/rust.yml +95 -0
  8. data/CHANGELOG.md +323 -0
  9. data/Rakefile +12 -29
  10. data/Steepfile +1 -0
  11. data/config.yml +393 -37
  12. data/core/array.rbs +218 -188
  13. data/core/basic_object.rbs +9 -8
  14. data/core/class.rbs +6 -5
  15. data/core/comparable.rbs +45 -31
  16. data/core/complex.rbs +52 -40
  17. data/core/dir.rbs +57 -45
  18. data/core/encoding.rbs +5 -5
  19. data/core/enumerable.rbs +96 -91
  20. data/core/enumerator.rbs +4 -3
  21. data/core/errno.rbs +3 -2
  22. data/core/errors.rbs +31 -29
  23. data/core/exception.rbs +12 -12
  24. data/core/fiber.rbs +36 -36
  25. data/core/file.rbs +186 -113
  26. data/core/file_test.rbs +2 -2
  27. data/core/float.rbs +41 -32
  28. data/core/gc.rbs +78 -70
  29. data/core/hash.rbs +70 -60
  30. data/core/integer.rbs +32 -28
  31. data/core/io/buffer.rbs +36 -36
  32. data/core/io/wait.rbs +7 -7
  33. data/core/io.rbs +120 -135
  34. data/core/kernel.rbs +189 -139
  35. data/core/marshal.rbs +3 -3
  36. data/core/match_data.rbs +14 -12
  37. data/core/math.rbs +69 -67
  38. data/core/method.rbs +6 -6
  39. data/core/module.rbs +146 -85
  40. data/core/nil_class.rbs +4 -3
  41. data/core/numeric.rbs +35 -32
  42. data/core/object.rbs +6 -8
  43. data/core/object_space.rbs +11 -10
  44. data/core/pathname.rbs +131 -81
  45. data/core/proc.rbs +65 -33
  46. data/core/process.rbs +219 -201
  47. data/core/ractor.rbs +15 -11
  48. data/core/random.rbs +4 -3
  49. data/core/range.rbs +52 -47
  50. data/core/rational.rbs +5 -5
  51. data/core/rbs/unnamed/argf.rbs +58 -51
  52. data/core/rbs/unnamed/env_class.rbs +18 -13
  53. data/core/rbs/unnamed/main_class.rbs +123 -0
  54. data/core/rbs/unnamed/random.rbs +7 -5
  55. data/core/regexp.rbs +236 -197
  56. data/core/ruby.rbs +1 -1
  57. data/core/ruby_vm.rbs +32 -30
  58. data/core/rubygems/config_file.rbs +5 -5
  59. data/core/rubygems/errors.rbs +1 -1
  60. data/core/rubygems/requirement.rbs +5 -5
  61. data/core/rubygems/rubygems.rbs +5 -3
  62. data/core/set.rbs +17 -16
  63. data/core/signal.rbs +2 -2
  64. data/core/string.rbs +311 -292
  65. data/core/struct.rbs +26 -25
  66. data/core/symbol.rbs +25 -24
  67. data/core/thread.rbs +40 -34
  68. data/core/time.rbs +47 -42
  69. data/core/trace_point.rbs +34 -31
  70. data/core/true_class.rbs +2 -2
  71. data/core/unbound_method.rbs +10 -10
  72. data/core/warning.rbs +7 -7
  73. data/docs/collection.md +1 -1
  74. data/docs/config.md +171 -0
  75. data/docs/inline.md +110 -4
  76. data/docs/syntax.md +13 -12
  77. data/ext/rbs_extension/ast_translation.c +489 -135
  78. data/ext/rbs_extension/class_constants.c +8 -0
  79. data/ext/rbs_extension/class_constants.h +4 -0
  80. data/ext/rbs_extension/legacy_location.c +28 -51
  81. data/ext/rbs_extension/legacy_location.h +37 -0
  82. data/ext/rbs_extension/main.c +12 -20
  83. data/include/rbs/ast.h +423 -195
  84. data/include/rbs/lexer.h +2 -2
  85. data/include/rbs/location.h +25 -44
  86. data/include/rbs/parser.h +2 -2
  87. data/include/rbs/util/rbs_constant_pool.h +0 -3
  88. data/include/rbs.h +8 -0
  89. data/lib/rbs/ast/ruby/annotations.rb +157 -4
  90. data/lib/rbs/ast/ruby/members.rb +374 -22
  91. data/lib/rbs/cli/validate.rb +5 -60
  92. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  93. data/lib/rbs/definition_builder.rb +60 -27
  94. data/lib/rbs/errors.rb +0 -11
  95. data/lib/rbs/inline_parser.rb +1 -1
  96. data/lib/rbs/parser_aux.rb +20 -7
  97. data/lib/rbs/prototype/helpers.rb +57 -0
  98. data/lib/rbs/prototype/rb.rb +1 -26
  99. data/lib/rbs/prototype/rbi.rb +1 -20
  100. data/lib/rbs/test/type_check.rb +3 -0
  101. data/lib/rbs/types.rb +62 -52
  102. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs.rb +0 -1
  105. data/rbs.gemspec +1 -1
  106. data/rust/.gitignore +1 -0
  107. data/rust/Cargo.lock +378 -0
  108. data/rust/Cargo.toml +7 -0
  109. data/rust/ruby-rbs/Cargo.toml +22 -0
  110. data/rust/ruby-rbs/build.rs +764 -0
  111. data/rust/ruby-rbs/examples/locations.rs +60 -0
  112. data/rust/ruby-rbs/src/lib.rs +1 -0
  113. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  114. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  115. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  116. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  117. data/rust/ruby-rbs-sys/build.rs +204 -0
  118. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  119. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  120. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  121. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  122. data/sig/ast/ruby/annotations.rbs +191 -4
  123. data/sig/ast/ruby/members.rbs +21 -1
  124. data/sig/cli/validate.rbs +1 -6
  125. data/sig/definition_builder.rbs +2 -0
  126. data/sig/errors.rbs +0 -8
  127. data/sig/method_types.rbs +1 -1
  128. data/sig/parser.rbs +17 -13
  129. data/sig/prototype/helpers.rbs +2 -0
  130. data/sig/types.rbs +10 -11
  131. data/sig/unit_test/spy.rbs +0 -8
  132. data/sig/unit_test/type_assertions.rbs +11 -0
  133. data/src/ast.c +339 -161
  134. data/src/lexstate.c +1 -1
  135. data/src/location.c +7 -47
  136. data/src/parser.c +674 -480
  137. data/src/util/rbs_constant_pool.c +0 -4
  138. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  139. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  140. data/stdlib/coverage/0/coverage.rbs +4 -3
  141. data/stdlib/date/0/date.rbs +33 -28
  142. data/stdlib/date/0/date_time.rbs +24 -23
  143. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  144. data/stdlib/erb/0/erb.rbs +64 -53
  145. data/stdlib/etc/0/etc.rbs +55 -50
  146. data/stdlib/fileutils/0/fileutils.rbs +138 -125
  147. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  148. data/stdlib/io-console/0/io-console.rbs +2 -2
  149. data/stdlib/json/0/json.rbs +135 -108
  150. data/stdlib/monitor/0/monitor.rbs +3 -3
  151. data/stdlib/net-http/0/net-http.rbs +159 -134
  152. data/stdlib/objspace/0/objspace.rbs +8 -7
  153. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  154. data/stdlib/open3/0/open3.rbs +36 -35
  155. data/stdlib/openssl/0/openssl.rbs +144 -129
  156. data/stdlib/optparse/0/optparse.rbs +18 -14
  157. data/stdlib/pathname/0/pathname.rbs +2 -2
  158. data/stdlib/pp/0/pp.rbs +9 -8
  159. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  160. data/stdlib/pstore/0/pstore.rbs +35 -30
  161. data/stdlib/psych/0/psych.rbs +61 -8
  162. data/stdlib/psych/0/store.rbs +2 -4
  163. data/stdlib/pty/0/pty.rbs +9 -6
  164. data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
  165. data/stdlib/ripper/0/ripper.rbs +20 -17
  166. data/stdlib/securerandom/0/securerandom.rbs +1 -1
  167. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  168. data/stdlib/socket/0/addrinfo.rbs +7 -7
  169. data/stdlib/socket/0/basic_socket.rbs +3 -3
  170. data/stdlib/socket/0/ip_socket.rbs +10 -8
  171. data/stdlib/socket/0/socket.rbs +10 -9
  172. data/stdlib/socket/0/tcp_server.rbs +1 -1
  173. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  174. data/stdlib/socket/0/udp_socket.rbs +1 -1
  175. data/stdlib/socket/0/unix_server.rbs +1 -1
  176. data/stdlib/stringio/0/stringio.rbs +55 -54
  177. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  178. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  179. data/stdlib/time/0/time.rbs +7 -5
  180. data/stdlib/tsort/0/tsort.rbs +7 -6
  181. data/stdlib/uri/0/common.rbs +26 -18
  182. data/stdlib/uri/0/file.rbs +2 -2
  183. data/stdlib/uri/0/generic.rbs +2 -2
  184. data/stdlib/uri/0/http.rbs +2 -2
  185. data/stdlib/uri/0/ldap.rbs +2 -2
  186. data/stdlib/uri/0/mailto.rbs +3 -3
  187. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  188. data/stdlib/zlib/0/deflate.rbs +4 -3
  189. data/stdlib/zlib/0/gzip_reader.rbs +4 -4
  190. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  191. data/stdlib/zlib/0/inflate.rbs +1 -1
  192. data/stdlib/zlib/0/need_dict.rbs +1 -1
  193. metadata +23 -5
  194. data/.github/workflows/valgrind.yml +0 -42
data/core/float.rbs CHANGED
@@ -12,7 +12,7 @@
12
12
  #
13
13
  # Others cannot; among these are the transcendental numbers, including:
14
14
  #
15
- # * Pi, *π*: in mathematics, a number of infinite precision:
15
+ # * Pi, <em>π</em>: in mathematics, a number of infinite precision:
16
16
  # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
17
17
  # precision (in this case, to 16 decimal places):
18
18
  #
@@ -32,8 +32,8 @@
32
32
  # Others do not:
33
33
  #
34
34
  # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
35
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
36
- # this case, to 16 decimal places):
35
+ # decimal: 0.666... (forever); in Ruby, <code>2.0/3</code> is of limited
36
+ # precision (in this case, to 16 decimal places):
37
37
  #
38
38
  # 2.0/3 # => 0.6666666666666666
39
39
  #
@@ -139,7 +139,7 @@
139
139
  #
140
140
  # Others cannot; among these are the transcendental numbers, including:
141
141
  #
142
- # * Pi, *π*: in mathematics, a number of infinite precision:
142
+ # * Pi, <em>π</em>: in mathematics, a number of infinite precision:
143
143
  # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
144
144
  # precision (in this case, to 16 decimal places):
145
145
  #
@@ -159,8 +159,8 @@
159
159
  # Others do not:
160
160
  #
161
161
  # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
162
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
163
- # this case, to 16 decimal places):
162
+ # decimal: 0.666... (forever); in Ruby, <code>2.0/3</code> is of limited
163
+ # precision (in this case, to 16 decimal places):
164
164
  #
165
165
  # 2.0/3 # => 0.6666666666666666
166
166
  #
@@ -390,7 +390,8 @@ class Float < Numeric
390
390
  # 2.0 < Rational(3, 1) # => true
391
391
  # 2.0 < 2.0 # => false
392
392
  #
393
- # `Float::NAN < Float::NAN` returns an implementation-dependent value.
393
+ # <code>Float::NAN < Float::NAN</code> returns an implementation-dependent
394
+ # value.
394
395
  #
395
396
  def <: (Numeric) -> bool
396
397
 
@@ -407,7 +408,8 @@ class Float < Numeric
407
408
  # 2.0 <= 2.0 # => true
408
409
  # 2.0 <= 1.0 # => false
409
410
  #
410
- # `Float::NAN <= Float::NAN` returns an implementation-dependent value.
411
+ # <code>Float::NAN <= Float::NAN</code> returns an implementation-dependent
412
+ # value.
411
413
  #
412
414
  def <=: (Numeric) -> bool
413
415
 
@@ -419,7 +421,7 @@ class Float < Numeric
419
421
  #
420
422
  # Returns:
421
423
  #
422
- # * `-1`, if `self` is less than `other`.
424
+ # * <code>-1</code>, if `self` is less than `other`.
423
425
  # * `0`, if `self` is equal to `other`.
424
426
  # * `1`, if `self` is greater than `other`.
425
427
  # * `nil`, if the two values are incommensurate.
@@ -434,7 +436,8 @@ class Float < Numeric
434
436
  # 2.0 <=> 1.9 # => 1
435
437
  # 2.0 <=> 'foo' # => nil
436
438
  #
437
- # `Float::NAN <=> Float::NAN` returns an implementation-dependent value.
439
+ # <code>Float::NAN <=> Float::NAN</code> returns an implementation-dependent
440
+ # value.
438
441
  #
439
442
  # Class Float includes module Comparable, each of whose methods uses Float#<=>
440
443
  # for comparison.
@@ -452,7 +455,8 @@ class Float < Numeric
452
455
  # 2.0 == Rational(2, 1) # => true
453
456
  # 2.0 == Complex(2, 0) # => true
454
457
  #
455
- # `Float::NAN == Float::NAN` returns an implementation-dependent value.
458
+ # <code>Float::NAN == Float::NAN</code> returns an implementation-dependent
459
+ # value.
456
460
  #
457
461
  # Related: Float#eql? (requires `other` to be a Float).
458
462
  #
@@ -466,7 +470,8 @@ class Float < Numeric
466
470
  # 2.0 == Rational(2, 1) # => true
467
471
  # 2.0 == Complex(2, 0) # => true
468
472
  #
469
- # `Float::NAN == Float::NAN` returns an implementation-dependent value.
473
+ # <code>Float::NAN == Float::NAN</code> returns an implementation-dependent
474
+ # value.
470
475
  #
471
476
  # Related: Float#eql? (requires `other` to be a Float).
472
477
  #
@@ -483,7 +488,8 @@ class Float < Numeric
483
488
  # 2.0 > Rational(1, 2) # => true
484
489
  # 2.0 > 2.0 # => false
485
490
  #
486
- # `Float::NAN > Float::NAN` returns an implementation-dependent value.
491
+ # <code>Float::NAN > Float::NAN</code> returns an implementation-dependent
492
+ # value.
487
493
  #
488
494
  def >: (Numeric) -> bool
489
495
 
@@ -499,7 +505,8 @@ class Float < Numeric
499
505
  # 2.0 >= 2.0 # => true
500
506
  # 2.0 >= 2.1 # => false
501
507
  #
502
- # `Float::NAN >= Float::NAN` returns an implementation-dependent value.
508
+ # <code>Float::NAN >= Float::NAN</code> returns an implementation-dependent
509
+ # value.
503
510
  #
504
511
  def >=: (Numeric) -> bool
505
512
 
@@ -554,7 +561,7 @@ class Float < Numeric
554
561
  #
555
562
  # When `ndigits` is non-positive,
556
563
  # returns an Integer based on a computed granularity:
557
- # * The granularity is `10 ** ndigits.abs`.
564
+ # * The granularity is <code>10 ** ndigits.abs</code>.
558
565
  # * The returned value is the largest multiple of the granularity
559
566
  # that is less than or equal to `self`.
560
567
  # Examples with positive `self`:
@@ -620,7 +627,7 @@ class Float < Numeric
620
627
  # rdoc-file=numeric.c
621
628
  # - divmod(other) -> array
622
629
  # -->
623
- # Returns a 2-element array `[q, r]`, where
630
+ # Returns a 2-element array <code>[q, r]</code>, where
624
631
  #
625
632
  # q = (self/other).floor # Quotient
626
633
  # r = self % other # Remainder
@@ -656,7 +663,8 @@ class Float < Numeric
656
663
  # 2.0.eql?(Rational(2, 1)) # => false
657
664
  # 2.0.eql?(Complex(2, 0)) # => false
658
665
  #
659
- # `Float::NAN.eql?(Float::NAN)` returns an implementation-dependent value.
666
+ # <code>Float::NAN.eql?(Float::NAN)</code> returns an implementation-dependent
667
+ # value.
660
668
  #
661
669
  # Related: Float#== (performs type conversions).
662
670
  #
@@ -678,8 +686,8 @@ class Float < Numeric
678
686
  # rdoc-file=numeric.c
679
687
  # - finite? -> true or false
680
688
  # -->
681
- # Returns `true` if `self` is not `Infinity`, `-Infinity`, or `NaN`, `false`
682
- # otherwise:
689
+ # Returns `true` if `self` is not `Infinity`, <code>-Infinity</code>, or `NaN`,
690
+ # `false` otherwise:
683
691
  #
684
692
  # f = 2.0 # => 2.0
685
693
  # f.finite? # => true
@@ -724,7 +732,7 @@ class Float < Numeric
724
732
  #
725
733
  # When `self` is non-zero and `ndigits` is non-positive,
726
734
  # returns an integer value based on a computed granularity:
727
- # * The granularity is `10 ** ndigits.abs`.
735
+ # * The granularity is <code>10 ** ndigits.abs</code>.
728
736
  # * The returned value is the largest multiple of the granularity
729
737
  # that is less than or equal to `self`.
730
738
  # Examples with positive `self`:
@@ -772,7 +780,7 @@ class Float < Numeric
772
780
  # Returns:
773
781
  #
774
782
  # * 1, if `self` is `Infinity`.
775
- # * -1 if `self` is `-Infinity`.
783
+ # * -1 if `self` is <code>-Infinity</code>.
776
784
  # * `nil`, otherwise.
777
785
  #
778
786
  # Examples:
@@ -870,7 +878,7 @@ class Float < Numeric
870
878
  # Returns the next-larger representable Float.
871
879
  #
872
880
  # These examples show the internally stored values (64-bit hexadecimal) for each
873
- # Float `f` and for the corresponding `f.next_float`:
881
+ # Float `f` and for the corresponding <code>f.next_float</code>:
874
882
  #
875
883
  # f = 0.0 # 0x0000000000000000
876
884
  # f.next_float # 0x0000000000000001
@@ -944,7 +952,7 @@ class Float < Numeric
944
952
  # Returns the next-smaller representable Float.
945
953
  #
946
954
  # These examples show the internally stored values (64-bit hexadecimal) for each
947
- # Float `f` and for the corresponding `f.pev_float`:
955
+ # Float `f` and for the corresponding <code>f.pev_float</code>:
948
956
  #
949
957
  # f = 5e-324 # 0x0000000000000001
950
958
  # f.prev_float # 0x0000000000000000
@@ -1025,8 +1033,8 @@ class Float < Numeric
1025
1033
  # f.round(1) # => -12345.7
1026
1034
  # f.round(3) # => -12345.679
1027
1035
  #
1028
- # When `ndigits` is negative, returns an integer with at least `ndigits.abs`
1029
- # trailing zeros:
1036
+ # When `ndigits` is negative, returns an integer with at least
1037
+ # <code>ndigits.abs</code> trailing zeros:
1030
1038
  #
1031
1039
  # f = 12345.6789
1032
1040
  # f.round(0) # => 12346
@@ -1038,19 +1046,20 @@ class Float < Numeric
1038
1046
  # If keyword argument `half` is given, and `self` is equidistant from the two
1039
1047
  # candidate values, the rounding is according to the given `half` value:
1040
1048
  #
1041
- # * `:up` or `nil`: round away from zero:
1049
+ # * <code>:up</code> or `nil`: round away from zero:
1042
1050
  #
1043
1051
  # 2.5.round(half: :up) # => 3
1044
1052
  # 3.5.round(half: :up) # => 4
1045
1053
  # (-2.5).round(half: :up) # => -3
1046
1054
  #
1047
- # * `:down`: round toward zero:
1055
+ # * <code>:down</code>: round toward zero:
1048
1056
  #
1049
1057
  # 2.5.round(half: :down) # => 2
1050
1058
  # 3.5.round(half: :down) # => 3
1051
1059
  # (-2.5).round(half: :down) # => -2
1052
1060
  #
1053
- # * `:even`: round toward the candidate whose last nonzero digit is even:
1061
+ # * <code>:even</code>: round toward the candidate whose last nonzero digit is
1062
+ # even:
1054
1063
  #
1055
1064
  # 2.5.round(half: :even) # => 2
1056
1065
  # 3.5.round(half: :even) # => 4
@@ -1163,8 +1172,8 @@ class Float < Numeric
1163
1172
  # f.truncate(1) # => -12345.6
1164
1173
  # f.truncate(3) # => -12345.678
1165
1174
  #
1166
- # When `ndigits` is negative, returns an integer with at least `ndigits.abs`
1167
- # trailing zeros:
1175
+ # When `ndigits` is negative, returns an integer with at least
1176
+ # <code>ndigits.abs</code> trailing zeros:
1168
1177
  #
1169
1178
  # f = 12345.6789
1170
1179
  # f.truncate(0) # => 12345
@@ -1250,8 +1259,8 @@ Float::MAX_EXP: Integer
1250
1259
  # Usually defaults to 2.2250738585072014e-308.
1251
1260
  #
1252
1261
  # If the platform supports denormalized numbers, there are numbers between zero
1253
- # and Float::MIN. `0.0.next_float` returns the smallest positive floating point
1254
- # number including denormalized numbers.
1262
+ # and Float::MIN. <code>0.0.next_float</code> returns the smallest positive
1263
+ # floating point number including denormalized numbers.
1255
1264
  #
1256
1265
  Float::MIN: Float
1257
1266
 
data/core/gc.rbs CHANGED
@@ -182,21 +182,21 @@ module GC
182
182
  # GC.config(foo: 'bar')
183
183
  # # => {rgengc_allow_full_mark: false, implementation: "default"}
184
184
  #
185
- # **All-Implementations Configuration**
185
+ # <strong>All-Implementations Configuration</strong>
186
186
  #
187
187
  # The single read-only entry for all implementations is:
188
188
  #
189
- # * `:implementation`: the string name of the implementation; for the Ruby
190
- # default implementation, `'default'`.
189
+ # * <code>:implementation</code>: the string name of the implementation; for
190
+ # the Ruby default implementation, <code>'default'</code>.
191
191
  #
192
- # **Implementation-Specific Configuration**
192
+ # <strong>Implementation-Specific Configuration</strong>
193
193
  #
194
194
  # A GC implementation maintains its own implementation-specific configuration.
195
195
  #
196
196
  # For Ruby's default implementation the single entry is:
197
197
  #
198
- # * `:rgengc_allow_full_mark`: Controls whether the GC is allowed to run a
199
- # full mark (young & old objects):
198
+ # * <code>:rgengc_allow_full_mark</code>: Controls whether the GC is allowed
199
+ # to run a full mark (young & old objects):
200
200
  #
201
201
  # * `true` (default): GC interleaves major and minor collections. A flag
202
202
  # is set to notify GC that a full mark has been requested. This flag is
@@ -348,59 +348,66 @@ module GC
348
348
  #
349
349
  # The hash includes entries such as:
350
350
  #
351
- # * `:count`: The total number of garbage collections run since application
352
- # start (count includes both minor and major garbage collections).
353
- # * `:time`: The total time spent in garbage collections (in milliseconds).
354
- # * `:heap_allocated_pages`: The total number of allocated pages.
355
- # * `:heap_empty_pages`: The number of pages with no live objects, and that
356
- # could be released to the system.
357
- # * `:heap_sorted_length`: The number of pages that can fit into the buffer
358
- # that holds references to all pages.
359
- # * `:heap_allocatable_pages`: The total number of pages the application could
360
- # allocate without additional GC.
361
- # * `:heap_available_slots`: The total number of slots in all
362
- # `:heap_allocated_pages`.
363
- # * `:heap_live_slots`: The total number of slots which contain live objects.
364
- # * `:heap_free_slots`: The total number of slots which do not contain live
365
- # objects.
366
- # * `:heap_final_slots`: The total number of slots with pending finalizers to
367
- # be run.
368
- # * `:heap_marked_slots`: The total number of objects marked in the last GC.
369
- # * `:heap_eden_pages`: The total number of pages which contain at least one
370
- # live slot.
371
- # * `:total_allocated_pages`: The cumulative number of pages allocated since
372
- # application start.
373
- # * `:total_freed_pages`: The cumulative number of pages freed since
374
- # application start.
375
- # * `:total_allocated_objects`: The cumulative number of objects allocated
351
+ # * <code>:count</code>: The total number of garbage collections run since
352
+ # application start (count includes both minor and major garbage
353
+ # collections).
354
+ # * <code>:time</code>: The total time spent in garbage collections (in
355
+ # milliseconds).
356
+ # * <code>:heap_allocated_pages</code>: The total number of allocated pages.
357
+ # * <code>:heap_empty_pages</code>: The number of pages with no live objects,
358
+ # and that could be released to the system.
359
+ # * <code>:heap_sorted_length</code>: The number of pages that can fit into
360
+ # the buffer that holds references to all pages.
361
+ # * <code>:heap_allocatable_pages</code>: The total number of pages the
362
+ # application could allocate without additional GC.
363
+ # * <code>:heap_available_slots</code>: The total number of slots in all
364
+ # <code>:heap_allocated_pages</code>.
365
+ # * <code>:heap_live_slots</code>: The total number of slots which contain
366
+ # live objects.
367
+ # * <code>:heap_free_slots</code>: The total number of slots which do not
368
+ # contain live objects.
369
+ # * <code>:heap_final_slots</code>: The total number of slots with pending
370
+ # finalizers to be run.
371
+ # * <code>:heap_marked_slots</code>: The total number of objects marked in the
372
+ # last GC.
373
+ # * <code>:heap_eden_pages</code>: The total number of pages which contain at
374
+ # least one live slot.
375
+ # * <code>:total_allocated_pages</code>: The cumulative number of pages
376
+ # allocated since application start.
377
+ # * <code>:total_freed_pages</code>: The cumulative number of pages freed
376
378
  # since application start.
377
- # * `:total_freed_objects`: The cumulative number of objects freed since
378
- # application start.
379
- # * `:malloc_increase_bytes`: Amount of memory allocated on the heap for
380
- # objects. Decreased by any GC.
381
- # * `:malloc_increase_bytes_limit`: When `:malloc_increase_bytes` crosses this
382
- # limit, GC is triggered.
383
- # * `:minor_gc_count`: The total number of minor garbage collections run since
384
- # process start.
385
- # * `:major_gc_count`: The total number of major garbage collections run since
379
+ # * <code>:total_allocated_objects</code>: The cumulative number of objects
380
+ # allocated since application start.
381
+ # * <code>:total_freed_objects</code>: The cumulative number of objects freed
382
+ # since application start.
383
+ # * <code>:malloc_increase_bytes</code>: Amount of memory allocated on the
384
+ # heap for objects. Decreased by any GC.
385
+ # * <code>:malloc_increase_bytes_limit</code>: When
386
+ # <code>:malloc_increase_bytes</code> crosses this limit, GC is triggered.
387
+ # * <code>:minor_gc_count</code>: The total number of minor garbage
388
+ # collections run since process start.
389
+ # * <code>:major_gc_count</code>: The total number of major garbage
390
+ # collections run since process start.
391
+ # * <code>:compact_count</code>: The total number of compactions run since
386
392
  # process start.
387
- # * `:compact_count`: The total number of compactions run since process start.
388
- # * `:read_barrier_faults`: The total number of times the read barrier was
389
- # triggered during compaction.
390
- # * `:total_moved_objects`: The total number of objects compaction has moved.
391
- # * `:remembered_wb_unprotected_objects`: The total number of objects without
392
- # write barriers.
393
- # * `:remembered_wb_unprotected_objects_limit`: When
394
- # `:remembered_wb_unprotected_objects` crosses this limit, major GC is
395
- # triggered.
396
- # * `:old_objects`: Number of live, old objects which have survived at least 3
397
- # garbage collections.
398
- # * `:old_objects_limit`: When `:old_objects` crosses this limit, major GC is
393
+ # * <code>:read_barrier_faults</code>: The total number of times the read
394
+ # barrier was triggered during compaction.
395
+ # * <code>:total_moved_objects</code>: The total number of objects compaction
396
+ # has moved.
397
+ # * <code>:remembered_wb_unprotected_objects</code>: The total number of
398
+ # objects without write barriers.
399
+ # * <code>:remembered_wb_unprotected_objects_limit</code>: When
400
+ # <code>:remembered_wb_unprotected_objects</code> crosses this limit, major
401
+ # GC is triggered.
402
+ # * <code>:old_objects</code>: Number of live, old objects which have survived
403
+ # at least 3 garbage collections.
404
+ # * <code>:old_objects_limit</code>: When <code>:old_objects</code> crosses
405
+ # this limit, major GC is triggered.
406
+ # * <code>:oldmalloc_increase_bytes</code>: Amount of memory allocated on the
407
+ # heap for objects. Decreased by major GC.
408
+ # * <code>:oldmalloc_increase_bytes_limit</code>: When
409
+ # <code>:oldmalloc_increase_bytes</code> crosses this limit, major GC is
399
410
  # triggered.
400
- # * `:oldmalloc_increase_bytes`: Amount of memory allocated on the heap for
401
- # objects. Decreased by major GC.
402
- # * `:oldmalloc_increase_bytes_limit`: When `:oldmalloc_increase_bytes`
403
- # crosses this limit, major GC is triggered.
404
411
  #
405
412
  def self.stat: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
406
413
  | (Symbol key) -> Integer
@@ -575,21 +582,22 @@ module GC
575
582
  #
576
583
  # The statistics for a heap may include:
577
584
  #
578
- # * `:slot_size`: The slot size of the heap in bytes.
579
- # * `:heap_allocatable_pages`: The number of pages that can be allocated
580
- # without triggering a new garbage collection cycle.
581
- # * `:heap_eden_pages`: The number of pages in the eden heap.
582
- # * `:heap_eden_slots`: The total number of slots in all of the pages in the
583
- # eden heap.
584
- # * `:total_allocated_pages`: The total number of pages that have been
585
- # allocated in the heap.
586
- # * `:total_freed_pages`: The total number of pages that have been freed and
587
- # released back to the system in the heap.
588
- # * `:force_major_gc_count`: The number of times this heap has forced major
589
- # garbage collection cycles to start due to running out of free slots.
590
- # * `:force_incremental_marking_finish_count`: The number of times this heap
591
- # has forced incremental marking to complete due to running out of pooled
585
+ # * <code>:slot_size</code>: The slot size of the heap in bytes.
586
+ # * <code>:heap_allocatable_pages</code>: The number of pages that can be
587
+ # allocated without triggering a new garbage collection cycle.
588
+ # * <code>:heap_eden_pages</code>: The number of pages in the eden heap.
589
+ # * <code>:heap_eden_slots</code>: The total number of slots in all of the
590
+ # pages in the eden heap.
591
+ # * <code>:total_allocated_pages</code>: The total number of pages that have
592
+ # been allocated in the heap.
593
+ # * <code>:total_freed_pages</code>: The total number of pages that have been
594
+ # freed and released back to the system in the heap.
595
+ # * <code>:force_major_gc_count</code>: The number of times this heap has
596
+ # forced major garbage collection cycles to start due to running out of free
592
597
  # slots.
598
+ # * <code>:force_incremental_marking_finish_count</code>: The number of times
599
+ # this heap has forced incremental marking to complete due to running out of
600
+ # pooled slots.
593
601
  #
594
602
  def self.stat_heap: (?Integer? heap_name, ?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
595
603
  | (Integer heap_name, Symbol key) -> Integer