From 6deeec5d459ecff5ec4628523b14ac7379fd942e Mon Sep 17 00:00:00 2001 From: Jean byroot Boussier Date: Wed, 13 Nov 2024 15:20:00 +0100 Subject: Mark strings returned by Symbol#to_s as chilled (#12065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use FL_USER0 for ELTS_SHARED This makes space in RString for two bits for chilled strings. * Mark strings returned by `Symbol#to_s` as chilled [Feature #20350] `STR_CHILLED` now spans on two user flags. If one bit is set it marks a chilled string literal, if it's the other it marks a `Symbol#to_s` chilled string. Since it's not possible, and doesn't make much sense to include debug info when `--debug-frozen-string-literal` is set, we can't include allocation source, but we can safely include the symbol name in the warning message, making it much easier to find the source of the issue. Co-Authored-By: Étienne Barrié --------- Co-authored-by: Étienne Barrié Co-authored-by: Jean Boussier --- variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 5e178ef06b..61c188bede 100644 --- a/variable.c +++ b/variable.c @@ -1814,7 +1814,7 @@ void rb_obj_freeze_inline(VALUE x) if (RB_FL_ABLE(x)) { RB_FL_SET_RAW(x, RUBY_FL_FREEZE); if (TYPE(x) == T_STRING) { - RB_FL_UNSET_RAW(x, FL_USER3); // STR_CHILLED + RB_FL_UNSET_RAW(x, FL_USER2 | FL_USER3); // STR_CHILLED } rb_shape_t * next_shape = rb_shape_transition_shape_frozen(x); -- cgit v1.2.3