-
Couldn't load subscription status.
- Fork 13.9k
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.
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 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.
GuillaumeGomez
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.