]> git.proxmox.com Git - rustc.git/blob - src/test/ui/sepcomp/sepcomp-fns-backwards.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / sepcomp / sepcomp-fns-backwards.rs
1 // run-pass
2 #![allow(dead_code)]
3 // compile-flags: -C codegen-units=3
4
5 // Test references to items that haven't been codegened yet.
6
7 // Generate some code in the first compilation unit before declaring any
8 // modules. This ensures that the first module doesn't go into the same
9 // compilation unit as the top-level module.
10
11 fn pad() -> usize { 0 }
12
13 mod b {
14 pub fn three() -> usize {
15 ::one() + ::a::two()
16 }
17 }
18
19 mod a {
20 pub fn two() -> usize {
21 ::one() + ::one()
22 }
23 }
24
25 fn one() -> usize {
26 1
27 }
28
29 fn main() {
30 assert_eq!(one(), 1);
31 assert_eq!(a::two(), 2);
32 assert_eq!(b::three(), 3);
33 }