about summary refs log tree commit diff
path: root/tests/run-make/export/disambiguator/libr.rs
blob: b294d5c9e8edc2d3d633d0744eecbee3e58aea03 (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
// `S::<S2>::foo` and `S::<S1>::foo` have same `DefPath` modulo disambiguator.
// `libr.rs` interface may not contain `S::<S1>::foo` as private items aren't
// exportable. We should make sure that original `S::<S2>::foo` and the one
// produced during interface generation have same mangled names.

#![feature(export_stable)]
#![crate_type = "sdylib"]

#[export_stable]
#[repr(C)]
pub struct S<T>(pub T);

struct S1;
pub struct S2;

impl S<S1> {
    extern "C" fn foo() -> i32 {
        1
    }
}

#[export_stable]
impl S<S2> {
    pub extern "C" fn foo() -> i32 {
        2
    }
}