<commit_before>#![allow(
    clippy::boxed_local,
    clippy::just_underscores_and_digits,
    clippy::ptr_arg,
    clippy::trivially_copy_pass_by_ref
)]

pub mod module;

use cxx::{CxxString, CxxVector, UniquePtr};
use std::fmt::{self, Display};

mod other {
    use cxx::kind::{Opaque, Trivial};
    use cxx::{type_id, CxxString, ExternType};

    #[repr(C)]
    pub struct D {
        pub d: u64,
    }

    #[repr(C)]
    pub struct E {
        e: u64,
        e_str: CxxString,
    }

    pub mod f {
        use cxx::kind::Opaque;
        use cxx::{type_id, CxxString, ExternType};

        #[repr(C)]
        pub struct F {
            e: u64,
            e_str: CxxString,
        }

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

    #[repr(C)]
    pub struct G {
        pub g: u64,
    }

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

    unsafe impl ExternType for D {
        type Id = type_id!("tests::D");
        type Kind = Trivial;
    }

    unsafe impl ExternType for E {
        type Id = type_id!("tests::E");
        type Kind = Opaque;
    }
}

#[cxx::bridge(namespace = "tests")]
pub mod ffi {
    #[derive(Clone)]
    struct Shared {
        z: usize,
    }

    struct SharedString {
        msg: String,
    }

    enum Enum {
        AVal,
        BVal = 2020,
        CVal,
    }

    #[namespace = "A"]
    #[derive(Clone)]
    struct AShared {
        z: usize,
    }

    #[namespace = "A"]
    enum AEnum {
        AAVal,
        ABVal = 2020,
        ACVal,
    }

    #[namespace = "A::B"]
    enum ABEnum {
        ABAVal,
        ABBVal = 2020,
        ABCVal,
    }

    #[namespace = "A::B"]
    #[derive(Clone)]
    struct ABShared {
        z: usize,
    }

    #[namespace = "first"]
    struct First {
        second: Box<Second>,
    }

    #[namespace = "second"]
    struct Second {
        i: i32,
    }

    unsafe extern "C++" {
        include!("tests/ffi/tests.h");

        type C;

        fn c_return_primitive() -> usize;
        fn c_return_shared() -> Shared;
        fn c_return_box() -> Box<R>;
        fn c_return_unique_ptr() -> UniquePtr<C>;
        fn c_return_ref(shared: &Shared) -> &usize;
        fn c_return_mut(shared: &mut Shared) -> &mut usize;
        fn c_return_str(shared: &Shared) -> &str;
        fn c_return_sliceu8(shared: &Shared) -> &[u8];
        fn c_return_rust_string() -> String;
        fn c_return_unique_ptr_string() -> UniquePtr<CxxString>;
        fn c_return_unique_ptr_vector_u8() -> UniquePtr<CxxVector<u8>>;
        fn c_return_unique_ptr_vector_f64() -> UniquePtr<CxxVector<f64>>;
        fn c_return_unique_ptr_vector_string() -> UniquePtr<CxxVector<CxxString>>;
        fn c_return_unique_ptr_vector_shared() -> UniquePtr<CxxVector<Shared>>;
        fn c_return_unique_ptr_vector_opaque() -> UniquePtr<CxxVector<C>>;
        fn c_return_ref_vector(c: &C) -> &CxxVector<u8>;
        fn c_return_mut_vector(c: Pin<&mut C>) -> Pin<&mut CxxVector<u8>>;<commit_msg>Add failing test of extern enum used as struct field<commit_after>#![allow(
    clippy::boxed_local,
    clippy::just_underscores_and_digits,
    clippy::ptr_arg,
    clippy::trivially_copy_pass_by_ref
)]

pub mod module;

use cxx::{CxxString, CxxVector, UniquePtr};
use std::fmt::{self, Display};

mod other {
    use cxx::kind::{Opaque, Trivial};
    use cxx::{type_id, CxxString, ExternType};

    #[repr(C)]
    pub struct D {
        pub d: u64,
    }

    #[repr(C)]
    pub struct E {
        e: u64,
        e_str: CxxString,
    }

    pub mod f {
        use cxx::kind::Opaque;
        use cxx::{type_id, CxxString, ExternType};

        #[repr(C)]
        pub struct F {
            e: u64,
            e_str: CxxString,
        }

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

    #[repr(C)]
    pub struct G {
        pub g: u64,
    }

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

    unsafe impl ExternType for D {
        type Id = type_id!("tests::D");
        type Kind = Trivial;
    }

    unsafe impl ExternType for E {
        type Id = type_id!("tests::E");
        type Kind = Opaque;
    }
}

#[cxx::bridge(namespace = "tests")]
pub mod ffi {
    #[derive(Clone)]
    struct Shared {
        z: usize,
    }

    struct SharedString {
        msg: String,
    }

    enum Enum {
        AVal,
        BVal = 2020,
        CVal,
    }

    #[namespace = "A"]
    #[derive(Clone)]
    struct AShared {
        z: usize,
    }

    #[namespace = "A"]
    enum AEnum {
        AAVal,
        ABVal = 2020,
        ACVal,
    }

    #[namespace = "A::B"]
    enum ABEnum {
        ABAVal,
        ABBVal = 2020,
        ABCVal,
    }

    #[namespace = "A::B"]
    #[derive(Clone)]
    struct ABShared {
        z: usize,
    }

    #[namespace = "first"]
    struct First {
        second: Box<Second>,
    }

    #[namespace = "second"]
    struct Second {
        i: i32,
        e: COwnedEnum,
    }

    unsafe extern "C++" {
        include!("tests/ffi/tests.h");

        type C;

        fn c_return_primitive() -> usize;
        fn c_return_shared() -> Shared;
        fn c_return_box() -> Box<R>;
        fn c_return_unique_ptr() -> UniquePtr<C>;
        fn c_return_ref(shared: &Shared) -> &usize;
        fn c_return_mut(shared: &mut Shared) -> &mut usize;
        fn c_return_str(shared: &Shared) -> &str;
        fn c_return_sliceu8(shared: &Shared) -> &[u8];
        fn c_return_rust_string() -> String;
        fn c_return_unique_ptr_string() -> UniquePtr<CxxString>;
        fn c_return_unique_ptr_vector_u8() -> UniquePtr<CxxVector<u8>>;
        fn c_return_unique_ptr_vector_f64() -> UniquePtr<CxxVector<f64>>;
        fn c_return_unique_ptr_vector_string() -> UniquePtr<CxxVector<CxxString>>;
        fn c_return_unique_ptr_vector_shared() -> UniquePtr<CxxVector<Shared>>;
        fn c_return_unique_ptr_vector_opaque() -> UniquePtr<CxxVector<C>>;
        fn c_return_ref_vector(c: &C) -> &CxxVector<u8>;
        fn c_return_mut_vector(c: Pin<&mut C>) -> Pin<&mut CxxVector<u8>>;
{'fraction_non_alphanumeric': 0.13537675606641125, 'fraction_numerical': 0.010217113665389528, 'mean_word_length': 2.05609756097561, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2592718', 'n_tokens_mistral': 2293, 'n_tokens_neox': 2253, 'n_words': 482}