]>
Commit | Line | Data |
---|---|---|
83c7162d XL |
1 | // ignore-tidy-linelength |
2 | ||
a7813a04 XL |
3 | const bad : u32 = { |
4 | { | |
94b46f34 | 5 | 5; |
a7813a04 XL |
6 | 0 |
7 | } | |
8 | }; | |
9 | ||
10 | const bad_two : u32 = { | |
11 | { | |
12 | invalid(); | |
0731742a | 13 | //~^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants |
a7813a04 XL |
14 | 0 |
15 | } | |
16 | }; | |
17 | ||
18 | const bad_three : u32 = { | |
19 | { | |
20 | valid(); | |
a7813a04 XL |
21 | 0 |
22 | } | |
23 | }; | |
24 | ||
25 | static bad_four : u32 = { | |
26 | { | |
94b46f34 | 27 | 5; |
a7813a04 XL |
28 | 0 |
29 | } | |
30 | }; | |
31 | ||
32 | static bad_five : u32 = { | |
33 | { | |
34 | invalid(); | |
94b46f34 | 35 | //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants |
a7813a04 XL |
36 | 0 |
37 | } | |
38 | }; | |
39 | ||
40 | static bad_six : u32 = { | |
41 | { | |
42 | valid(); | |
a7813a04 XL |
43 | 0 |
44 | } | |
45 | }; | |
46 | ||
47 | static mut bad_seven : u32 = { | |
48 | { | |
94b46f34 | 49 | 5; |
a7813a04 XL |
50 | 0 |
51 | } | |
52 | }; | |
53 | ||
54 | static mut bad_eight : u32 = { | |
55 | { | |
56 | invalid(); | |
0731742a | 57 | //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants |
a7813a04 XL |
58 | 0 |
59 | } | |
60 | }; | |
61 | ||
62 | static mut bad_nine : u32 = { | |
63 | { | |
64 | valid(); | |
a7813a04 XL |
65 | 0 |
66 | } | |
67 | }; | |
68 | ||
69 | ||
70 | fn invalid() {} | |
71 | const fn valid() {} | |
72 | ||
73 | fn main() {} |