Hash#rehash should raise FrozenError if the hash is frozen.
MRI
$ irb [3.3.6] > h = {a: 1, b: 2} => {:a=>1, :b=>2} [3.3.6] > h.freeze => {:a=>1, :b=>2} [3.3.6] > h.rehash (irb):3:in `rehash': can't modify frozen Hash: {:a=>1, :b=>2} (FrozenError) from (irb):3:in `<main>' from <internal:kernel>:187:in `loop' from /Users/lopopolo/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.15.1/exe/irb:9:in `<top (required)>' from /Users/lopopolo/.local/share/mise/installs/ruby/3.3.6/bin/irb:25:in `load' from /Users/lopopolo/.local/share/mise/installs/ruby/3.3.6/bin/irb:25:in `<main>'
mruby
$ bin/mirb mirb - Embeddable Interactive Ruby Shell > h = {a: 1, b: 2} => {a: 1, b: 2} > h.freeze => {a: 1, b: 2} > h.rehash => {a: 1, b: 2}