-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Conditions are always private #6009
Comments
Here's my test case
|
@pnkfelix Had a lot of good comments about this issue in #6046. Reproducing them here:
|
…ants, r=graydon @brson: r? [please ignore the other one that was accidentally based off master due to back-button-bugs in github.com] My goal is to resolve the question of whether we want to encourage (by example) consistent use of pub to make identifiers publicly-accessible, even in syntax extensions. (If people don't want that, then we can just let this pull request die.) This is part one of two. Part two, whose contents should be clear from the FIXME's in this commit, would land after this gets incorporated into a snapshot. (The eventual goal is to address issue #6009 , which was implied by my choice of branch name, but not mentioned in the pull request, so github did not notice it.)
Not sure or not if changing condition! will be backwards-incompatible... maybe the triage committee knows. Nominating. |
I think that this can be fixed now? In libsyntax/ext/expand there are two rules for defining conditions and one has the I think that this now entails removing the |
Actually, looking more into this, this is blocked on #5129. In the generated |
I don't think this is blocked on #5129. That's a different bug. This bug is about the condition itself being |
I figured the problem would be that you can't actually make a condition private right now. We do have a If you declare a pub condition, you'd expect: pub mod condition_name {
pub static cond: ... = ...;
} Which certainly works to make it public. If you declare a private condition, you would expect mod condition_name {
static cond: ... = ...;
} Now in theory you can access any member of your immediate children's modules, but that's not the case in this situation. Currently resolve bugs block this from working. Knowing that, you might want to generate code for private conditions like mod condition_name {
pub static cond: ... = ...;
} which indicates that you can reach your private child module to read cond. The owning module of the condition can certainly do that, but the bug in #5129 means that so can everyone else. I guess this isn't really blocked on #5129 per-se, but rather it's blocked on fixing resolve rules in general. |
Opened #8215 about resolve issues |
Ok, so I think this bug as written is fixed, but I'm not entirely sure if it'll have to change again when dependent bugs are fixed. Leaving open for re-analysis in future triage when Brian and Patrick are here. |
accepted for backwards-compatibility |
@alexcrichton So, one way to make "progress" on this ticket is to:
Basically, I don't think it's a great idea to build a resolve-workaround into a core macro like this, especially if the workaround itself is just as leaky as the per-call-site workaround. (That is, I would understand if putting the work-around into the macro actually bought us anything, but it doesn't, its just making the resolve issues seem like less of a problem than they really are, because people are not aware of the extra pubs that are getting implicitly inserted into the macro expansions.) Any thoughts on that strategy? Is it a waste of time? (I'm going to give it a shot nonetheless.) |
(and of course, there's the question of whether the cases that need a |
Sounds like a good strategy to me! I hope to look into the resolve stuff soon as well, but no guarantees on that sadly. |
Odd that my earlier make checks did not catch this.
…-in-too_many_lines-lint-message, r=phansch Show line count and max lines in too_many_lines lint message This PR adds the current amount of lines and the current maximum number of lines in the message for the `too_many_lines` lint, in a similar way as the `too_many_arguments` lint currently does. changelog: show the line count and the maximum lines in the message for the `too_many_lines` lint.
The
condition!
macro expands to a private mod and addingpub
to thecondition!
declaration has no effect. As a result, all conditions are private and they are not usable. The quickest workaround is probably to make all conditions public.The text was updated successfully, but these errors were encountered: