summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lto/weak-works.rs
blob: 163a3870248ff4ea356c7eaf4b757f2433e1d1a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// run-pass

// compile-flags: -C codegen-units=8 -Z thinlto
// ignore-windows

#![feature(linkage)]

pub mod foo {
    #[linkage = "weak"]
    #[no_mangle]
    pub extern "C" fn FOO() -> i32 {
        0
    }
}

mod bar {
    extern "C" {
        fn FOO() -> i32;
    }

    pub fn bar() -> i32 {
        unsafe { FOO() }
    }
}

fn main() {
    bar::bar();
}