diff options
11 files changed, 49 insertions, 31 deletions
diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs index 332c1129..da1d2b41 100644 --- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs +++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs @@ -5,14 +5,14 @@ -/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq. +/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partialeq and partialord #[repr(C)] -#[derive(Debug, Default, Copy, PartialEq)] +#[derive(Debug, Default, Copy, PartialOrd, PartialEq)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, PartialEq)] +#[derive(Debug, Default, Copy, PartialOrd, PartialEq)] pub struct foo__bindgen_ty_1 { pub a: f32, pub b: f32, diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs index 43075796..a14a0829 100644 --- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs @@ -5,9 +5,9 @@ -/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq. +/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq and partialord #[repr(C)] -#[derive(Debug, Default, Copy, PartialEq)] +#[derive(Debug, Default, Copy, PartialOrd, PartialEq)] pub struct foo { pub bar: [f32; 3usize], } diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs index 28aa1e25..664a19da 100644 --- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs +++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs @@ -5,9 +5,9 @@ -/// Pointers can derive hash/PartialEq/Eq +/// Pointers can derive Hash/PartialOrd/PartialEq/Eq #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Hash, PartialOrd, PartialEq, Eq)] pub struct ConstPtrMutObj { pub bar: *const ::std::os::raw::c_int, } @@ -45,7 +45,7 @@ impl Default for ConstPtrMutObj { } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Hash, PartialOrd, PartialEq, Eq)] pub struct MutPtrMutObj { pub bar: *mut ::std::os::raw::c_int, } @@ -83,7 +83,7 @@ impl Default for MutPtrMutObj { } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Hash, PartialOrd, PartialEq, Eq)] pub struct MutPtrConstObj { pub bar: *const ::std::os::raw::c_int, } @@ -121,7 +121,7 @@ impl Default for MutPtrConstObj { } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Hash, PartialOrd, PartialEq, Eq)] pub struct ConstPtrConstObj { pub bar: *const ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/derive-hash-template-def-float.rs b/tests/expectations/tests/derive-hash-template-def-float.rs index 7b643901..d882f99d 100644 --- a/tests/expectations/tests/derive-hash-template-def-float.rs +++ b/tests/expectations/tests/derive-hash-template-def-float.rs @@ -5,9 +5,9 @@ -/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq. +/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq and partialord. #[repr(C)] -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] pub struct foo<T> { pub data: T, pub b: f32, diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs index 7bca45b3..7f79af3e 100644 --- a/tests/expectations/tests/derive-hash-template-inst-float.rs +++ b/tests/expectations/tests/derive-hash-template-inst-float.rs @@ -5,9 +5,9 @@ -/// Template definition that doesn't contain float can derive hash/partialeq/eq +/// Template definition that doesn't contain float can derive hash/partialord/partialeq/eq #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Eq)] pub struct foo<T> { pub data: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -19,7 +19,7 @@ impl<T> Default for foo<T> { } /// Can derive hash/partialeq/eq when instantiated with int #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq, Eq)] +#[derive(Debug, Copy, Hash, PartialOrd, PartialEq, Eq)] pub struct IntStr { pub a: foo<::std::os::raw::c_int>, } @@ -58,7 +58,7 @@ impl Default for IntStr { } /// Cannot derive hash/eq when instantiated with float but can derive partialeq #[repr(C)] -#[derive(Debug, Copy, PartialEq)] +#[derive(Debug, Copy, PartialOrd, PartialEq)] pub struct FloatStr { pub a: foo<f32>, } @@ -102,13 +102,31 @@ fn __bindgen_test_layout_foo_open0_int_close0_instantiation() { 4usize, concat!( "Size of template specialization: ", - stringify ! ( foo < :: std :: os :: raw :: c_int > ) + stringify!(foo<::std::os::raw::c_int>) + ) + ); + assert_eq!( + ::std::mem::align_of::<foo<::std::os::raw::c_int>>(), + 4usize, + concat!( + "Alignment of template specialization: ", + stringify!(foo<::std::os::raw::c_int>) ) ); - assert_eq ! ( :: std :: mem :: align_of :: < foo < :: std :: os :: raw :: c_int > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( foo < :: std :: os :: raw :: c_int > ) ) ); } #[test] fn __bindgen_test_layout_foo_open0_float_close0_instantiation() { - assert_eq ! ( :: std :: mem :: size_of :: < foo < f32 > > ( ) , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( foo < f32 > ) ) ); - assert_eq ! ( :: std :: mem :: align_of :: < foo < f32 > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( foo < f32 > ) ) ); + assert_eq!( + ::std::mem::size_of::<foo<f32>>(), + 4usize, + concat!("Size of template specialization: ", stringify!(foo<f32>)) + ); + assert_eq!( + ::std::mem::align_of::<foo<f32>>(), + 4usize, + concat!( + "Alignment of template specialization: ", + stringify!(foo<f32>) + ) + ); } diff --git a/tests/headers/derive-hash-blacklisting.hpp b/tests/headers/derive-hash-blacklisting.hpp index c39c31ad..94a9f783 100644 --- a/tests/headers/derive-hash-blacklisting.hpp +++ b/tests/headers/derive-hash-blacklisting.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" // template <class T> struct Blacklisted { diff --git a/tests/headers/derive-hash-struct-with-anon-struct-float.h b/tests/headers/derive-hash-struct-with-anon-struct-float.h index 64fe7fd9..f96b9449 100644 --- a/tests/headers/derive-hash-struct-with-anon-struct-float.h +++ b/tests/headers/derive-hash-struct-with-anon-struct-float.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq // -/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq. +/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partialeq and partialord struct foo { struct { float a; diff --git a/tests/headers/derive-hash-struct-with-float-array.h b/tests/headers/derive-hash-struct-with-float-array.h index a34904f7..937217a0 100644 --- a/tests/headers/derive-hash-struct-with-float-array.h +++ b/tests/headers/derive-hash-struct-with-float-array.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq // -/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq. +/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq and partialord struct foo { float bar[3]; }; diff --git a/tests/headers/derive-hash-struct-with-pointer.h b/tests/headers/derive-hash-struct-with-pointer.h index d7f18a6d..9c8ba0f9 100644 --- a/tests/headers/derive-hash-struct-with-pointer.h +++ b/tests/headers/derive-hash-struct-with-pointer.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq // -/// Pointers can derive hash/PartialEq/Eq +/// Pointers can derive Hash/PartialOrd/PartialEq/Eq struct ConstPtrMutObj { int* const bar; }; diff --git a/tests/headers/derive-hash-template-def-float.hpp b/tests/headers/derive-hash-template-def-float.hpp index 8c1a14d1..2dbe5409 100644 --- a/tests/headers/derive-hash-template-def-float.hpp +++ b/tests/headers/derive-hash-template-def-float.hpp @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq // -/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq. +/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq and partialord. template <typename T> struct foo { T data; diff --git a/tests/headers/derive-hash-template-inst-float.hpp b/tests/headers/derive-hash-template-inst-float.hpp index 14fd89a0..d189ba71 100644 --- a/tests/headers/derive-hash-template-inst-float.hpp +++ b/tests/headers/derive-hash-template-inst-float.hpp @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq +// bindgen-flags: --with-derive-hash --with-derive-partialord --with-derive-partialeq --with-derive-eq // -/// Template definition that doesn't contain float can derive hash/partialeq/eq +/// Template definition that doesn't contain float can derive hash/partialord/partialeq/eq template <typename T> struct foo { T data; |