about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/or-patterns/multiple-pattern-typo.rs33
-rw-r--r--src/test/ui/or-patterns/multiple-pattern-typo.stderr42
2 files changed, 73 insertions, 2 deletions
diff --git a/src/test/ui/or-patterns/multiple-pattern-typo.rs b/src/test/ui/or-patterns/multiple-pattern-typo.rs
index 14ad33d53b0..5d1da56674b 100644
--- a/src/test/ui/or-patterns/multiple-pattern-typo.rs
+++ b/src/test/ui/or-patterns/multiple-pattern-typo.rs
@@ -1,7 +1,40 @@
+#![feature(or_patterns)]
+//~^ WARN the feature `or_patterns` is incomplete and may cause the compiler to crash
+
 fn main() {
     let x = 3;
+
     match x {
         1 | 2 || 3 => (), //~ ERROR unexpected token `||` after pattern
         _ => (),
     }
+
+    match x {
+        (1 | 2 || 3) => (), //~ ERROR unexpected token `||` after pattern
+        _ => (),
+    }
+
+    match (x,) {
+        (1 | 2 || 3,) => (), //~ ERROR unexpected token `||` after pattern
+        _ => (),
+    }
+
+    struct TS(u8);
+
+    match TS(x) {
+        TS(1 | 2 || 3) => (), //~ ERROR unexpected token `||` after pattern
+        _ => (),
+    }
+
+    struct NS { f: u8 }
+
+    match (NS { f: x }) {
+        NS { f: 1 | 2 || 3 } => (), //~ ERROR unexpected token `||` after pattern
+        _ => (),
+    }
+
+    match [x] {
+        [1 | 2 || 3] => (), //~ ERROR unexpected token `||` after pattern
+        _ => (),
+    }
 }
diff --git a/src/test/ui/or-patterns/multiple-pattern-typo.stderr b/src/test/ui/or-patterns/multiple-pattern-typo.stderr
index a29fa584b29..97f3470a54a 100644
--- a/src/test/ui/or-patterns/multiple-pattern-typo.stderr
+++ b/src/test/ui/or-patterns/multiple-pattern-typo.stderr
@@ -1,8 +1,46 @@
 error: unexpected token `||` after pattern
-  --> $DIR/multiple-pattern-typo.rs:4:15
+  --> $DIR/multiple-pattern-typo.rs:8:15
    |
 LL |         1 | 2 || 3 => (),
    |               ^^ help: use a single `|` to specify multiple patterns: `|`
 
-error: aborting due to previous error
+error: unexpected token `||` after pattern
+  --> $DIR/multiple-pattern-typo.rs:13:16
+   |
+LL |         (1 | 2 || 3) => (),
+   |                ^^ help: use a single `|` to specify multiple patterns: `|`
+
+error: unexpected token `||` after pattern
+  --> $DIR/multiple-pattern-typo.rs:18:16
+   |
+LL |         (1 | 2 || 3,) => (),
+   |                ^^ help: use a single `|` to specify multiple patterns: `|`
+
+error: unexpected token `||` after pattern
+  --> $DIR/multiple-pattern-typo.rs:25:18
+   |
+LL |         TS(1 | 2 || 3) => (),
+   |                  ^^ help: use a single `|` to specify multiple patterns: `|`
+
+error: unexpected token `||` after pattern
+  --> $DIR/multiple-pattern-typo.rs:32:23
+   |
+LL |         NS { f: 1 | 2 || 3 } => (),
+   |                       ^^ help: use a single `|` to specify multiple patterns: `|`
+
+error: unexpected token `||` after pattern
+  --> $DIR/multiple-pattern-typo.rs:37:16
+   |
+LL |         [1 | 2 || 3] => (),
+   |                ^^ help: use a single `|` to specify multiple patterns: `|`
+
+warning: the feature `or_patterns` is incomplete and may cause the compiler to crash
+  --> $DIR/multiple-pattern-typo.rs:1:12
+   |
+LL | #![feature(or_patterns)]
+   |            ^^^^^^^^^^^
+   |
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: aborting due to 6 previous errors