]> git.proxmox.com Git - rustc.git/blob - src/test/ui/abi/auxiliary/foreign_lib.rs
Update (un)suspicious files
[rustc.git] / src / test / ui / abi / auxiliary / foreign_lib.rs
1 #![crate_name = "foreign_lib"]
2 #![feature(rustc_private)]
3
4 pub mod rustrt {
5 extern crate libc;
6
7 #[link(name = "rust_test_helpers", kind = "static")]
8 extern "C" {
9 pub fn rust_get_test_int() -> libc::intptr_t;
10 }
11 }
12
13 pub mod rustrt2 {
14 extern crate libc;
15
16 extern "C" {
17 pub fn rust_get_test_int() -> libc::intptr_t;
18 }
19 }
20
21 pub mod rustrt3 {
22 // Different type, but same ABI (on all supported platforms).
23 // Ensures that we don't ICE or trigger LLVM asserts when
24 // importing the same symbol under different types.
25 // See https://github.com/rust-lang/rust/issues/32740.
26 extern "C" {
27 pub fn rust_get_test_int() -> *const u8;
28 }
29 }
30
31 pub fn local_uses() {
32 unsafe {
33 let x = rustrt::rust_get_test_int();
34 assert_eq!(x, rustrt2::rust_get_test_int());
35 assert_eq!(x as *const _, rustrt3::rust_get_test_int());
36 }
37 }