This is a backport cherry-pick of commits 165156beeb cce974e8ea from the v3.0 branch as we need symbol hashes directly inside their scopes for more general usage than before.
165156beeb
cce974e8ea