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

Disallow trailing parentheses for nullary enum variants #12935

Merged
merged 1 commit into from
Mar 17, 2014

Conversation

lbonn
Copy link
Contributor

@lbonn lbonn commented Mar 16, 2014

Fix for #12560

// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:nullary enum variants are written with no trailing `( )`
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using error-pattern, you should be using //~ ERROR nullary enum variants ...

This will check that the line numbers are correct, not just that the error was printed.

@lbonn
Copy link
Contributor Author

lbonn commented Mar 16, 2014

Thanks for the tip, here is a new diff.

// option. This file may not be copied, modified, or distributed
// except according to those terms.

enum Foo { Bar(), Baz() } //~ ERROR nullary enum variants
Copy link
Member

Choose a reason for hiding this comment

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

These tests would either be written as

enum Foo { Bar(), Baz() } //~ ERROR nullary enum variants
//~^ ERROR nullary enum variants

or, preferably (to keep the error as precise as possible)

enum Foo {
    Bar(),  //~ ERROR nullary enum variants
    Baz()  //~ ERROR nullary enum variants
}

and similarly below.

@lbonn
Copy link
Contributor Author

lbonn commented Mar 17, 2014

Sorry for the mix-up, here is another update.


enum Foo {
Bar(), //~ ERROR nullary enum variants
Baz() //~ ERROR nullary enum variants
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what other folks think about this but I prefer having the full error message here. There are error messages that share the same prefix (not the case of this PR... I think). Also, the full error message helps understanding what the test is actually testing.

@lbonn
Copy link
Contributor Author

lbonn commented Mar 17, 2014

Ok, I pushed more documented test cases.

bors added a commit that referenced this pull request Mar 17, 2014
@bors bors closed this Mar 17, 2014
@bors bors merged commit 695114e into rust-lang:master Mar 17, 2014
Kroisse added a commit to Kroisse/rust-mustache that referenced this pull request Mar 22, 2014
related issues of mozilla/rust:
- rust-lang/rust#12772  rename std::vec -> std::slice
- rust-lang/rust#13028  rename std::vec_ng -> std::vec
- rust-lang/rust@0305ed5  std: Add Vec to the prelude
- rust-lang/rust#12935  Disallow trailing parentheses for nullary enum variants
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 16, 2022
…r=Veykril

Parse range patterns in struct and slice without trailing comma

Resolves rust-lang#12935

This patch includes the support for range patterns in slices, which is unstable (tracked in rust-lang#67264). If it's not desired I can remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants