]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2294-if-let-guard/feature-gate.rs
Rollup merge of #75837 - GuillaumeGomez:fix-font-color-help-button, r=Cldfire
[rust.git] / src / test / ui / rfc-2294-if-let-guard / feature-gate.rs
1 // gate-test-if_let_guard
2
3 use std::ops::Range;
4
5 fn _if_let_guard() {
6     match () {
7         () if let 0 = 1 => {}
8         //~^ ERROR `if let` guard is not implemented
9         //~| ERROR `let` expressions are not supported here
10
11         () if (let 0 = 1) => {}
12         //~^ ERROR `let` expressions in this position are experimental
13         //~| ERROR `let` expressions are not supported here
14
15         () if (((let 0 = 1))) => {}
16         //~^ ERROR `let` expressions in this position are experimental
17         //~| ERROR `let` expressions are not supported here
18
19         () if true && let 0 = 1 => {}
20         //~^ ERROR `let` expressions in this position are experimental
21         //~| ERROR `let` expressions are not supported here
22
23         () if let 0 = 1 && true => {}
24         //~^ ERROR `let` expressions in this position are experimental
25         //~| ERROR `let` expressions are not supported here
26
27         () if (let 0 = 1) && true => {}
28         //~^ ERROR `let` expressions in this position are experimental
29         //~| ERROR `let` expressions are not supported here
30
31         () if true && (let 0 = 1) => {}
32         //~^ ERROR `let` expressions in this position are experimental
33         //~| ERROR `let` expressions are not supported here
34
35         () if (let 0 = 1) && (let 0 = 1) => {}
36         //~^ ERROR `let` expressions in this position are experimental
37         //~| ERROR `let` expressions in this position are experimental
38         //~| ERROR `let` expressions are not supported here
39         //~| ERROR `let` expressions are not supported here
40
41         () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
42         //~^ ERROR `let` expressions in this position are experimental
43         //~| ERROR `let` expressions in this position are experimental
44         //~| ERROR `let` expressions in this position are experimental
45         //~| ERROR `let` expressions in this position are experimental
46         //~| ERROR `let` expressions in this position are experimental
47         //~| ERROR `let` expressions are not supported here
48         //~| ERROR `let` expressions are not supported here
49         //~| ERROR `let` expressions are not supported here
50         //~| ERROR `let` expressions are not supported here
51         //~| ERROR `let` expressions are not supported here
52
53         () if let Range { start: _, end: _ } = (true..true) && false => {}
54         //~^ ERROR `let` expressions in this position are experimental
55         //~| ERROR `let` expressions are not supported here
56         _ => {}
57     }
58 }
59
60 fn _macros() {
61     macro_rules! use_expr {
62         ($e:expr) => {
63             match () {
64                 () if $e => {}
65                 _ => {}
66             }
67         }
68     }
69     use_expr!((let 0 = 1 && 0 == 0));
70     //~^ ERROR `let` expressions in this position are experimental
71     //~| ERROR `let` expressions are not supported here
72     use_expr!((let 0 = 1));
73     //~^ ERROR `let` expressions in this position are experimental
74     //~| ERROR `let` expressions are not supported here
75     match () {
76         #[cfg(FALSE)]
77         () if let 0 = 1 => {}
78         //~^ ERROR `if let` guard is not implemented
79         _ => {}
80     }
81     use_expr!(let 0 = 1);
82     //~^ ERROR no rules expected the token `let`
83 }
84
85 fn main() {}