aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/slice_of_type_alias.rs
blob: a7bbc11479ead58829003bacffb9cb5ed82909b3 (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
29
30
use cxx::{type_id, ExternType};

#[repr(C)]
struct ElementTrivial(usize);

#[repr(C)]
struct ElementOpaque(usize);

#[cxx::bridge]
mod ffi {
    unsafe extern "C++" {
        type ElementTrivial = crate::ElementTrivial;
        type ElementOpaque = crate::ElementOpaque;

        fn f(slice: &mut [ElementTrivial]);
        fn g(slice: &[ElementOpaque]);
    }
}

unsafe impl ExternType for ElementTrivial {
    type Id = type_id!("ElementTrivial");
    type Kind = cxx::kind::Trivial;
}

unsafe impl ExternType for ElementOpaque {
    type Id = type_id!("ElementOpaque");
    type Kind = cxx::kind::Opaque;
}

fn main() {}