-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set callbacks globally #67614
Set callbacks globally #67614
Conversation
I opted not to do this for now, I think duplicating a single function call isn't too bad.
I don't feel confident enough to say either way; regardless, the load on an Atomic should not be hot code I think -- the value isn't changing, and we only issue ~1 store per program to the address. Either way in a dummy example (https://rust.godbolt.org/z/jE2XJj) changing the load to Relaxed instead of SeqCst didn't seem to have any effect on the generated assembly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
The callbacks have precisely two states: the default, and the one present throughout almost all of the rustc run (the filled in value which has access to TyCtxt). We used to store this as a thread local, and reset it on each thread to the non-default value. But this is somewhat wasteful, since there is no reason to set it globally -- while the callbacks themselves access TLS, they do not do so in a manner that fails in when we do not have TLS to work with.
281ed0c
to
b13d5d6
Compare
b13d5d6
to
4dcc627
Compare
r=me when CI passes |
@bors r=Zoxc |
📌 Commit 4dcc627 has been approved by |
…=Zoxc Set callbacks globally This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
…=Zoxc Set callbacks globally This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
Rollup of 12 pull requests Successful merges: - #67112 (Refactor expression parsing thoroughly) - #67192 (Various const eval and pattern matching ICE fixes) - #67287 (typeck: note other end-point when checking range pats) - #67459 (prune ill-conceived BTreeMap iter_mut assertion and test its mutability) - #67576 (reuse `capacity` variable in slice::repeat) - #67602 (Use issue = "none" instead of "0" in intrinsics) - #67614 (Set callbacks globally) - #67617 (Remove `compiler_builtins_lib` documentation) - #67629 (Remove redundant link texts) - #67632 (Convert collapsed to shortcut reference links) - #67633 (Update .mailmap) - #67635 (Document safety of Path casting) Failed merges: r? @ghost
…=Zoxc Set callbacks globally This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
Set callbacks globally This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
☀️ Test successful - checks-azure |
This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.