]> git.lizzy.rs Git - rust.git/blob - src/test/ui/sepcomp/sepcomp-extern.rs
Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup
[rust.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 "C" {
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 }