-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
syntax: add a local_data_key macro that creates a key for access to the TLS. #8534
Conversation
(This was prompted by this comment, since this would mean that the user of tls keys don't have to remember to put |
|
||
// NOTE: use this after a snapshot lands to abstract the details | ||
// of the TLS interface. | ||
macro_rules! local_data_key ( |
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.
Could we get the syntax local_data_key!(name: type)
? I think conditions manage to do this
The only thing which is unfortunate about this is that you can still create your own local data keys manually. Without a good way to avoid this, I'm worried about having some users use one way and others use another and then you get bugs because the two are incompatible. I can't really think of a good way to prevent users from creating keys while only this compiler macro can, do you have any ideas in that respsect? |
I was thinking about this some more and I thought that it was very similar to conditions in that there's two ways to define them (it's just one's more convenient than the other). It seems like this kinda falls in the same category, so I'm ok with it on that grounds. On the other hand, I'd still be wary of marking all statics as Basically, with a tweak to the declaration syntax and with some updated dox, r+ |
…he TLS. This allows the internal implementation details of the TLS keys to be changed without requiring the update of all the users. (Or, applying changes that have to be applied for the keys to work correctly, e.g. forcing LLVM to not merge these constants.)
Fixed the syntax, and updated the Agree that that this is similar to the situation with conditions (the |
This allows the internal implementation details of the TLS keys to be changed without requiring the update of all the users. (Or, applying changes that *have* to be applied for the keys to work correctly, e.g. forcing LLVM to not merge these constants.)
Rustup r? `@ghost` changelog: none
This allows the internal implementation details of the TLS keys to be
changed without requiring the update of all the users. (Or, applying
changes that have to be applied for the keys to work correctly, e.g.
forcing LLVM to not merge these constants.)