-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Don't allow overwriting SESSION_GLOBALS #84954
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.