diff --git a/class.c b/class.c index ef3db6dab3..41dbcf5150 100644 --- a/class.c +++ b/class.c @@ -2363,12 +2363,6 @@ rb_scan_args_kw(int kw_flag, int argc, const VALUE *argv, const char *fmt, ...) return rb_scan_args_result(&arg, argc); } -int -rb_class_has_methods(VALUE c) -{ - return rb_id_table_size(RCLASS_M_TBL(c)) == 0 ? FALSE : TRUE; -} - /*! * \} */ diff --git a/hash.c b/hash.c index 6208ab9e2c..6fa85e81bb 100644 --- a/hash.c +++ b/hash.c @@ -52,11 +52,6 @@ #include "gc.h" #endif -#define HAS_EXTRA_STATES(hash, klass) ( \ - ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \ - FL_TEST((hash), FL_EXIVAR|RHASH_PROC_DEFAULT) || \ - !NIL_P(RHASH_IFNONE(hash))) - #define SET_DEFAULT(hash, ifnone) ( \ FL_UNSET_RAW(hash, RHASH_PROC_DEFAULT), \ RHASH_SET_IFNONE(hash, ifnone)) @@ -73,18 +68,6 @@ copy_default(struct RHash *hash, const struct RHash *hash2) RHASH_SET_IFNONE(hash, RHASH_IFNONE((VALUE)hash2)); } -static VALUE -has_extra_methods(VALUE klass) -{ - const VALUE base = rb_cHash; - VALUE c = klass; - while (c != base) { - if (rb_class_has_methods(c)) return klass; - c = RCLASS_SUPER(c); - } - return 0; -} - static VALUE rb_hash_s_try_convert(VALUE, VALUE); /* @@ -2608,12 +2591,6 @@ rb_hash_reject(VALUE hash) VALUE result; RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size); - if (RTEST(ruby_verbose)) { - VALUE klass; - if (HAS_EXTRA_STATES(hash, klass)) { - rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash); - } - } result = hash_dup_with_compare_by_id(hash); if (!RHASH_EMPTY_P(hash)) { rb_hash_foreach(result, delete_if_i, result); diff --git a/internal/class.h b/internal/class.h index 1d25d9e7eb..cabd5db5c0 100644 --- a/internal/class.h +++ b/internal/class.h @@ -127,7 +127,6 @@ VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj); VALUE rb_special_singleton_class(VALUE); VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach); VALUE rb_singleton_class_get(VALUE obj); -int rb_class_has_methods(VALUE c); void rb_undef_methods_from(VALUE klass, VALUE super); static inline void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin); diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 028610ea67..ac0d1dfce3 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -2048,21 +2048,12 @@ class TestHash < Test::Unit::TestCase class TestSubHash < TestHash class SubHash < Hash - def reject(*) - super - end end def setup @cls = SubHash super end - - def test_reject - assert_warning(/extra states are no longer copied/) do - super - end - end end ruby2_keywords def get_flagged_hash(*args)