Closed
Description
Since rustc_span::SESSION_GLOBALS
uses scoped-tls
, it can be overwritten by calling SESSION_GLOBALS.set
from within the closure passed to the original call to SESSION_GLOBALS.set
. Any Span
s created in the 'outer' SessionGlobals
may become unusable within the inner SessionGlobals
, since they will be pointing to the wrong interner. See #84953 for an example of this happening.
There is no reason to modify SESSION_GLOBALs
once it's set for the first time. We should make it private to the rustc_span
crate, and only expose setters which assert that it is currently unset.