-
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
Allow thread_local!() to take attributes #30759
Conversation
r? @brson (I have no background on TLS/macros/attributes) |
As mentioned in #30756 my preferred "fix" for now would be to not change the public interface and instead add some |
Updated so that it allows unsafe/dead code |
er, git push stopped working, updated now |
Can you add a test for this as well? |
Done |
thread_local!(static FOO: u8 = 1); | ||
|
||
fn main() { | ||
} |
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.
Missing newline.
@bors r=alexcrichton |
📌 Commit 9827dce has been approved by |
Doesn't putting |
@bors r- Per my previous comment, putting |
Yeah, it does. I'd fixed it in a more flexible way in d02f969 where attributes can be passed in, if that is more amenable. |
Hm I thought that we had other examples of macros that did things like this, but we apparently don't. In retrospect I believe |
A bunch of macros like bitflags do the thing where they can accept attributes. I don't see any which contain allows. |
The libs team discussed this during triage today and the conclusion was that the easiest fix here was just removing the unsafe function entirely. @Manishearth would you be ok updating the patch to just changing it to a safe function? The unsafety here is all synthetic as it's all an implementation detail anyway. |
4623aff
to
1f18441
Compare
Done. I'm not sure where the unsafe boundary should eventually end up, so you may want to have a close look. |
Ah well technically this was the boundary (a function returning a Looks like the travis failure is legit (needs an unsafe block around a call to an intrinsic), but otherwise lgtm |
Yeah, I fixed the travis failure locally, but tests haven't run yet. |
Tests pass. r? |
fixes #30756
r? @gankro