diff options
Diffstat (limited to 'tests/ui/parser/recover-from-bad-variant.rs')
-rw-r--r-- | tests/ui/parser/recover-from-bad-variant.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/parser/recover-from-bad-variant.rs b/tests/ui/parser/recover-from-bad-variant.rs new file mode 100644 index 000000000..e8887147c --- /dev/null +++ b/tests/ui/parser/recover-from-bad-variant.rs @@ -0,0 +1,15 @@ +enum Enum { + Foo { a: usize, b: usize }, + Bar(usize, usize), +} + +fn main() { + let x = Enum::Foo(a: 3, b: 4); + //~^ ERROR invalid `struct` delimiters or `fn` call arguments + match x { + Enum::Foo(a, b) => {} + //~^ ERROR expected tuple struct or tuple variant, found struct variant `Enum::Foo` + Enum::Bar { a, b } => {} + //~^ ERROR tuple variant `Enum::Bar` written as struct variant + } +} |