diff options
31 files changed, 65 insertions, 31 deletions
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs index 6b243732..b72d67c9 100644 --- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs +++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Hash)] pub struct a { pub val_a: *mut b, } @@ -28,7 +28,7 @@ impl Default for a { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct b { pub val_b: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs index 4f41e187..c01d3963 100644 --- a/tests/expectations/tests/struct_typedef.rs +++ b/tests/expectations/tests/struct_typedef.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct typedef_named_struct { pub has_name: bool, } @@ -26,7 +26,7 @@ impl Clone for typedef_named_struct { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Hash)] pub struct _bindgen_ty_1 { pub no_name: *mut ::std::os::raw::c_void, } diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs index e436beb2..47234321 100644 --- a/tests/expectations/tests/struct_typedef_ns.rs +++ b/tests/expectations/tests/struct_typedef_ns.rs @@ -12,7 +12,7 @@ pub mod root { #[allow(unused_imports)] use self::super::super::root; #[repr(C)] - #[derive(Debug, Default, Copy)] + #[derive(Debug, Default, Copy, Hash)] pub struct typedef_struct { pub foo: ::std::os::raw::c_int, } @@ -41,7 +41,7 @@ pub mod root { #[allow(unused_imports)] use self::super::super::root; #[repr(C)] - #[derive(Debug, Default, Copy)] + #[derive(Debug, Default, Copy, Hash)] pub struct _bindgen_ty_1 { pub foo: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs index 015e7d86..26e06c0b 100644 --- a/tests/expectations/tests/struct_with_anon_struct.rs +++ b/tests/expectations/tests/struct_with_anon_struct.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs index 8934e8a6..a2ab1b2b 100644 --- a/tests/expectations/tests/struct_with_anon_struct_array.rs +++ b/tests/expectations/tests/struct_with_anon_struct_array.rs @@ -5,13 +5,13 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub bar: [foo__bindgen_ty_1; 2usize], pub baz: [[[foo__bindgen_ty_2; 4usize]; 3usize]; 2usize], } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, @@ -37,7 +37,7 @@ impl Clone for foo__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_2 { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs index cba5b8a6..cfe5dbd7 100644 --- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs +++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Hash)] pub struct foo { pub bar: *mut foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs index 5984ba6e..84be35ed 100644 --- a/tests/expectations/tests/struct_with_anon_union.rs +++ b/tests/expectations/tests/struct_with_anon_union.rs @@ -28,13 +28,16 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { fmt.write_str("__BindgenUnionField") } } +impl <T> ::std::hash::Hash for __BindgenUnionField<T> { + fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } +} #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: __BindgenUnionField<::std::os::raw::c_uint>, pub b: __BindgenUnionField<::std::os::raw::c_ushort>, diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs index a7374bc4..8a5d6194 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: ::std::os::raw::c_uint, pub b: ::std::os::raw::c_uint, diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs index 09dbbb59..226f7db9 100644 --- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs +++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs @@ -28,13 +28,16 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { fmt.write_str("__BindgenUnionField") } } +impl <T> ::std::hash::Hash for __BindgenUnionField<T> { + fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } +} #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub a: __BindgenUnionField<::std::os::raw::c_uint>, pub b: __BindgenUnionField<::std::os::raw::c_ushort>, diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs index b93b441f..97cefe06 100644 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ b/tests/expectations/tests/struct_with_bitfields.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct bitfield { pub _bitfield_1: u8, pub e: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs index b2a77b27..2fd00fb1 100644 --- a/tests/expectations/tests/struct_with_derive_debug.rs +++ b/tests/expectations/tests/struct_with_derive_debug.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct LittleArray { pub a: [::std::os::raw::c_int; 32usize], } @@ -48,7 +48,7 @@ impl Default for BigArray { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct WithLittleArray { pub a: LittleArray, } diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs index 1a8e887d..63df2729 100644 --- a/tests/expectations/tests/struct_with_nesting.rs +++ b/tests/expectations/tests/struct_with_nesting.rs @@ -28,14 +28,17 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { fmt.write_str("__BindgenUnionField") } } +impl <T> ::std::hash::Hash for __BindgenUnionField<T> { + fn hash<H: ::std::hash::Hasher>(&self, _state: &mut H) { } +} #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub a: ::std::os::raw::c_uint, pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub b: __BindgenUnionField<::std::os::raw::c_uint>, pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_1>, @@ -43,7 +46,7 @@ pub struct foo__bindgen_ty_1 { pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1__bindgen_ty_1 { pub c1: ::std::os::raw::c_ushort, pub c2: ::std::os::raw::c_ushort, @@ -75,7 +78,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1__bindgen_ty_2 { pub d1: ::std::os::raw::c_uchar, pub d2: ::std::os::raw::c_uchar, diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs index abeb0b83..7e587a07 100644 --- a/tests/expectations/tests/struct_with_packing.rs +++ b/tests/expectations/tests/struct_with_packing.rs @@ -5,7 +5,7 @@ #[repr(C, packed)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct a { pub b: ::std::os::raw::c_char, pub c: ::std::os::raw::c_short, diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs index 1ad359f3..d6509a14 100644 --- a/tests/expectations/tests/struct_with_struct.rs +++ b/tests/expectations/tests/struct_with_struct.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct foo__bindgen_ty_1 { pub x: ::std::os::raw::c_uint, pub y: ::std::os::raw::c_uint, diff --git a/tests/expectations/tests/struct_with_typedef_template_arg.rs b/tests/expectations/tests/struct_with_typedef_template_arg.rs index 9066e037..7566bf4a 100644 --- a/tests/expectations/tests/struct_with_typedef_template_arg.rs +++ b/tests/expectations/tests/struct_with_typedef_template_arg.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Proxy { pub _address: u8, } diff --git a/tests/headers/struct_containing_forward_declared_struct.h b/tests/headers/struct_containing_forward_declared_struct.h index d38aca2f..68828192 100644 --- a/tests/headers/struct_containing_forward_declared_struct.h +++ b/tests/headers/struct_containing_forward_declared_struct.h @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash struct a { struct b* val_a; }; diff --git a/tests/headers/struct_typedef.h b/tests/headers/struct_typedef.h index fdce9a72..f8eacd87 100644 --- a/tests/headers/struct_typedef.h +++ b/tests/headers/struct_typedef.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// typedef struct { _Bool has_name; } typedef_named_struct; diff --git a/tests/headers/struct_typedef_ns.hpp b/tests/headers/struct_typedef_ns.hpp index bc89eb2b..62a8ceac 100644 --- a/tests/headers/struct_typedef_ns.hpp +++ b/tests/headers/struct_typedef_ns.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces +// bindgen-flags: --with-derive-hash --enable-cxx-namespaces namespace whatever { typedef struct { diff --git a/tests/headers/struct_with_anon_struct.h b/tests/headers/struct_with_anon_struct.h index 1617d7a8..e6a8ab97 100644 --- a/tests/headers/struct_with_anon_struct.h +++ b/tests/headers/struct_with_anon_struct.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct foo { struct { int a; diff --git a/tests/headers/struct_with_anon_struct_array.h b/tests/headers/struct_with_anon_struct_array.h index 9ea977e8..459e274a 100644 --- a/tests/headers/struct_with_anon_struct_array.h +++ b/tests/headers/struct_with_anon_struct_array.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct foo { struct { int a; diff --git a/tests/headers/struct_with_anon_struct_pointer.h b/tests/headers/struct_with_anon_struct_pointer.h index 0c486d84..de628402 100644 --- a/tests/headers/struct_with_anon_struct_pointer.h +++ b/tests/headers/struct_with_anon_struct_pointer.h @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash struct foo { struct { int a; diff --git a/tests/headers/struct_with_anon_union.h b/tests/headers/struct_with_anon_union.h index 3a92b940..45ddb3c4 100644 --- a/tests/headers/struct_with_anon_union.h +++ b/tests/headers/struct_with_anon_union.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct foo { union { unsigned int a; diff --git a/tests/headers/struct_with_anon_unnamed_struct.h b/tests/headers/struct_with_anon_unnamed_struct.h index f8ac4225..5962a12c 100644 --- a/tests/headers/struct_with_anon_unnamed_struct.h +++ b/tests/headers/struct_with_anon_unnamed_struct.h @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash struct foo { struct { unsigned int a; diff --git a/tests/headers/struct_with_anon_unnamed_union.h b/tests/headers/struct_with_anon_unnamed_union.h index 7158e727..949547c1 100644 --- a/tests/headers/struct_with_anon_unnamed_union.h +++ b/tests/headers/struct_with_anon_unnamed_union.h @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash struct foo { union { unsigned int a; diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h index ece512cd..88a167a0 100644 --- a/tests/headers/struct_with_bitfields.h +++ b/tests/headers/struct_with_bitfields.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct bitfield { unsigned short a :1, diff --git a/tests/headers/struct_with_derive_debug.h b/tests/headers/struct_with_derive_debug.h index 98ba1b3d..d13bb466 100644 --- a/tests/headers/struct_with_derive_debug.h +++ b/tests/headers/struct_with_derive_debug.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct LittleArray { int a[32]; }; diff --git a/tests/headers/struct_with_large_array.hpp b/tests/headers/struct_with_large_array.hpp index fc67b333..c9aaa697 100644 --- a/tests/headers/struct_with_large_array.hpp +++ b/tests/headers/struct_with_large_array.hpp @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct S { char large_array[33]; }; diff --git a/tests/headers/struct_with_nesting.h b/tests/headers/struct_with_nesting.h index 9d7fa176..30f40bce 100644 --- a/tests/headers/struct_with_nesting.h +++ b/tests/headers/struct_with_nesting.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct foo { unsigned int a; union { diff --git a/tests/headers/struct_with_packing.h b/tests/headers/struct_with_packing.h index 1b9fe131..2184e8ec 100644 --- a/tests/headers/struct_with_packing.h +++ b/tests/headers/struct_with_packing.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct a { char b; short c; diff --git a/tests/headers/struct_with_struct.h b/tests/headers/struct_with_struct.h index 78b1cc81..975b0af4 100644 --- a/tests/headers/struct_with_struct.h +++ b/tests/headers/struct_with_struct.h @@ -1,3 +1,5 @@ +// bindgen-flags: --with-derive-hash +// struct foo { struct { unsigned int x; diff --git a/tests/headers/struct_with_typedef_template_arg.hpp b/tests/headers/struct_with_typedef_template_arg.hpp index 7fed21ab..f299e322 100644 --- a/tests/headers/struct_with_typedef_template_arg.hpp +++ b/tests/headers/struct_with_typedef_template_arg.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash template<typename T, typename ...Args> struct Proxy { typedef void (*foo)(T* bar); |