It seems the plan is to eventually make string literals frozen by default: https://bugs.ruby-lang.org/issues/20205
With RUBYOPT="--enable-frozen-string-literal, rerun doesn't work, but it'd be nice if it did.
It raises an exception here:
Suggestion
d.delete_suffix("/") is a non-mutating (and imo, more readable) alternative.