]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | #![feature(or_patterns)] |
dfeec247 XL |
2 | |
3 | const fn foo((Ok(a) | Err(a)): Result<i32, i32>) { | |
4 | //~^ ERROR or-pattern is not allowed in a `const fn` | |
5 | let x = Ok(3); | |
6 | let Ok(y) | Err(y) = x; | |
7 | //~^ ERROR or-pattern is not allowed in a `const fn` | |
8 | } | |
9 | ||
10 | const X: () = { | |
11 | let x = Ok(3); | |
12 | let Ok(y) | Err(y) = x; | |
13 | //~^ ERROR or-pattern is not allowed in a `const` | |
14 | }; | |
15 | ||
16 | static Y: () = { | |
17 | let x = Ok(3); | |
18 | let Ok(y) | Err(y) = x; | |
19 | //~^ ERROR or-pattern is not allowed in a `static` | |
20 | }; | |
21 | ||
22 | static mut Z: () = { | |
23 | let x = Ok(3); | |
24 | let Ok(y) | Err(y) = x; | |
25 | //~^ ERROR or-pattern is not allowed in a `static mut` | |
26 | }; | |
27 | ||
28 | fn main() { | |
29 | let _: [(); { | |
30 | let x = Ok(3); | |
31 | let Ok(y) | Err(y) = x; | |
32 | //~^ ERROR or-pattern is not allowed in a `const` | |
33 | 2 | |
34 | }]; | |
35 | } |