I believe HashMap has such a debug assert. I found a bug where we were doing this, and if we had such assert, we wouldn't have introduced this bug