diff options
author | Zhiting Zhu <zhitingz@cs.utexas.edu> | 2017-08-16 21:24:21 -0500 |
---|---|---|
committer | Zhiting Zhu <zhitingz@cs.utexas.edu> | 2017-08-21 16:14:41 -0500 |
commit | 3fc501f93fa9b5a19f97b7a7a2a3625616af7128 (patch) | |
tree | 324ae0891daec4965f164fc05f9fcd27aeba6ebf | |
parent | bca8be63ab6e7a8be327bacadca33abe9bc18d4c (diff) |
Misc tests for derive Eq
-rw-r--r-- | tests/expectations/tests/16-byte-alignment.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/16-byte-alignment_1_0.rs | 13 | ||||
-rw-r--r-- | tests/expectations/tests/char.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/issue-493.rs | 7 | ||||
-rw-r--r-- | tests/expectations/tests/issue-493_1_0.rs | 11 | ||||
-rw-r--r-- | tests/expectations/tests/typeref.rs | 6 | ||||
-rw-r--r-- | tests/expectations/tests/typeref_1_0.rs | 13 | ||||
-rw-r--r-- | tests/expectations/tests/use-core.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/use-core_1_0.rs | 5 | ||||
-rw-r--r-- | tests/headers/16-byte-alignment.h | 2 | ||||
-rw-r--r-- | tests/headers/16-byte-alignment_1_0.h | 2 | ||||
-rw-r--r-- | tests/headers/char.h | 2 | ||||
-rw-r--r-- | tests/headers/issue-493.hpp | 2 | ||||
-rw-r--r-- | tests/headers/issue-493_1_0.hpp | 2 | ||||
-rw-r--r-- | tests/headers/issue-648-derive-debug-with-padding.h | 4 | ||||
-rw-r--r-- | tests/headers/typeref.hpp | 2 | ||||
-rw-r--r-- | tests/headers/typeref_1_0.hpp | 2 | ||||
-rw-r--r-- | tests/headers/use-core.h | 2 | ||||
-rw-r--r-- | tests/headers/use-core_1_0.h | 2 |
19 files changed, 45 insertions, 40 deletions
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs index 45ec2ead..86103656 100644 --- a/tests/expectations/tests/16-byte-alignment.rs +++ b/tests/expectations/tests/16-byte-alignment.rs @@ -19,7 +19,7 @@ pub union rte_ipv4_tuple__bindgen_ty_1 { _bindgen_union_align: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, @@ -112,7 +112,7 @@ pub union rte_ipv6_tuple__bindgen_ty_1 { _bindgen_union_align: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs index ee8a3261..98cb1a49 100644 --- a/tests/expectations/tests/16-byte-alignment_1_0.rs +++ b/tests/expectations/tests/16-byte-alignment_1_0.rs @@ -34,22 +34,23 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple { pub src_addr: u32, pub dst_addr: u32, pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1 { pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>, pub sctp_tag: __BindgenUnionField<u32>, pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, @@ -122,21 +123,21 @@ impl Clone for rte_ipv4_tuple { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple { pub src_addr: [u8; 16usize], pub dst_addr: [u8; 16usize], pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1 { pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>, pub sctp_tag: __BindgenUnionField<u32>, pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs index ac1700f5..1e45c743 100644 --- a/tests/expectations/tests/char.rs +++ b/tests/expectations/tests/char.rs @@ -8,7 +8,7 @@ pub type Char = ::std::os::raw::c_char; pub type SChar = ::std::os::raw::c_schar; pub type UChar = ::std::os::raw::c_uchar; #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct Test { pub ch: ::std::os::raw::c_char, pub u: ::std::os::raw::c_uchar, diff --git a/tests/expectations/tests/issue-493.rs b/tests/expectations/tests/issue-493.rs index d5486ccc..7a947366 100644 --- a/tests/expectations/tests/issue-493.rs +++ b/tests/expectations/tests/issue-493.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string { pub _address: u8, } @@ -43,7 +44,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong; pub type basic_string_value_type = ::std::os::raw::c_char; pub type basic_string_pointer = *mut basic_string_value_type; #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___long { pub __cap_: basic_string_size_type, pub __size_: basic_string_size_type, @@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_2 { __n_words = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___raw { pub __words: *mut basic_string_size_type, } diff --git a/tests/expectations/tests/issue-493_1_0.rs b/tests/expectations/tests/issue-493_1_0.rs index 4ddc6188..710cd41e 100644 --- a/tests/expectations/tests/issue-493_1_0.rs +++ b/tests/expectations/tests/issue-493_1_0.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string { pub _address: u8, } @@ -43,7 +44,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong; pub type basic_string_value_type = ::std::os::raw::c_char; pub type basic_string_pointer = *mut basic_string_value_type; #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___long { pub __cap_: basic_string_size_type, pub __size_: basic_string_size_type, @@ -58,13 +59,13 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_1 { __min_cap = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___short { pub __bindgen_anon_1: basic_string___short__bindgen_ty_1, pub __data_: *mut basic_string_value_type, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___short__bindgen_ty_1 { pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>, pub __lx: __BindgenUnionField<basic_string_value_type>, @@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_2 { __n_words = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___raw { pub __words: *mut basic_string_size_type, } diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index 0a4edf4c..cefd02ba 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -24,7 +24,7 @@ impl Default for nsFoo { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, } @@ -46,7 +46,7 @@ impl Clone for mozilla_FragmentOrURL { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_Position { pub _address: u8, } @@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { pub mFoo: *mut nsFoo, } diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index d472f02b..0d240743 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct nsFoo { pub mBar: mozilla_StyleShapeSource, } @@ -55,7 +56,7 @@ impl Clone for nsFoo { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, } @@ -77,7 +78,7 @@ impl Clone for mozilla_FragmentOrURL { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_Position { pub _address: u8, } @@ -92,19 +93,19 @@ impl Clone for mozilla_Position { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct mozilla_StyleShapeSource { pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct mozilla_StyleShapeSource__bindgen_ty_1 { pub mPosition: __BindgenUnionField<*mut mozilla_Position>, pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>, pub bindgen_union_field: u64, } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { pub mFoo: *mut nsFoo, } diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs index 508e3b5d..6fe4a0ca 100644 --- a/tests/expectations/tests/use-core.rs +++ b/tests/expectations/tests/use-core.rs @@ -6,7 +6,7 @@ extern crate core; #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct foo { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs index b382454a..1e5ef337 100644 --- a/tests/expectations/tests/use-core_1_0.rs +++ b/tests/expectations/tests/use-core_1_0.rs @@ -35,8 +35,9 @@ impl <T> ::core::hash::Hash for __BindgenUnionField<T> { impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::core::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct foo { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, @@ -71,7 +72,7 @@ impl Default for foo { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct _bindgen_ty_1 { pub bar: __BindgenUnionField<::std::os::raw::c_int>, pub baz: __BindgenUnionField<::std::os::raw::c_long>, diff --git a/tests/headers/16-byte-alignment.h b/tests/headers/16-byte-alignment.h index 2fb3e2f3..235a994a 100644 --- a/tests/headers/16-byte-alignment.h +++ b/tests/headers/16-byte-alignment.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/16-byte-alignment_1_0.h b/tests/headers/16-byte-alignment_1_0.h index 89574e9f..8a9fd491 100644 --- a/tests/headers/16-byte-alignment_1_0.h +++ b/tests/headers/16-byte-alignment_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/char.h b/tests/headers/char.h index 71bce553..7cffd865 100644 --- a/tests/headers/char.h +++ b/tests/headers/char.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // typedef char Char; typedef signed char SChar; diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp index 7c58a351..5d4cb4b8 100644 --- a/tests/headers/issue-493.hpp +++ b/tests/headers/issue-493.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template<class _CharT, class _Traits, class _Allocator> class basic_string { diff --git a/tests/headers/issue-493_1_0.hpp b/tests/headers/issue-493_1_0.hpp index 2f43b16e..4e383be3 100644 --- a/tests/headers/issue-493_1_0.hpp +++ b/tests/headers/issue-493_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq template<class _CharT, class _Traits, class _Allocator> class basic_string diff --git a/tests/headers/issue-648-derive-debug-with-padding.h b/tests/headers/issue-648-derive-debug-with-padding.h index 2ef70e47..c9ec0210 100644 --- a/tests/headers/issue-648-derive-debug-with-padding.h +++ b/tests/headers/issue-648-derive-debug-with-padding.h @@ -11,8 +11,8 @@ struct NoDebug { } __attribute__((__aligned__(64))); /** - * This should derive Debug/Hash/PartialEq because the padding size is less than the max derive - * Debug/Hash/PartialEq impl for arrays. However, we conservatively don't derive Debug/Hash because + * This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive + * Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don't derive Debug/Hash because * we determine Debug derive-ability before we compute padding, which happens at * codegen. (Again, we expect to get the alignment wrong for similar reasons.) */ diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp index d0710bfb..bdc1b302 100644 --- a/tests/headers/typeref.hpp +++ b/tests/headers/typeref.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq struct nsFoo; namespace mozilla { diff --git a/tests/headers/typeref_1_0.hpp b/tests/headers/typeref_1_0.hpp index 0dad19b2..70dfc11f 100644 --- a/tests/headers/typeref_1_0.hpp +++ b/tests/headers/typeref_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct nsFoo; diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h index b5fd0515..b4135b44 100644 --- a/tests/headers/use-core.h +++ b/tests/headers/use-core.h @@ -1,4 +1,4 @@ -// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq +// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { int a, b; diff --git a/tests/headers/use-core_1_0.h b/tests/headers/use-core_1_0.h index f525bccf..40de9d15 100644 --- a/tests/headers/use-core_1_0.h +++ b/tests/headers/use-core_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { int a, b; |