summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/match-arm-without-body.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/match-arm-without-body.rs')
-rw-r--r--tests/ui/parser/match-arm-without-body.rs77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/ui/parser/match-arm-without-body.rs b/tests/ui/parser/match-arm-without-body.rs
new file mode 100644
index 000000000..4723abff8
--- /dev/null
+++ b/tests/ui/parser/match-arm-without-body.rs
@@ -0,0 +1,77 @@
+macro_rules! pat {
+ () => { Some(_) }
+}
+
+fn main() {
+ match Some(false) {
+ Some(_)
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ Some(_)
+ _ => {}
+ //~^ ERROR expected one of
+ }
+ match Some(false) {
+ Some(_),
+ //~^ ERROR unexpected `,` in pattern
+ //~| HELP try adding parentheses to match on a tuple
+ //~| HELP or a vertical bar to match on multiple alternatives
+ }
+ match Some(false) {
+ Some(_),
+ //~^ ERROR unexpected `,` in pattern
+ //~| HELP try adding parentheses to match on a tuple
+ //~| HELP or a vertical bar to match on multiple alternatives
+ _ => {}
+ }
+ match Some(false) {
+ Some(_) if true
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ Some(_) if true
+ _ => {}
+ //~^ ERROR expected one of
+ }
+ match Some(false) {
+ Some(_) if true,
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ Some(_) if true,
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ _ => {}
+ }
+ match Some(false) {
+ pat!()
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ pat!(),
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ pat!() if true,
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ }
+ match Some(false) {
+ pat!()
+ //~^ ERROR expected `,` following `match` arm
+ //~| HELP missing a comma here
+ _ => {}
+ }
+ match Some(false) {
+ pat!(),
+ //~^ ERROR `match` arm with no body
+ //~| HELP add a body after the pattern
+ _ => {}
+ }
+}