-
Notifications
You must be signed in to change notification settings - Fork 13.3k
RFC: Forbid pub
and priv
in positions where they do not change the default behavior
#5495
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I think this would make the rules much easier to understand, so definitely a +1 from me. It's just a removal of redundancy from the valid syntax and could even be considered a lint error/warning if backwards compatibility is a concern. |
I've hit this while trying out some code with multiple nested modules and it would be great to have this implemented. |
Nominating for milestone 2, backwards-compatible |
As long as its a lint I can toggle, sounds fine to me. |
@pnkfelix I don't think the plan is to make it a lint, rather to modify the grammar directly. IMO allowing the qualifiers in those positions is unwarranted. |
inside #8385 |
close when landed. |
Closed by e99eff1 |
Reopening because I'm not certain that |
Test cases might also make sense here, to help us ensure that we have the rules properly implemented. |
Here's the specific cases that I can think of which need to be fixed:
These should all be verified with a test case if they're already disallowed because I don't think this exists in the test suite. There may be others as well. |
Update the changelog update documentation I just started working on updating the changelog. Hopefully the docs are a bit clearer now? r? @flip1995 changelog: none
Right now structs are private-by-default and struct fields are public-by-default. And yet this is legal:
The
pub
andpriv
declarations there are meaningless. Allowing them in those positions will increase confusion over what the defaults actually are. I propose that this be forbidden.The text was updated successfully, but these errors were encountered: