This overrides Enumerable#to_h, but doesn't handle a block, breaking
backwards compatibility.
Set#to_h was added in the marshalling support commit, but isn't
necessary for that, as the underlying function is called. Remove
the method definition to restore backwards compatibility.
In Ruby < 3.0, the superclass of StringIO was actually already `Data`,
but it doesn't have the expected shape. So, on these earlier versions it errors:
> NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880>
> vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data'
This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version.
https://github.com/ruby/psych/commit/0f40f56268
Fix Visual C warnings:
```
iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
```
When the test is repeated 20 or more times in the same process
it's not that unlikely for `rand(100_000)` to return the same thing
twice, causing `TestObjectIdTooComplexClass` to fail.
```
1) Failure:
TestObjectIdTooComplexClass#test_dup_with_id_and_ivar [/tmp/ruby/src/trunk-repeat20-asserts/test/ruby/test_object_id.rb:172]:
Expected #<struct RubyVM::Shape
id=6783,
parent_id=6774,
edge_name=:@___26417,
next_field_index=2,
heap_index=0,
type=1,
capacity=7> to be too_complex?.
```
../namespace.c: In function ‘current_namespace’:
../namespace.c:221:48: warning: ‘proc_ns’ may be used uninitialized [-Wmaybe-uninitialized]
221 | if (permit_calling_builtin || (proc_ns && NAMESPACE_USER_P(proc_ns)))
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c:204:31: note: ‘proc_ns’ was declared here
204 | const rb_namespace_t *proc_ns;
| ^~~~~~~
In function ‘copy_ext_file’,
inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18:
../namespace.c:768:21: warning: ‘written’ may be used uninitialized [-Wmaybe-uninitialized]
768 | wrote = fwrite(buffer+written, 1, read-written, dst);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c: In function ‘rb_namespace_local_extension’:
../namespace.c:748:25: note: ‘written’ was declared here
748 | size_t read, wrote, written;
| ^~~~~~~
In function ‘copy_ext_file’,
inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18:
../namespace.c:768:21: warning: ‘read’ may be used uninitialized [-Wmaybe-uninitialized]
768 | wrote = fwrite(buffer+written, 1, read-written, dst);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c: In function ‘rb_namespace_local_extension’:
../namespace.c:748:12: note: ‘read’ was declared here
748 | size_t read, wrote, written;
| ^~~~