diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-12-12 15:33:24 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-12-12 17:45:06 +0900 |
commit | 267ecf5f02bf0bdb183be06f17b7d2fdc8d1a3ad (patch) | |
tree | 2e4b1940e25cb61bea3e15fe0c35de720ba7bb5b /error.c | |
parent | 46e8a26c17d20d19838a3b55316e06229ac1e2fd (diff) |
Add `rb_warn_reserved_name_at`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12315
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -575,6 +575,18 @@ rb_warn_deprecated_to_remove(const char *removal, const char *fmt, const char *s } } +void +rb_warn_reserved_name(const char *coming, const char *fmt, ...) +{ + if (!deprecation_warning_enabled()) return; + + with_warning_string_from(mesg, 0, fmt, fmt) { + rb_str_set_len(mesg, RSTRING_LEN(mesg) - 1); + rb_str_catf(mesg, " is reserved for Ruby %s\n", coming); + rb_warn_category(mesg, ID2SYM(id_deprecated)); + } +} + static inline int end_with_asciichar(VALUE str, int c) { |