-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Disallow trailing parentheses for nullary enum variants #12935
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
Conversation
// 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 `( )` |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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.
Sorry for the mix-up, here is another update. |
|
||
enum Foo { | ||
Bar(), //~ ERROR nullary enum variants | ||
Baz() //~ ERROR nullary enum variants |
There was a problem hiding this comment.
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.
Ok, I pushed more documented test cases. |
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
…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.
Fix for #12560