]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-32829-2.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-32829-2.rs
CommitLineData
83c7162d
XL
1// ignore-tidy-linelength
2
a7813a04
XL
3const bad : u32 = {
4 {
94b46f34 5 5;
a7813a04
XL
6 0
7 }
8};
9
10const 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
18const bad_three : u32 = {
19 {
20 valid();
a7813a04
XL
21 0
22 }
23};
24
25static bad_four : u32 = {
26 {
94b46f34 27 5;
a7813a04
XL
28 0
29 }
30};
31
32static 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
40static bad_six : u32 = {
41 {
42 valid();
a7813a04
XL
43 0
44 }
45};
46
47static mut bad_seven : u32 = {
48 {
94b46f34 49 5;
a7813a04
XL
50 0
51 }
52};
53
54static 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
62static mut bad_nine : u32 = {
63 {
64 valid();
a7813a04
XL
65 0
66 }
67};
68
69
70fn invalid() {}
71const fn valid() {}
72
73fn main() {}