Auto merge of #29714 - petrochenkov:strparse, r=nrc
In particular, attributes are now parsed on fields of tuple variants
This commit is contained in:
commit
d668fab0ef
4 changed files with 52 additions and 53 deletions
|
|
@ -8,15 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
// For style and consistency reasons, non-parametrized enum variants must
|
||||
// be used simply as `ident` instead of `ident ()`.
|
||||
// This test-case covers enum declaration.
|
||||
|
||||
enum Foo {
|
||||
Bar(), //~ ERROR nullary enum variants are written with no trailing `( )`
|
||||
Baz(), //~ ERROR nullary enum variants are written with no trailing `( )`
|
||||
Bar(), //~ ERROR empty tuple structs and enum variants are not allowed
|
||||
//~^ HELP remove trailing `()` to make a unit struct or unit enum variant
|
||||
Baz(), //~ ERROR empty tuple structs and enum variants are not allowed
|
||||
//~^ HELP remove trailing `()` to make a unit struct or unit enum variant
|
||||
Bazar
|
||||
}
|
||||
|
||||
|
|
@ -10,9 +10,17 @@
|
|||
|
||||
struct TS ( //~ ERROR empty tuple structs and enum variants are not allowed
|
||||
#[cfg(untrue)]
|
||||
int,
|
||||
i32,
|
||||
);
|
||||
|
||||
fn main() {
|
||||
let s = S;
|
||||
enum E {
|
||||
TV ( //~ ERROR empty tuple structs and enum variants are not allowed
|
||||
#[cfg(untrue)]
|
||||
i32,
|
||||
)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = TS;
|
||||
let tv = E::TV;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue