diff options
22 files changed, 58 insertions, 52 deletions
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs index 75d65bca..0332c50e 100644 --- a/tests/expectations/tests/class.rs +++ b/tests/expectations/tests/class.rs @@ -141,7 +141,7 @@ impl Default for C_with_zero_length_array_and_incomplete_array { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Hash)] +#[derive(Debug, Default, Hash, PartialEq)] pub struct WithDtor { pub b: ::std::os::raw::c_int, } @@ -229,7 +229,7 @@ impl Default for WithUnion { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct RealAbstractionWithTonsOfMethods { pub _address: u8, } diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs index b628ab11..21399a49 100644 --- a/tests/expectations/tests/class_1_0.rs +++ b/tests/expectations/tests/class_1_0.rs @@ -64,6 +64,9 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { impl <T> ::std::hash::Hash for __BindgenUnionField<T> { fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } } +impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { + fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } +} #[repr(C)] #[derive(Copy)] pub struct C { @@ -168,7 +171,7 @@ impl Default for C_with_zero_length_array_and_incomplete_array { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Hash)] +#[derive(Debug, Default, Hash, PartialEq)] pub struct WithDtor { pub b: ::std::os::raw::c_int, } @@ -203,7 +206,7 @@ impl Default for IncompleteArrayNonCopiable { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct Union { pub d: __BindgenUnionField<f32>, pub i: __BindgenUnionField<::std::os::raw::c_int>, @@ -230,7 +233,7 @@ impl Clone for Union { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct WithUnion { pub data: Union, } @@ -250,7 +253,7 @@ impl Clone for WithUnion { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct RealAbstractionWithTonsOfMethods { pub _address: u8, } diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index 4172d467..dc40fd06 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A { pub member_a: ::std::os::raw::c_int, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A_B { pub member_b: ::std::os::raw::c_int, } @@ -30,7 +30,7 @@ impl Clone for A_B { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A_C { pub baz: ::std::os::raw::c_int, } @@ -50,7 +50,7 @@ impl Clone for A_C { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash)] +#[derive(Debug, Copy, Clone, Hash, PartialEq)] pub struct A_D<T> { pub foo: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -93,7 +93,7 @@ extern "C" { pub static mut baz: A_D<::std::os::raw::c_int>; } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct D { pub member: A_B, } @@ -113,13 +113,13 @@ impl Clone for D { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash)] +#[derive(Debug, Copy, Clone, Hash, PartialEq)] pub struct Templated<T> { pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash)] +#[derive(Debug, Copy, Clone, Hash, PartialEq)] pub struct Templated_Templated_inner<T> { pub member_ptr: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs index e78964fe..4eb883d9 100644 --- a/tests/expectations/tests/class_no_members.rs +++ b/tests/expectations/tests/class_no_members.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct whatever { pub _address: u8, } @@ -20,7 +20,7 @@ impl Clone for whatever { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct whatever_child { pub _address: u8, } @@ -35,7 +35,7 @@ impl Clone for whatever_child { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct whatever_child_with_member { pub m_member: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs index 97dcbf79..703fa072 100644 --- a/tests/expectations/tests/class_static.rs +++ b/tests/expectations/tests/class_static.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct MyClass { pub _address: u8, } diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs index a599ed89..27e5b645 100644 --- a/tests/expectations/tests/class_static_const.rs +++ b/tests/expectations/tests/class_static_const.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A { pub _address: u8, } diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs index a8d26d29..c721f1ae 100644 --- a/tests/expectations/tests/class_use_as.rs +++ b/tests/expectations/tests/class_use_as.rs @@ -6,7 +6,7 @@ /// <div rustbindgen="true" replaces="whatever"></div> #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct whatever { pub replacement: ::std::os::raw::c_int, } @@ -26,7 +26,7 @@ impl Clone for whatever { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct container { pub c: whatever, } diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs index 8686c41c..0ef190a9 100644 --- a/tests/expectations/tests/class_with_dtor.rs +++ b/tests/expectations/tests/class_with_dtor.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Hash)] +#[derive(Debug, Hash, PartialEq)] pub struct HandleWithDtor<T> { pub ptr: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -15,7 +15,7 @@ impl <T> Default for HandleWithDtor<T> { } pub type HandleValue = HandleWithDtor<::std::os::raw::c_int>; #[repr(C)] -#[derive(Debug, Hash)] +#[derive(Debug, Hash, PartialEq)] pub struct WithoutDtor { pub shouldBeWithDtor: HandleValue, } diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs index 683f5c09..7cc0024f 100644 --- a/tests/expectations/tests/class_with_inner_struct.rs +++ b/tests/expectations/tests/class_with_inner_struct.rs @@ -12,7 +12,7 @@ pub struct A { pub __bindgen_anon_1: A__bindgen_ty_2, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -108,12 +108,12 @@ impl Default for A { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct B { pub d: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct B_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -174,7 +174,7 @@ pub union C__bindgen_ty_1 { _bindgen_union_align: [u32; 4usize], } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct C__bindgen_ty_1__bindgen_ty_1 { pub mX1: f32, pub mY1: f32, @@ -219,7 +219,7 @@ impl Clone for C__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq)] pub struct C__bindgen_ty_1__bindgen_ty_2 { pub mStepSyntax: StepSyntax, pub mSteps: ::std::os::raw::c_uint, @@ -271,7 +271,7 @@ impl Default for C__bindgen_ty_1 { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct C_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs index 4ccafab4..aa4bc2f0 100644 --- a/tests/expectations/tests/class_with_inner_struct_1_0.rs +++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs @@ -31,15 +31,18 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { impl <T> ::std::hash::Hash for __BindgenUnionField<T> { fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } } +impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { + fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } +} #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A { pub c: ::std::os::raw::c_uint, pub named_union: A__bindgen_ty_1, pub __bindgen_anon_1: A__bindgen_ty_2, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -65,7 +68,7 @@ impl Clone for A_Segment { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A__bindgen_ty_1 { pub f: __BindgenUnionField<::std::os::raw::c_int>, pub bindgen_union_field: u32, @@ -86,7 +89,7 @@ impl Clone for A__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct A__bindgen_ty_2 { pub d: __BindgenUnionField<::std::os::raw::c_int>, pub bindgen_union_field: u32, @@ -126,12 +129,12 @@ impl Clone for A { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct B { pub d: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct B_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -179,20 +182,20 @@ pub enum StepSyntax { FunctionalWithEndKeyword = 3, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct C { pub d: ::std::os::raw::c_uint, pub __bindgen_anon_1: C__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct C__bindgen_ty_1 { pub mFunc: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_1>, pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_2>, pub bindgen_union_field: [u32; 4usize], } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct C__bindgen_ty_1__bindgen_ty_1 { pub mX1: f32, pub mY1: f32, @@ -237,7 +240,7 @@ impl Clone for C__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq)] pub struct C__bindgen_ty_1__bindgen_ty_2 { pub mStepSyntax: StepSyntax, pub mSteps: ::std::os::raw::c_uint, @@ -286,7 +289,7 @@ impl Clone for C__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash)] +#[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct C_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs index f41aa228..053bc06b 100644 --- a/tests/expectations/tests/class_with_typedef.rs +++ b/tests/expectations/tests/class_with_typedef.rs @@ -6,7 +6,7 @@ pub type AnotherInt = ::std::os::raw::c_int; #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq)] pub struct C { pub c: C_MyInt, pub ptr: *mut C_MyInt, @@ -85,7 +85,7 @@ impl C { } } #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq)] pub struct D { pub _base: C, pub ptr: *mut C_MyInt, diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp index 3e183cdf..c8c041dc 100644 --- a/tests/headers/class.hpp +++ b/tests/headers/class.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq // class C { int a; diff --git a/tests/headers/class_1_0.hpp b/tests/headers/class_1_0.hpp index 9f4795b6..7400a2a5 100644 --- a/tests/headers/class_1_0.hpp +++ b/tests/headers/class_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq class C { int a; diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp index e01fc947..09213576 100644 --- a/tests/headers/class_nested.hpp +++ b/tests/headers/class_nested.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq class A { public: int member_a; diff --git a/tests/headers/class_no_members.hpp b/tests/headers/class_no_members.hpp index 03f916a9..4c80f7f8 100644 --- a/tests/headers/class_no_members.hpp +++ b/tests/headers/class_no_members.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq // bindgen-flags: -- -std=c++11 class whatever { diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp index 1e38e5a5..18660132 100644 --- a/tests/headers/class_static.hpp +++ b/tests/headers/class_static.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq class MyClass { public: static const int* example; diff --git a/tests/headers/class_static_const.hpp b/tests/headers/class_static_const.hpp index 92599183..7742c782 100644 --- a/tests/headers/class_static_const.hpp +++ b/tests/headers/class_static_const.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq using int32_t = int; typedef unsigned int uint32_t; diff --git a/tests/headers/class_use_as.hpp b/tests/headers/class_use_as.hpp index 6924255d..267185c7 100644 --- a/tests/headers/class_use_as.hpp +++ b/tests/headers/class_use_as.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq /** * <div rustbindgen="true" replaces="whatever"></div> diff --git a/tests/headers/class_with_dtor.hpp b/tests/headers/class_with_dtor.hpp index 9cc2bad4..42374c47 100644 --- a/tests/headers/class_with_dtor.hpp +++ b/tests/headers/class_with_dtor.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq template <typename T> diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp index 781a01db..c50cfa2b 100644 --- a/tests/headers/class_with_inner_struct.hpp +++ b/tests/headers/class_with_inner_struct.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq // bindgen-flags: -- -std=c++11 class A { diff --git a/tests/headers/class_with_inner_struct_1_0.hpp b/tests/headers/class_with_inner_struct_1_0.hpp index d5fe0723..86338b06 100644 --- a/tests/headers/class_with_inner_struct_1_0.hpp +++ b/tests/headers/class_with_inner_struct_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq // bindgen-flags: -- -std=c++11 class A { diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp index 7abb6f77..df2afb98 100644 --- a/tests/headers/class_with_typedef.hpp +++ b/tests/headers/class_with_typedef.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq typedef int AnotherInt; class C { |