-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Document const-initialization for thread_local!
macro
#109908
Document const-initialization for thread_local!
macro
#109908
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
169925f
to
0b23d47
Compare
Documenting this looks great to me. I do however have a concern about going into the details of const contexts. It talks a bit about what can and can't be done in const contexts, which is more or less true enough today but might not be tomorrow. E.g. "doing so does not change the behavior" and the failing example using Documenting the current const details may be useful but I'm not sure that this is the place to do it. |
@ChrisDenton I understand your concerns, but I think that without such a counterexample the documentation would be incomplete. Besides, it is a |
/// Doing so does not change the behavior, but might enable more efficient implementation | ||
/// of [`LocalKey`][`std::thread::LocalKey`] on supported platforms. |
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.
Fair enough. Then I would narrow my concerns to the following suggestion:
/// Doing so does not change the behavior, but might enable more efficient implementation | |
/// of [`LocalKey`][`std::thread::LocalKey`] on supported platforms. | |
/// Doing so might enable more efficient implementation | |
/// of [`LocalKey`][`std::thread::LocalKey`] on supported platforms. |
Superseded by now merged #110620 |
#83416 added const initialization for statics in
std::thread::thread_local
macro. Surprisingly, it was merged completely undocumented, so I suspect most of Rust users are not even aware of this functionality. This PR intents to close this gap.@rustbot labels: +A-docs