-
Notifications
You must be signed in to change notification settings - Fork 13.3k
thread_local!() can't take attributes #30756
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
Comments
The correct fix for this specific bug is to annotate |
dead_code possibly. |
For now, we can artificially add an inner module: #![deny(unsafe_code)]
mod inner {
#![allow(unsafe_code)]
thread_local!(pub static KEY: u8 = 1);
}
use inner::KEY;
fn main() {
KEY.with(|x| { x == &0u8 });
} |
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 4, 2016
bors
added a commit
that referenced
this issue
Feb 4, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
will hit an unsafe_code warning due to an unsafe function internally defined in the thread local macro (the unsafe function is a recent addition). There's no way to
allow()
it.The macro should take in attributes.
The text was updated successfully, but these errors were encountered: