Don't allow overwriting SESSION_GLOBALS
#84954
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Since
rustc_span::SESSION_GLOBALS
usesscoped-tls
, it can be overwritten by callingSESSION_GLOBALS.set
from within the closure passed to the original call toSESSION_GLOBALS.set
. AnySpan
s created in the 'outer'SessionGlobals
may 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_GLOBALs
once it's set for the first time. We should make it private to therustc_span
crate, and only expose setters which assert that it is currently unset.The text was updated successfully, but these errors were encountered: