Skip to content

Commit 3fc501f

Browse files
committed
Misc tests for derive Eq
1 parent bca8be6 commit 3fc501f

19 files changed

+45
-40
lines changed

tests/expectations/tests/16-byte-alignment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub union rte_ipv4_tuple__bindgen_ty_1 {
1919
_bindgen_union_align: u32,
2020
}
2121
#[repr(C)]
22-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
22+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
2323
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
2424
pub dport: u16,
2525
pub sport: u16,
@@ -112,7 +112,7 @@ pub union rte_ipv6_tuple__bindgen_ty_1 {
112112
_bindgen_union_align: u32,
113113
}
114114
#[repr(C)]
115-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
115+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
116116
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
117117
pub dport: u16,
118118
pub sport: u16,

tests/expectations/tests/16-byte-alignment_1_0.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,23 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3434
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
3535
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
3636
}
37+
impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
3738
#[repr(C)]
38-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
39+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
3940
pub struct rte_ipv4_tuple {
4041
pub src_addr: u32,
4142
pub dst_addr: u32,
4243
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
4344
}
4445
#[repr(C)]
45-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
46+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
4647
pub struct rte_ipv4_tuple__bindgen_ty_1 {
4748
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
4849
pub sctp_tag: __BindgenUnionField<u32>,
4950
pub bindgen_union_field: u32,
5051
}
5152
#[repr(C)]
52-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
53+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
5354
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
5455
pub dport: u16,
5556
pub sport: u16,
@@ -122,21 +123,21 @@ impl Clone for rte_ipv4_tuple {
122123
fn clone(&self) -> Self { *self }
123124
}
124125
#[repr(C)]
125-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
126+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
126127
pub struct rte_ipv6_tuple {
127128
pub src_addr: [u8; 16usize],
128129
pub dst_addr: [u8; 16usize],
129130
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
130131
}
131132
#[repr(C)]
132-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
133+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
133134
pub struct rte_ipv6_tuple__bindgen_ty_1 {
134135
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
135136
pub sctp_tag: __BindgenUnionField<u32>,
136137
pub bindgen_union_field: u32,
137138
}
138139
#[repr(C)]
139-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
140+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
140141
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
141142
pub dport: u16,
142143
pub sport: u16,

tests/expectations/tests/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub type Char = ::std::os::raw::c_char;
88
pub type SChar = ::std::os::raw::c_schar;
99
pub type UChar = ::std::os::raw::c_uchar;
1010
#[repr(C)]
11-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
11+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
1212
pub struct Test {
1313
pub ch: ::std::os::raw::c_char,
1414
pub u: ::std::os::raw::c_uchar,

tests/expectations/tests/issue-493.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3434
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
3535
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
3636
}
37+
impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
3738
#[repr(C)]
38-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
39+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
3940
pub struct basic_string {
4041
pub _address: u8,
4142
}
4243
pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
4344
pub type basic_string_value_type = ::std::os::raw::c_char;
4445
pub type basic_string_pointer = *mut basic_string_value_type;
4546
#[repr(C)]
46-
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
47+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
4748
pub struct basic_string___long {
4849
pub __cap_: basic_string_size_type,
4950
pub __size_: basic_string_size_type,
@@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
8990
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
9091
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
9192
#[repr(C)]
92-
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
93+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
9394
pub struct basic_string___raw {
9495
pub __words: *mut basic_string_size_type,
9596
}

tests/expectations/tests/issue-493_1_0.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3434
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
3535
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
3636
}
37+
impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
3738
#[repr(C)]
38-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
39+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
3940
pub struct basic_string {
4041
pub _address: u8,
4142
}
4243
pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
4344
pub type basic_string_value_type = ::std::os::raw::c_char;
4445
pub type basic_string_pointer = *mut basic_string_value_type;
4546
#[repr(C)]
46-
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
47+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
4748
pub struct basic_string___long {
4849
pub __cap_: basic_string_size_type,
4950
pub __size_: basic_string_size_type,
@@ -58,13 +59,13 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 =
5859
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5960
pub enum basic_string__bindgen_ty_1 { __min_cap = 0, }
6061
#[repr(C)]
61-
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
62+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
6263
pub struct basic_string___short {
6364
pub __bindgen_anon_1: basic_string___short__bindgen_ty_1,
6465
pub __data_: *mut basic_string_value_type,
6566
}
6667
#[repr(C)]
67-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
68+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
6869
pub struct basic_string___short__bindgen_ty_1 {
6970
pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
7071
pub __lx: __BindgenUnionField<basic_string_value_type>,
@@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 =
8990
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
9091
pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
9192
#[repr(C)]
92-
#[derive(Debug, Copy, Clone, Hash, PartialEq)]
93+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
9394
pub struct basic_string___raw {
9495
pub __words: *mut basic_string_size_type,
9596
}

tests/expectations/tests/typeref.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Default for nsFoo {
2424
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
2525
}
2626
#[repr(C)]
27-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
27+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
2828
pub struct mozilla_FragmentOrURL {
2929
pub mIsLocalRef: bool,
3030
}
@@ -46,7 +46,7 @@ impl Clone for mozilla_FragmentOrURL {
4646
fn clone(&self) -> Self { *self }
4747
}
4848
#[repr(C)]
49-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
49+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
5050
pub struct mozilla_Position {
5151
pub _address: u8,
5252
}
@@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource {
7777
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
7878
}
7979
#[repr(C)]
80-
#[derive(Debug, Copy, Hash, PartialEq)]
80+
#[derive(Debug, Copy, Hash, PartialEq, Eq)]
8181
pub struct Bar {
8282
pub mFoo: *mut nsFoo,
8383
}

tests/expectations/tests/typeref_1_0.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> {
3434
impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> {
3535
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
3636
}
37+
impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { }
3738
#[repr(C)]
38-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
39+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
3940
pub struct nsFoo {
4041
pub mBar: mozilla_StyleShapeSource,
4142
}
@@ -55,7 +56,7 @@ impl Clone for nsFoo {
5556
fn clone(&self) -> Self { *self }
5657
}
5758
#[repr(C)]
58-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
59+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
5960
pub struct mozilla_FragmentOrURL {
6061
pub mIsLocalRef: bool,
6162
}
@@ -77,7 +78,7 @@ impl Clone for mozilla_FragmentOrURL {
7778
fn clone(&self) -> Self { *self }
7879
}
7980
#[repr(C)]
80-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
81+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
8182
pub struct mozilla_Position {
8283
pub _address: u8,
8384
}
@@ -92,19 +93,19 @@ impl Clone for mozilla_Position {
9293
fn clone(&self) -> Self { *self }
9394
}
9495
#[repr(C)]
95-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
96+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
9697
pub struct mozilla_StyleShapeSource {
9798
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
9899
}
99100
#[repr(C)]
100-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
101+
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
101102
pub struct mozilla_StyleShapeSource__bindgen_ty_1 {
102103
pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
103104
pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
104105
pub bindgen_union_field: u64,
105106
}
106107
#[repr(C)]
107-
#[derive(Debug, Copy, Hash, PartialEq)]
108+
#[derive(Debug, Copy, Hash, PartialEq, Eq)]
108109
pub struct Bar {
109110
pub mFoo: *mut nsFoo,
110111
}

tests/expectations/tests/use-core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
extern crate core;
77

88
#[repr(C)]
9-
#[derive(Debug, Copy, Hash, PartialEq)]
9+
#[derive(Debug, Copy, Hash, PartialEq, Eq)]
1010
pub struct foo {
1111
pub a: ::std::os::raw::c_int,
1212
pub b: ::std::os::raw::c_int,

tests/expectations/tests/use-core_1_0.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ impl <T> ::core::hash::Hash for __BindgenUnionField<T> {
3535
impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> {
3636
fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
3737
}
38+
impl <T> ::core::cmp::Eq for __BindgenUnionField<T> { }
3839
#[repr(C)]
39-
#[derive(Debug, Copy, Hash, PartialEq)]
40+
#[derive(Debug, Copy, Hash, PartialEq, Eq)]
4041
pub struct foo {
4142
pub a: ::std::os::raw::c_int,
4243
pub b: ::std::os::raw::c_int,
@@ -71,7 +72,7 @@ impl Default for foo {
7172
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
7273
}
7374
#[repr(C)]
74-
#[derive(Debug, Default, Copy, Hash, PartialEq)]
75+
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
7576
pub struct _bindgen_ty_1 {
7677
pub bar: __BindgenUnionField<::std::os::raw::c_int>,
7778
pub baz: __BindgenUnionField<::std::os::raw::c_long>,

tests/headers/16-byte-alignment.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
typedef unsigned char uint8_t;
44
typedef unsigned short uint16_t;

tests/headers/16-byte-alignment_1_0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
typedef unsigned char uint8_t;
44
typedef unsigned short uint16_t;

tests/headers/char.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
22
//
33
typedef char Char;
44
typedef signed char SChar;

tests/headers/issue-493.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
22
template<class _CharT, class _Traits, class _Allocator>
33
class basic_string
44
{

tests/headers/issue-493_1_0.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
template<class _CharT, class _Traits, class _Allocator>
44
class basic_string

tests/headers/issue-648-derive-debug-with-padding.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ struct NoDebug {
1111
} __attribute__((__aligned__(64)));
1212

1313
/**
14-
* This should derive Debug/Hash/PartialEq because the padding size is less than the max derive
15-
* Debug/Hash/PartialEq impl for arrays. However, we conservatively don't derive Debug/Hash because
14+
* This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive
15+
* Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don't derive Debug/Hash because
1616
* we determine Debug derive-ability before we compute padding, which happens at
1717
* codegen. (Again, we expect to get the alignment wrong for similar reasons.)
1818
*/

tests/headers/typeref.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq
22
struct nsFoo;
33

44
namespace mozilla {

tests/headers/typeref_1_0.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
struct nsFoo;
44

tests/headers/use-core.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
struct foo {
44
int a, b;

tests/headers/use-core_1_0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
1+
// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq
22

33
struct foo {
44
int a, b;

0 commit comments

Comments
 (0)