]> git.lizzy.rs Git - rust.git/blob - src/test/ui/or-patterns/multiple-pattern-typo.rs
Rollup merge of #80269 - pickfire:patch-4, r=joshtriplett
[rust.git] / src / test / ui / or-patterns / multiple-pattern-typo.rs
1 //! Test for `||` in or-patterns
2
3 fn main() {
4     let x = 3;
5
6     match x {
7         1 | 2 || 3 => (), //~ ERROR unexpected token `||` in pattern
8         _ => (),
9     }
10
11     match x {
12         (1 | 2 || 3) => (), //~ ERROR unexpected token `||` in pattern
13         _ => (),
14     }
15
16     match (x,) {
17         (1 | 2 || 3,) => (), //~ ERROR unexpected token `||` in pattern
18         _ => (),
19     }
20
21     struct TS(u8);
22
23     match TS(x) {
24         TS(1 | 2 || 3) => (), //~ ERROR unexpected token `||` in pattern
25         _ => (),
26     }
27
28     struct NS { f: u8 }
29
30     match (NS { f: x }) {
31         NS { f: 1 | 2 || 3 } => (), //~ ERROR unexpected token `||` in pattern
32         _ => (),
33     }
34
35     match [x] {
36         [1 | 2 || 3] => (), //~ ERROR unexpected token `||` in pattern
37         _ => (),
38     }
39
40     match x {
41         || 1 | 2 | 3 => (), //~ ERROR unexpected token `||` in pattern
42         _ => (),
43     }
44 }