-
Notifications
You must be signed in to change notification settings - Fork 59
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
Are long-lived references to thread_local variables allowed? #541
Comments
There is no way to get a However once the destructor of the thread-local gets run, the reference gets invalidated, so the The notion of "soundness" of an unsafe function is non-trivial to define so it's not entirely clear what you are asking about. |
Is this documented anywhere? |
Not that I am aware of. thread-locals are a library feature, so this would be a t-libs-api issue to be raised in https://github.com/rust-lang/rust/issues/ |
The answers to your questions are currently yes and yes. Als Ralf pointed out, this isn't documented anywhere though, so it isn't something you should rely on (yet). On the other hand, I don't consider this behaviour likely to change. Thus, if you truly need this, please file a PR adjusting the |
Is the following code sound?
In other words, is it guaranteed that:
The text was updated successfully, but these errors were encountered: