1 // gate-test-let_chains
3 // Here we test feature gating for ´let_chains`.
4 // See `disallowed-positions.rs` for the grammar
5 // defining the language for gated allowed positions.
7 #![allow(irrefutable_let_patterns)]
12 if let 0 = 1 {} // Stable!
14 if true && let 0 = 1 {}
15 //~^ ERROR `let` expressions in this position are unstable [E0658]
17 if let 0 = 1 && true {}
18 //~^ ERROR `let` expressions in this position are unstable [E0658]
20 if let Range { start: _, end: _ } = (true..true) && false {}
21 //~^ ERROR `let` expressions in this position are unstable [E0658]
23 if let 1 = 1 && let true = { true } && false {
24 //~^ ERROR `let` expressions in this position are unstable [E0658]
25 //~| ERROR `let` expressions in this position are unstable [E0658]
30 while let 0 = 1 {} // Stable!
32 while true && let 0 = 1 {}
33 //~^ ERROR `let` expressions in this position are unstable [E0658]
35 while let 0 = 1 && true {}
36 //~^ ERROR `let` expressions in this position are unstable [E0658]
38 while let Range { start: _, end: _ } = (true..true) && false {}
39 //~^ ERROR `let` expressions in this position are unstable [E0658]
43 macro_rules! noop_expr { ($e:expr) => {}; }
45 noop_expr!((let 0 = 1));
46 //~^ ERROR `let` expressions in this position are unstable [E0658]
47 //~| ERROR expected expression, found `let` statement
49 macro_rules! use_expr {
55 #[cfg(FALSE)] (let 0 = 1);
56 //~^ ERROR `let` expressions in this position are unstable [E0658]
57 //~| ERROR expected expression, found `let` statement
59 //~^ ERROR no rules expected the token `let`