]> git.proxmox.com Git - rustc.git/blob - src/test/ui/sepcomp/sepcomp-extern.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / sepcomp / sepcomp-extern.rs
1 // run-pass
2 // compile-flags: -C codegen-units=3
3 // aux-build:sepcomp-extern-lib.rs
4
5 // Test accessing external items from multiple compilation units.
6
7 extern crate sepcomp_extern_lib;
8
9 extern {
10 fn foo() -> usize;
11 }
12
13 fn call1() -> usize {
14 unsafe { foo() }
15 }
16
17 mod a {
18 pub fn call2() -> usize {
19 unsafe { ::foo() }
20 }
21 }
22
23 mod b {
24 pub fn call3() -> usize {
25 unsafe { ::foo() }
26 }
27 }
28
29 fn main() {
30 assert_eq!(call1(), 1234);
31 assert_eq!(a::call2(), 1234);
32 assert_eq!(b::call3(), 1234);
33 }