]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2294-if-let-guard/feature-gate.rs
Auto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk
[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` guards are experimental
9
10         () if (let 0 = 1) => {}
11         //~^ ERROR `let` expressions in this position are experimental
12         //~| ERROR `let` expressions are not supported here
13
14         () if (((let 0 = 1))) => {}
15         //~^ ERROR `let` expressions in this position are experimental
16         //~| ERROR `let` expressions are not supported here
17
18         () if true && let 0 = 1 => {}
19         //~^ ERROR `let` expressions in this position are experimental
20         //~| ERROR `let` expressions are not supported here
21
22         () if let 0 = 1 && true => {}
23         //~^ ERROR `let` expressions in this position are experimental
24         //~| ERROR `let` expressions are not supported here
25
26         () if (let 0 = 1) && true => {}
27         //~^ ERROR `let` expressions in this position are experimental
28         //~| ERROR `let` expressions are not supported here
29
30         () if true && (let 0 = 1) => {}
31         //~^ ERROR `let` expressions in this position are experimental
32         //~| ERROR `let` expressions are not supported here
33
34         () if (let 0 = 1) && (let 0 = 1) => {}
35         //~^ ERROR `let` expressions in this position are experimental
36         //~| ERROR `let` expressions in this position are experimental
37         //~| ERROR `let` expressions are not supported here
38         //~| ERROR `let` expressions are not supported here
39
40         () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
41         //~^ ERROR `let` expressions in this position are experimental
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 are not supported here
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
52         () if let Range { start: _, end: _ } = (true..true) && false => {}
53         //~^ ERROR `let` expressions in this position are experimental
54         //~| ERROR `let` expressions are not supported here
55         _ => {}
56     }
57 }
58
59 fn _macros() {
60     macro_rules! use_expr {
61         ($e:expr) => {
62             match () {
63                 () if $e => {}
64                 _ => {}
65             }
66         }
67     }
68     use_expr!((let 0 = 1 && 0 == 0));
69     //~^ ERROR `let` expressions in this position are experimental
70     //~| ERROR `let` expressions are not supported here
71     use_expr!((let 0 = 1));
72     //~^ ERROR `let` expressions in this position are experimental
73     //~| ERROR `let` expressions are not supported here
74     match () {
75         #[cfg(FALSE)]
76         () if let 0 = 1 => {}
77         //~^ ERROR `if let` guards are experimental
78         _ => {}
79     }
80     use_expr!(let 0 = 1);
81     //~^ ERROR no rules expected the token `let`
82 }
83
84 fn main() {}