]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
1a4d82fc JJ |
3 | // compile-flags: -C codegen-units=3 |
4 | ||
5 | // Test references to static items across compilation units. | |
6 | ||
1a4d82fc | 7 | |
c34b1796 AL |
8 | fn pad() -> usize { 0 } |
9 | ||
10 | const ONE: usize = 1; | |
1a4d82fc JJ |
11 | |
12 | mod b { | |
13 | // Separate compilation always switches to the LLVM module with the fewest | |
14 | // instructions. Make sure we have some instructions in this module so | |
15 | // that `a` and `b` don't go into the same compilation unit. | |
c34b1796 | 16 | fn pad() -> usize { 0 } |
1a4d82fc | 17 | |
c34b1796 | 18 | pub static THREE: usize = ::ONE + ::a::TWO; |
1a4d82fc JJ |
19 | } |
20 | ||
21 | mod a { | |
c34b1796 | 22 | fn pad() -> usize { 0 } |
1a4d82fc | 23 | |
c34b1796 | 24 | pub const TWO: usize = ::ONE + ::ONE; |
1a4d82fc JJ |
25 | } |
26 | ||
27 | fn main() { | |
28 | assert_eq!(ONE, 1); | |
29 | assert_eq!(a::TWO, 2); | |
30 | assert_eq!(b::THREE, 3); | |
31 | } |