diff options
author | Étienne Barrié <[email protected]> | 2024-05-27 11:22:39 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-05-28 07:32:33 +0200 |
commit | 1376881e9afe6ff673f64afa791cf30f57147ee2 (patch) | |
tree | a5ad297473381ac00c593ca2ca1ef93381fd3a00 /internal/string.h | |
parent | 2114d0af1e5790da365584a38ea7ee58670dc11b (diff) |
Stop marking chilled strings as frozen
They were initially made frozen to avoid false positives for cases such
as:
str = str.dup if str.frozen?
But this may cause bugs and is generally confusing for users.
[Feature #20205]
Co-authored-by: Jean Boussier <[email protected]>
Diffstat (limited to 'internal/string.h')
-rw-r--r-- | internal/string.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/string.h b/internal/string.h index fb37f73114..3333b3afc3 100644 --- a/internal/string.h +++ b/internal/string.h @@ -19,6 +19,10 @@ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */ #define STR_CHILLED FL_USER3 +enum ruby_rstring_private_flags { + RSTRING_CHILLED = STR_CHILLED, +}; + #ifdef rb_fstring_cstr # undef rb_fstring_cstr #endif @@ -118,15 +122,14 @@ CHILLED_STRING_P(VALUE obj) static inline void CHILLED_STRING_MUTATED(VALUE str) { + FL_UNSET_RAW(str, STR_CHILLED); rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, "literal string will be frozen in the future"); - FL_UNSET_RAW(str, STR_CHILLED | FL_FREEZE); } static inline void STR_CHILL_RAW(VALUE str) { - // Chilled strings are always also frozen - FL_SET_RAW(str, STR_CHILLED | RUBY_FL_FREEZE); + FL_SET_RAW(str, STR_CHILLED); } static inline bool |