summaryrefslogtreecommitdiffstats
path: root/tests/rust/forward_declaration.rs
blob: e97b63e51a6e63bacd5129a1b8baec001ce79bbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#[repr(C)]
struct TypeInfo {
    data: TypeData,
}

#[repr(C)]
enum TypeData {
    Primitive,
    Struct(StructInfo),
}

#[repr(C)]
struct StructInfo {
    fields: *const *const TypeInfo, // requires forward declaration
    num_fields: usize,
}

#[no_mangle]
pub extern "C" fn root(
    x: TypeInfo,
) {}