Bug #1551: String#slice! Raises RuntimeError on Frozen String Despite Making No Changes
http://redmine.ruby-lang.org/issues/show/1551

Author: Run Paint Run Run
Status: Open, Priority: Normal
Category: core, Target version: 1.9.x
ruby -v: ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux]

On 1.9.2 and 1.9.1 calling String#slice! on a frozen string causes a RuntimeError to be raised even if the method wouldn't have changed the string. This behavior is inconsistent with other operations on frozen strings, and a regression from 1.8.7, on which no exception is raised in this scenario.

The following examples all raise RuntimeErrors on ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux]:

"ruby".freeze.slice!(10)
"ruby".freeze.slice!(10,3)
"ruby".freeze.slice!(4,-3)
"ruby".freeze.slice!(10..20)
"ruby".freeze.slice!(/x/)


----------------------------------------
http://redmine.ruby-lang.org