]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/sepcomp/sepcomp-statics.rs
Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus
[rust.git] / src / test / run-pass / sepcomp / sepcomp-statics.rs
1 // run-pass
2 #![allow(dead_code)]
3 // ignore-bitrig
4 // compile-flags: -C codegen-units=3
5
6 // Test references to static items across compilation units.
7
8
9 fn pad() -> usize { 0 }
10
11 const ONE: usize = 1;
12
13 mod b {
14     // Separate compilation always switches to the LLVM module with the fewest
15     // instructions.  Make sure we have some instructions in this module so
16     // that `a` and `b` don't go into the same compilation unit.
17     fn pad() -> usize { 0 }
18
19     pub static THREE: usize = ::ONE + ::a::TWO;
20 }
21
22 mod a {
23     fn pad() -> usize { 0 }
24
25     pub const TWO: usize = ::ONE + ::ONE;
26 }
27
28 fn main() {
29     assert_eq!(ONE, 1);
30     assert_eq!(a::TWO, 2);
31     assert_eq!(b::THREE, 3);
32 }