summaryrefslogtreecommitdiffstats
path: root/tests/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs
blob: c1df9ccef22737772036b1e2e11847fa421936c4 (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
// build-fail
// FIXME(#83838) codegen-units=1 triggers llvm asserts
// compile-flags: -Ccodegen-units=16
#![feature(linkage)]

mod dep1 {
    extern "C" {
        #[linkage = "external"]
        #[no_mangle]
        pub static collision: *const i32; //~ ERROR symbol `collision` is already defined
    }
}

#[no_mangle]
pub static _rust_extern_with_linkage_collision: i32 = 0;

mod dep2 {
    #[no_mangle]
    pub static collision: usize = 0;
}

fn main() {
    unsafe {
        println!("{:p}", &dep1::collision);
    }
}