]> git.proxmox.com Git - rustc.git/blame - src/test/ui/sepcomp/sepcomp-fns-backwards.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / sepcomp / sepcomp-fns-backwards.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(dead_code)]
1a4d82fc
JJ
3// compile-flags: -C codegen-units=3
4
94b46f34 5// Test references to items that haven't been codegened yet.
1a4d82fc
JJ
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.
c34b1796
AL
10
11fn pad() -> usize { 0 }
1a4d82fc
JJ
12
13mod b {
c34b1796 14 pub fn three() -> usize {
1a4d82fc
JJ
15 ::one() + ::a::two()
16 }
17}
18
19mod a {
c34b1796 20 pub fn two() -> usize {
1a4d82fc
JJ
21 ::one() + ::one()
22 }
23}
24
c34b1796 25fn one() -> usize {
1a4d82fc
JJ
26 1
27}
28
29fn main() {
30 assert_eq!(one(), 1);
31 assert_eq!(a::two(), 2);
32 assert_eq!(b::three(), 3);
33}