Skip to content
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

libsyntax: forbid visibility modifiers for enum variants #28440

Closed
wants to merge 1 commit into from

Conversation

matklad
Copy link
Member

@matklad matklad commented Sep 16, 2015

fixes #28433

This just removes visibility parsing from the parser. No custom error message is provided: I guess default "expected identifier, found keyword pub" is already good.

So the ast::Variant_ vis is always Inherited. I guess it would be possible to get rid of this field now, but I'm not sure that it is in scope of this PR.

The tests are changed as follows:

  • issue-3993-2.rs is removed (it is not relevant any more)
  • issue-28433.rs is added (it's basically simplified issue-3993-2.rs)
  • nothing is done to issue-3993. It does not seem relevant to pub/priv qualifiers on individual variants #3993 git hub issue
  • useless-priv.rs is renamed to useless-pub.rs and a case about enum is dropped

@rust-highfive
Copy link
Collaborator

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

goose
}
enum bird {
pub duck, //~ ERROR: expected identifier, found keyword `pub`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will not pass because of #28439 I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I run this this test fater than make -j8 check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d suggest waiting for travis build to finish for now.

Otherwise the fastest way without editing makefiles is to do make -j8 check-stage2-cfail TESTNAME=issue-28433 I think.

@sfackler
Copy link
Member

cc @alexcrichton not sure if we'd want to warn for a bit before adjusting the parser.

@alexcrichton
Copy link
Member

I've started a crater build to help evaluate the impact here. I personally be fine just turning this into a hard error immediately and sending PRs to any affected crates to update the syntax.

cc @rust-lang/lang, a semi-language-change but mostly just a bugfix

@alexcrichton alexcrichton added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Sep 17, 2015
nagisa added a commit to nagisa/rust that referenced this pull request Sep 17, 2015
@alexcrichton
Copy link
Member

Closing in favor of #28442

bors added a commit that referenced this pull request Sep 18, 2015
Followup on #28440 

Do not merge before the referenced PR is merged. I will fix the PR once that is merged (or close if it is not)
Kha added a commit to Kha/rustfmt that referenced this pull request Sep 19, 2015
@matklad matklad deleted the remove-enum-var-vis branch July 9, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

visibility modifiers are accepted for enum variants
6 participants