summaryrefslogtreecommitdiffstats
path: root/tests/ui/or-patterns
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/or-patterns/exhaustiveness-pass.rs6
-rw-r--r--tests/ui/or-patterns/missing-bindings.stderr84
-rw-r--r--tests/ui/or-patterns/or-patterns-syntactic-fail.stderr8
3 files changed, 55 insertions, 43 deletions
diff --git a/tests/ui/or-patterns/exhaustiveness-pass.rs b/tests/ui/or-patterns/exhaustiveness-pass.rs
index e8c8a0e7b..428b9a19f 100644
--- a/tests/ui/or-patterns/exhaustiveness-pass.rs
+++ b/tests/ui/or-patterns/exhaustiveness-pass.rs
@@ -35,4 +35,10 @@ fn main() {
((0, 0) | (1, 0),) => {}
_ => {}
}
+
+ // This one caused ICE https://github.com/rust-lang/rust/issues/117378
+ match (0u8, 0) {
+ (x @ 0 | x @ (1 | 2), _) => {}
+ (3.., _) => {}
+ }
}
diff --git a/tests/ui/or-patterns/missing-bindings.stderr b/tests/ui/or-patterns/missing-bindings.stderr
index 4457b7893..7f182a857 100644
--- a/tests/ui/or-patterns/missing-bindings.stderr
+++ b/tests/ui/or-patterns/missing-bindings.stderr
@@ -103,22 +103,6 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `c`
- | |
- | variable not in all patterns
-
-error[E0408]: variable `d` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `d`
- | |
- | variable not in all patterns
-
error[E0408]: variable `e` is not bound in all patterns
--> $DIR/missing-bindings.rs:45:10
|
@@ -143,6 +127,22 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `c`
+ | |
+ | variable not in all patterns
+
+error[E0408]: variable `d` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `d`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:61:29
|
@@ -151,14 +151,6 @@ LL | Ok(a) | Err(_),
| |
| variable not in all patterns
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/missing-bindings.rs:69:21
- |
-LL | A(_, a) |
- | - variable not in all patterns
-LL | B(b),
- | ^^^^ pattern doesn't bind `a`
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:68:21
|
@@ -168,6 +160,14 @@ LL | B(b),
| - variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:69:21
+ |
+LL | A(_, a) |
+ | - variable not in all patterns
+LL | B(b),
+ | ^^^^ pattern doesn't bind `a`
+
+error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:72:17
|
LL | A(_, a) |
@@ -185,6 +185,24 @@ LL | B(b),
LL | B(_)
| ^^^^ pattern doesn't bind `b`
+error[E0408]: variable `b` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:57:13
+ |
+LL | / V1(
+LL | |
+LL | |
+LL | | A(
+... |
+LL | | B(Ok(a) | Err(a))
+LL | | ) |
+ | |_____________^ pattern doesn't bind `b`
+...
+LL | B(b),
+ | - variable not in all patterns
+...
+LL | V3(c),
+ | ^^^^^ pattern doesn't bind `b`
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:57:13
|
@@ -219,24 +237,6 @@ LL | A(_, a) |
LL | V3(c),
| ^^^^^ pattern doesn't bind `a`
-error[E0408]: variable `b` is not bound in all patterns
- --> $DIR/missing-bindings.rs:57:13
- |
-LL | / V1(
-LL | |
-LL | |
-LL | | A(
-... |
-LL | | B(Ok(a) | Err(a))
-LL | | ) |
- | |_____________^ pattern doesn't bind `b`
-...
-LL | B(b),
- | - variable not in all patterns
-...
-LL | V3(c),
- | ^^^^^ pattern doesn't bind `b`
-
error: aborting due to 26 previous errors
For more information about this error, try `rustc --explain E0408`.
diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
index c16a90368..e09194d5d 100644
--- a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
+++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
@@ -2,9 +2,15 @@ error: expected identifier, found `:`
--> $DIR/or-patterns-syntactic-fail.rs:11:19
|
LL | let _ = |A | B: E| ();
- | ^ expected identifier
+ | ---- ^ expected identifier
+ | |
+ | while parsing the body of this closure
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+help: you might have meant to open the body of the closure
+ |
+LL | let _ = |A | { B: E| ();
+ | +
error: top-level or-patterns are not allowed in function parameters
--> $DIR/or-patterns-syntactic-fail.rs:18:13