Skip to content

Commit c22784e

Browse files
committed
Fix Struct#hash for keyword_init: true Struct
* The return value of `vm_hash_update` was not used.
1 parent 7668bd7 commit c22784e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Bug fixes:
5555
* Made `Kernel#caller_locations` accept a range argument, and return `nil` when appropriate.
5656
* Made `rb_respond_to` work with primitives (#1869, @chrisseaton).
5757
* Fixed issue with missing backtrace for `rescue $ERROR_INFO` (#1660).
58+
* Fixed `Struct#hash` for `keyword_init: true` `Struct`.
5859

5960
Compatibility:
6061

src/main/ruby/truffleruby/core/struct.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ def hash
309309
val = TrufflePrimitive.vm_hash_start(CLASS_SALT)
310310
val = TrufflePrimitive.vm_hash_update(val, size)
311311
return val if Thread.detect_outermost_recursion self do
312-
_attrs.each { |var| TrufflePrimitive.vm_hash_update(val, TrufflePrimitive.object_hidden_var_get(self, var).hash) }
312+
_attrs.each do |var|
313+
val = TrufflePrimitive.vm_hash_update(val, TrufflePrimitive.object_hidden_var_get(self, var).hash)
314+
end
313315
end
314316
TrufflePrimitive.vm_hash_end(val)
315317
end

0 commit comments

Comments
 (0)