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 Spans 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.
Since
rustc_span::SESSION_GLOBALSusesscoped-tls, it can be overwritten by callingSESSION_GLOBALS.setfrom within the closure passed to the original call toSESSION_GLOBALS.set. AnySpans created in the 'outer'SessionGlobalsmay become unusable within the innerSessionGlobals, since they will be pointing to the wrong interner. See #84953 for an example of this happening.There is no reason to modify
SESSION_GLOBALsonce it's set for the first time. We should make it private to therustc_spancrate, and only expose setters which assert that it is currently unset.