You can use inline assembly to handle that - and then you don’t need any
globals at all.
If you want to keep using globals (or you have other places where you need
them), an “interrupts disabled” lock around a static should also work and
it can be a newtype around the type (which would bave to contain Cell or
RefCell I guess - but the former is 0 overhead).
However, this pre-RFC needs to be updated to make use of const fn and
change from “remove” to “deprecate”, sadly, as it missed the mark (unless
the core team thinks otherwise).
And in my absence, someone else would have to take over for it to stand a
chance (cc @nikomatsakis).