File tree 6 files changed +65
-47
lines changed
6 files changed +65
-47
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/inner-or-pat-2 .rs:6 :54
2
+ --> $DIR/inner-or-pat.rs:38 :54
3
3
|
4
4
LL | match x {
5
5
| - this expression has type `&str`
Original file line number Diff line number Diff line change 1
1
error[E0408]: variable `x` is not bound in all patterns
2
- --> $DIR/inner-or-pat-4 .rs:8 :37
2
+ --> $DIR/inner-or-pat.rs:53 :37
3
3
|
4
4
LL | (x @ "red" | (x @ "blue" | "red")) => {
5
5
| - ^^^^^ pattern doesn't bind `x`
Original file line number Diff line number Diff line change 1
- // run-pass
1
+ // revisions: or1 or2 or3 or4 or5
2
+ // [or1] run-pass
3
+ // [or2] run-pass
4
+ // [or5] run-pass
2
5
3
- #[ allow( unused_variables) ]
4
- #[ allow( unused_parens) ]
5
- fn main ( ) {
6
+ #![ allow( unreachable_patterns) ]
7
+ #![ allow( unused_variables) ]
8
+ #![ allow( unused_parens) ]
9
+ #![ allow( dead_code) ]
10
+
11
+
12
+
13
+ fn foo ( ) {
6
14
let x = "foo" ;
7
15
match x {
8
16
x @ ( ( ( "h" | "ho" | "yo" | ( "dude" | "w" ) ) | "no" | "nop" ) | ( "hey" | "gg" ) ) |
@@ -12,3 +20,54 @@ fn main() {
12
20
_ => ( ) ,
13
21
}
14
22
}
23
+
24
+ fn bar ( ) {
25
+ let x = "foo" ;
26
+ match x {
27
+ x @ ( "foo" | "bar" ) |
28
+ ( x @ "red" | ( x @ "blue" | x @ "red" ) ) => {
29
+ }
30
+ _ => ( ) ,
31
+ }
32
+ }
33
+
34
+ #[ cfg( or3) ]
35
+ fn zot ( ) {
36
+ let x = "foo" ;
37
+ match x {
38
+ x @ ( ( ( "h" | "ho" | "yo" | ( "dude" | "w" ) ) | ( ) | "nop" ) | ( "hey" | "gg" ) ) |
39
+ //[or3]~^ ERROR mismatched types
40
+ x @ ( "black" | "pink" ) |
41
+ x @ ( "red" | "blue" ) => {
42
+ }
43
+ _ => ( ) ,
44
+ }
45
+ }
46
+
47
+
48
+ #[ cfg( or4) ]
49
+ fn hey ( ) {
50
+ let x = "foo" ;
51
+ match x {
52
+ x @ ( "foo" | "bar" ) |
53
+ ( x @ "red" | ( x @ "blue" | "red" ) ) => {
54
+ //[or4]~^ variable `x` is not bound in all patterns
55
+ }
56
+ _ => ( ) ,
57
+ }
58
+ }
59
+
60
+ fn don ( ) {
61
+ enum Foo {
62
+ A ,
63
+ B ,
64
+ C ,
65
+ }
66
+
67
+ match Foo :: A {
68
+ | _foo @ ( Foo :: A | Foo :: B ) => { }
69
+ Foo :: C => { }
70
+ } ;
71
+ }
72
+
73
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments