]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/item-collection/statics-and-consts.rs
Auto merge of #104535 - mikebenfield:discr-fix, r=pnkfelix
[rust.git] / src / test / codegen-units / item-collection / statics-and-consts.rs
1 // compile-flags:-Zprint-mono-items=eager
2
3 #![deny(dead_code)]
4 #![feature(start)]
5
6 static STATIC1: i64 = {
7     const STATIC1_CONST1: i64 = 2;
8     1 + CONST1 as i64 + STATIC1_CONST1
9 };
10
11 const CONST1: i64 = {
12     const CONST1_1: i64 = {
13         const CONST1_1_1: i64 = 2;
14         CONST1_1_1 + 1
15     };
16     1 + CONST1_1 as i64
17 };
18
19 fn foo() {
20     let _ = {
21         const CONST2: i64 = 0;
22         static STATIC2: i64 = CONST2;
23
24         let x = {
25             const CONST2: i64 = 1;
26             static STATIC2: i64 = CONST2;
27             STATIC2
28         };
29
30         x + STATIC2
31     };
32
33     let _ = {
34         const CONST2: i64 = 0;
35         static STATIC2: i64 = CONST2;
36         STATIC2
37     };
38 }
39
40 //~ MONO_ITEM fn start
41 #[start]
42 fn start(_: isize, _: *const *const u8) -> isize {
43     foo();
44     let _ = STATIC1;
45
46     0
47 }
48
49 //~ MONO_ITEM static STATIC1
50
51 //~ MONO_ITEM fn foo
52 //~ MONO_ITEM static foo::STATIC2
53 //~ MONO_ITEM static foo::STATIC2
54 //~ MONO_ITEM static foo::STATIC2