]> git.proxmox.com Git - rustc.git/blame - src/test/ui/sepcomp/sepcomp-statics.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / sepcomp / sepcomp-statics.rs
CommitLineData
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
8fn pad() -> usize { 0 }
9
10const ONE: usize = 1;
1a4d82fc
JJ
11
12mod 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
21mod a {
c34b1796 22 fn pad() -> usize { 0 }
1a4d82fc 23
c34b1796 24 pub const TWO: usize = ::ONE + ::ONE;
1a4d82fc
JJ
25}
26
27fn main() {
28 assert_eq!(ONE, 1);
29 assert_eq!(a::TWO, 2);
30 assert_eq!(b::THREE, 3);
31}