]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/auxiliary/linkage-visibility.rs
Rollup merge of #70103 - GuillaumeGomez:cleanup-e0437, r=Dylan-DPC
[rust.git] / src / test / ui-fulldeps / auxiliary / linkage-visibility.rs
1 // ignore-musl - dlsym doesn't see symbols without "-C link-arg=-Wl,--export-dynamic"
2
3 #![feature(rustc_private)]
4
5 extern crate rustc_metadata;
6
7 use rustc_metadata::dynamic_lib::DynamicLibrary;
8
9 #[no_mangle]
10 pub fn foo() {
11     bar();
12 }
13
14 pub fn foo2<T>() {
15     fn bar2() {
16         bar();
17     }
18     bar2();
19 }
20
21 #[no_mangle]
22 fn bar() {}
23
24 #[allow(dead_code)]
25 #[no_mangle]
26 fn baz() {}
27
28 pub fn test() {
29     let lib = DynamicLibrary::open(None).unwrap();
30     unsafe {
31         assert!(lib.symbol::<isize>("foo").is_ok());
32         assert!(lib.symbol::<isize>("baz").is_ok());
33         assert!(lib.symbol::<isize>("bar").is_ok());
34     }
35 }