We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hash#rehash
@first
The following code should explain the issue:
hash = {"a" => 2, "b" => 3, "c" => 1} hash.delete("a") puts hash # => {"b" => 3, "c" => 1} hash.rehash puts hash # => {"c" => 1} hash.rehash puts hash # => {} # --- hash = {"a" => 2, "b" => 3, "c" => 1, "d" => 0, "e" => 6} hash.delete("a") hash.delete("b") puts hash # => {"c" => 1, "d" => 0, "e" => 6} hash.rehash puts hash # => {"e" => 6} hash.rehash puts hash # => {}
The hash deletes @first elements at the beginning of of hash.
The state of the Hash seems to be invalid after the rehash as it's also possible to get segfaults:
Hash
hash = {"a" => 2, "b" => 3} hash.delete("a") hash.rehash hash.first_key[0] # => Invalid memory access (signal 11) at address 0x4
$ crystal -v Crystal 1.12.1 [4cea10199] (2024-04-11) LLVM: 15.0.7 Default target: x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Report
The following code should explain the issue:
The hash deletes
@first
elements at the beginning of of hash.The state of the
Hash
seems to be invalid after the rehash as it's also possible to get segfaults:The text was updated successfully, but these errors were encountered: