]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/rest-pat-syntactic.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / pattern / rest-pat-syntactic.rs
1 // Here we test that `..` is allowed in all pattern locations *syntactically*.
2 // The semantic test is in `rest-pat-semantic-disallowed.rs`.
3
4 // check-pass
5
6 fn main() {}
7
8 macro_rules! accept_pat {
9 ($p:pat) => {}
10 }
11
12 accept_pat!(..);
13
14 #[cfg(FALSE)]
15 fn rest_patterns() {
16 // Top level:
17 fn foo(..: u8) {}
18 let ..;
19
20 // Box patterns:
21 let box ..;
22 //~^ WARN box pattern syntax is experimental
23 //~| WARN unstable syntax
24
25 // In or-patterns:
26 match x {
27 .. | .. => {}
28 }
29
30 // Ref patterns:
31 let &..;
32 let &mut ..;
33
34 // Ident patterns:
35 let x @ ..;
36 let ref x @ ..;
37 let ref mut x @ ..;
38
39 // Tuple:
40 let (..); // This is interpreted as a tuple pattern, not a parenthesis one.
41 let (..,); // Allowing trailing comma.
42 let (.., .., ..); // Duplicates also.
43 let (.., P, ..); // Including with things in between.
44
45 // Tuple struct (same idea as for tuple patterns):
46 let A(..);
47 let A(..,);
48 let A(.., .., ..);
49 let A(.., P, ..);
50
51 // Array/Slice (like with tuple patterns):
52 let [..];
53 let [..,];
54 let [.., .., ..];
55 let [.., P, ..];
56
57 // Random walk to guard against special casing:
58 match x {
59 .. |
60 [
61 (
62 box .., //~ WARN box pattern syntax is experimental
63 &(..),
64 &mut ..,
65 x @ ..
66 ),
67 ref x @ ..,
68 ] |
69 ref mut x @ ..
70 => {}
71 }
72 //~| WARN unstable syntax
73 }