Uh oh!
There was an error while loading. Please reload this page.
support pub(restricted) in thread_local! - #40984
Conversation
rust-highfive
commented
Apr 1, 2017
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Please note these six rules can be reduced to two if we revive the $x:vis RFC.
6622a28 to
20a8799Comparedurka
commented
Apr 1, 2017
Github ate my comment, so just to reiterate: this PR is real, but also meant to demonstrate why we need a |
alexcrichton
commented
Apr 12, 2017
Discussed at the libs triage meeting the other day, our conclusion was that we should probably wait for #41012 to get merged, which looks like it's going to get merged. |
carols10cents
commented
Apr 14, 2017
Labeling waiting on review since rereview might be needed once #41012 is in. |
arielb1
commented
Apr 18, 2017
#41012 has landed. @alexcrichton can you look at this? |
durka
commented
Apr 18, 2017
via email
I was planning to update or resubmit after updating the macro to use :vis. …On Apr 18, 2017 4:42 AM, "Ariel Ben-Yehuda" ***@***.***> wrote:
#41012 <#41012> has landed.
@alexcrichton <https://github.com/alexcrichton> can you look at this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40984 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n4YJClLg37qyNqr0KCeBy6RaDEk0ks5rxHdZgaJpZM4MwWIZ>
.
|
alexcrichton
commented
Apr 19, 2017
Ok thanks @durka! |
durka
commented
Apr 19, 2017
Actually we can't use |
sfackler
commented
Apr 19, 2017
Seems like you can do it before then with |
20a8799 to
8fffee0Compare8fffee0 to
62e69cdComparedurka
commented
Apr 21, 2017
Hmm, this is odd: But I did add that attribute. Does it have to be added to crates that invoke the macro as well? That would be a problem. And it should be fine because |
alexcrichton
commented
Apr 21, 2017
As the author of #41012, you're probably in the best position to answer that question :) |
durka
commented
Apr 21, 2017
Good call :) Can a commit fixing that go in this PR or should I separate it? |
068b960 to
6174d01Compare
I believe this is fixable, but I'm not sure exactly how -- I'll look into it when I get the time (probably a week or two). |
OK, I did come up with a way to make it shorter, by having the macro munch attributes one at a time until it gets to the visibility specifier: macro_rules! thread_local {// terminate recursion(@ [] -> $_x:tt) => {};// munch one attribute(@ [#[$attr:meta] $($rest:tt)*] -> [$(#[$attrs:meta])*]) => {
thread_local!(@ [$($rest)*] -> [$(#[$attrs])* #[$attr]]);};// finish a static with no trailing semicolon (therefore there are no more)(@ [$vis:vis static $name:ident: $typ:ty = $init:expr] -> [$(#[$attrs:meta])*]) => {
__thread_local_inner!(($(#[$attrs])*) $vis, $name, $typ, $init);};// finish a static with trailing semicolon and continue to parse more(@ [$vis:vis static $name:ident: $typ:ty = $init:expr; $($rest:tt)*] -> [$(#[$attrs:meta])*]) => {
__thread_local_inner!(($(#[$attrs])*) $vis, $name, $typ, $init);
thread_local!(@ [$($rest)*] -> []);};// public entry point($($t:tt)*) => {
thread_local!(@ [$($t)*] -> []);}}This business with the |
alexcrichton
commented
Apr 26, 2017
Yeah if we do add a macro implementation like that we'd want it to be an internal macro hidden away, but it seems reasonableto have such an implementation. |
alexcrichton
commented
May 4, 2017
@durka to clarify, did you intend on landing that instantiation in this PR? Or waiting for a fix to the macros from @jseyfried? |
durka
commented
May 4, 2017
via email
Ah sorry this dropped off my radar. I'm happy to land either the version
with extra arms (so not actually using :vis in thread_local!, though it
would be used in thread_local_inner!) or the muncher version in this PR.
The muncher version wouldn't look great in rustdoc (since it would just be
$($t:tt)*) but we can solve that with docs. Do you care which way we go? …On Thu, May 4, 2017 at 2:25 PM, Alex Crichton ***@***.***> wrote:
@durka <https://github.com/durka> to clarify, did you intend on landing
that instantiation in this PR? Or waiting for a fix to the macros from
@jseyfried <https://github.com/jseyfried>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#40984 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n9sPs29up4xTFcSk_a0qxNDldhYLks5r2hgUgaJpZM4MwWIZ>
.
|
alexcrichton
commented
May 4, 2017
I'd ideally prefer to wait for |
carols10cents
commented
May 8, 2017
Are there issues/PRs for the |
durka
commented
May 8, 2017
I think it is just #26444 (closed WONTFIX) unfortunately. But I could be wrong. |
alexcrichton
commented
May 8, 2017
This was to a large degree the motivation for #41012, right? If so, it seems a shame if it's actually still difficult to leverage :( |
Mark-Simulacrum
commented
May 14, 2017
@durka Could you give an update here? Looks like Travis is still failing -- @jseyfried, did you have a chance to take a look? |
durka
commented
May 14, 2017
Status quo. |
bors
commented
May 16, 2017
☔ The latest upstream changes (presumably #42038) made this pull request unmergeable. Please resolve the merge conflicts. |
durka
commented
May 17, 2017
I'm going to close this for now and post in the |
Fixesrust-lang#24189. Fixesrust-lang#26444. Fixesrust-lang#27832. Fixesrust-lang#34030. Fixesrust-lang#35650. Fixesrust-lang#39964. Fixes the 4th comment in rust-lang#40569. Fixes the issue blocking rust-lang#40984.
…seyfried Only match a fragment specifier the if it starts with certain tokens. When trying to match a fragment specifier, we first predict whether the current token can be matched at all. If it cannot be matched, don't bother to push the Earley item to `bb_eis`. This can fix a lot of issues which otherwise requires full backtracking (#42838). In this PR the prediction treatment is not done for `:item`, `:stmt` and `:tt`, but it could be expanded in the future. Fixes#24189. Fixes#26444. Fixes#27832. Fixes#34030. Fixes#35650. Fixes#39964. Fixes the 4th comment in #40569. Fixes the issue blocking #40984.
durka
commented
Jul 12, 2017
Rebased and reopened now that #42913 got merged. |
Mark-Simulacrum
commented
Jul 12, 2017
Looks like you'll need to open a new pull request -- GH is being annoying and not letting this one be reopened. |
durka
commented
Jul 12, 2017
Resubmitted as #43185. |
support pub(restricted) in thread_local! (round 2) Resurrected #40984 now that the issue blocking it was fixed. Original description: `pub(restricted)` was stabilized in #40556 so let's go! Here is a [playground](https://play.rust-lang.org/?gist=f55f32f164a6ed18c219fec8f8293b98&version=nightly&backtrace=1). I changed the interface of `__thread_local_inner!`, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov@jseyfried), so this may be an issue.
pub(restricted)was stabilized in #40556 so let's go!Here is a playground.
I changed the interface of
__thread_local_inner!, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov@jseyfried), so this may be an issue.