Additionally, add lots of tests for new functionality around statics and `static mut`.
Fixes #8315 Fixes #11940