summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen/mod.rs18
-rw-r--r--src/ir/analysis/derive_partial_eq.rs334
-rw-r--r--src/ir/analysis/mod.rs2
-rw-r--r--src/ir/context.rs35
-rw-r--r--src/ir/derive.rs27
-rw-r--r--src/ir/function.rs16
-rw-r--r--src/ir/item.rs9
-rw-r--r--src/ir/layout.rs10
-rw-r--r--src/lib.rs15
-rw-r--r--src/options.rs7
-rw-r--r--tests/expectations/tests/16-byte-alignment.rs4
-rw-r--r--tests/expectations/tests/16-byte-alignment_1_0.rs15
-rw-r--r--tests/expectations/tests/anon_enum.rs2
-rw-r--r--tests/expectations/tests/anon_enum_trait.rs4
-rw-r--r--tests/expectations/tests/anon_struct_in_union.rs2
-rw-r--r--tests/expectations/tests/anon_struct_in_union_1_0.rs9
-rw-r--r--tests/expectations/tests/anon_union.rs4
-rw-r--r--tests/expectations/tests/anon_union_1_0.rs13
-rw-r--r--tests/expectations/tests/anonymous-template-types.rs8
-rw-r--r--tests/expectations/tests/char.rs2
-rw-r--r--tests/expectations/tests/class.rs4
-rw-r--r--tests/expectations/tests/class_1_0.rs11
-rw-r--r--tests/expectations/tests/class_nested.rs14
-rw-r--r--tests/expectations/tests/class_no_members.rs6
-rw-r--r--tests/expectations/tests/class_static.rs2
-rw-r--r--tests/expectations/tests/class_static_const.rs2
-rw-r--r--tests/expectations/tests/class_use_as.rs4
-rw-r--r--tests/expectations/tests/class_with_dtor.rs4
-rw-r--r--tests/expectations/tests/class_with_inner_struct.rs12
-rw-r--r--tests/expectations/tests/class_with_inner_struct_1_0.rs25
-rw-r--r--tests/expectations/tests/class_with_typedef.rs4
-rw-r--r--tests/expectations/tests/complex.rs8
-rw-r--r--tests/expectations/tests/derive-fn-ptr.rs2
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-pointer.rs10
-rw-r--r--tests/expectations/tests/empty_template_param_name.rs2
-rw-r--r--tests/expectations/tests/func_ptr_in_struct.rs2
-rw-r--r--tests/expectations/tests/issue-493.rs9
-rw-r--r--tests/expectations/tests/issue-493_1_0.rs13
-rw-r--r--tests/expectations/tests/issue-648-derive-debug-with-padding.rs4
-rw-r--r--tests/expectations/tests/issue-801-opaque-sloppiness.rs4
-rw-r--r--tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs10
-rw-r--r--tests/expectations/tests/jsval_layout_opaque.rs2
-rw-r--r--tests/expectations/tests/jsval_layout_opaque_1_0.rs13
-rw-r--r--tests/expectations/tests/layout_array.rs6
-rw-r--r--tests/expectations/tests/layout_array_too_long.rs8
-rw-r--r--tests/expectations/tests/layout_eth_conf.rs34
-rw-r--r--tests/expectations/tests/layout_eth_conf_1_0.rs39
-rw-r--r--tests/expectations/tests/layout_mbuf.rs12
-rw-r--r--tests/expectations/tests/layout_mbuf_1_0.rs29
-rw-r--r--tests/expectations/tests/opaque-template-inst-member-2.rs12
-rw-r--r--tests/expectations/tests/opaque-template-inst-member.rs8
-rw-r--r--tests/expectations/tests/opaque-template-instantiation-namespaced.rs10
-rw-r--r--tests/expectations/tests/opaque-template-instantiation.rs6
-rw-r--r--tests/expectations/tests/opaque-tracing.rs2
-rw-r--r--tests/expectations/tests/opaque_in_struct.rs4
-rw-r--r--tests/expectations/tests/opaque_pointer.rs6
-rw-r--r--tests/expectations/tests/opaque_typedef.rs2
-rw-r--r--tests/expectations/tests/struct_containing_forward_declared_struct.rs4
-rw-r--r--tests/expectations/tests/struct_typedef.rs4
-rw-r--r--tests/expectations/tests/struct_typedef_ns.rs4
-rw-r--r--tests/expectations/tests/struct_with_anon_struct.rs4
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_array.rs6
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_pointer.rs4
-rw-r--r--tests/expectations/tests/struct_with_anon_union_1_0.rs7
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_struct.rs4
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs7
-rw-r--r--tests/expectations/tests/struct_with_bitfields.rs2
-rw-r--r--tests/expectations/tests/struct_with_derive_debug.rs4
-rw-r--r--tests/expectations/tests/struct_with_nesting.rs4
-rw-r--r--tests/expectations/tests/struct_with_nesting_1_0.rs11
-rw-r--r--tests/expectations/tests/struct_with_packing.rs2
-rw-r--r--tests/expectations/tests/struct_with_struct.rs4
-rw-r--r--tests/expectations/tests/struct_with_typedef_template_arg.rs2
-rw-r--r--tests/expectations/tests/template-fun-ty.rs6
-rw-r--r--tests/expectations/tests/template.rs42
-rw-r--r--tests/expectations/tests/template_alias.rs2
-rw-r--r--tests/expectations/tests/template_alias_namespace.rs2
-rw-r--r--tests/expectations/tests/template_typedef_transitive_param.rs4
-rw-r--r--tests/expectations/tests/templateref_opaque.rs4
-rw-r--r--tests/expectations/tests/typeref.rs6
-rw-r--r--tests/expectations/tests/typeref_1_0.rs15
-rw-r--r--tests/expectations/tests/union-in-ns_1_0.rs3
-rw-r--r--tests/expectations/tests/union_dtor_1_0.rs3
-rw-r--r--tests/expectations/tests/union_fields_1_0.rs5
-rw-r--r--tests/expectations/tests/union_template_1_0.rs11
-rw-r--r--tests/expectations/tests/union_with_anon_struct.rs2
-rw-r--r--tests/expectations/tests/union_with_anon_struct_1_0.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield.rs2
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_union_1_0.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct.rs2
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs7
-rw-r--r--tests/expectations/tests/union_with_big_member_1_0.rs5
-rw-r--r--tests/expectations/tests/union_with_nesting_1_0.rs11
-rw-r--r--tests/expectations/tests/use-core.rs2
-rw-r--r--tests/expectations/tests/use-core_1_0.rs7
-rw-r--r--tests/headers/16-byte-alignment.h2
-rw-r--r--tests/headers/16-byte-alignment_1_0.h2
-rw-r--r--tests/headers/anon_enum.hpp2
-rw-r--r--tests/headers/anon_enum_trait.hpp2
-rw-r--r--tests/headers/anon_struct_in_union.h2
-rw-r--r--tests/headers/anon_struct_in_union_1_0.h2
-rw-r--r--tests/headers/anon_union.hpp3
-rw-r--r--tests/headers/anon_union_1_0.hpp2
-rw-r--r--tests/headers/anonymous-template-types.hpp2
-rw-r--r--tests/headers/char.h2
-rw-r--r--tests/headers/class.hpp2
-rw-r--r--tests/headers/class_1_0.hpp2
-rw-r--r--tests/headers/class_nested.hpp2
-rw-r--r--tests/headers/class_no_members.hpp2
-rw-r--r--tests/headers/class_static.hpp2
-rw-r--r--tests/headers/class_static_const.hpp2
-rw-r--r--tests/headers/class_use_as.hpp2
-rw-r--r--tests/headers/class_with_dtor.hpp2
-rw-r--r--tests/headers/class_with_inner_struct.hpp2
-rw-r--r--tests/headers/class_with_inner_struct_1_0.hpp2
-rw-r--r--tests/headers/class_with_typedef.hpp2
-rw-r--r--tests/headers/complex.h2
-rw-r--r--tests/headers/complex_global.h2
-rw-r--r--tests/headers/derive-fn-ptr.h2
-rw-r--r--tests/headers/derive-hash-struct-with-pointer.h4
-rw-r--r--tests/headers/empty_template_param_name.hpp2
-rw-r--r--tests/headers/func_ptr.h2
-rw-r--r--tests/headers/func_ptr_in_struct.h2
-rw-r--r--tests/headers/issue-493.hpp3
-rw-r--r--tests/headers/issue-493_1_0.hpp2
-rw-r--r--tests/headers/issue-648-derive-debug-with-padding.h6
-rw-r--r--tests/headers/issue-801-opaque-sloppiness.hpp2
-rw-r--r--tests/headers/issue-807-opaque-types-methods-being-generated.hpp2
-rw-r--r--tests/headers/jsval_layout_opaque.hpp2
-rw-r--r--tests/headers/jsval_layout_opaque_1_0.hpp2
-rw-r--r--tests/headers/layout_array.h2
-rw-r--r--tests/headers/layout_array_too_long.h2
-rw-r--r--tests/headers/layout_eth_conf.h3
-rw-r--r--tests/headers/layout_eth_conf_1_0.h2
-rw-r--r--tests/headers/layout_mbuf.h2
-rw-r--r--tests/headers/layout_mbuf_1_0.h2
-rw-r--r--tests/headers/opaque-template-inst-member-2.hpp8
-rw-r--r--tests/headers/opaque-template-inst-member.hpp8
-rw-r--r--tests/headers/opaque-template-instantiation-namespaced.hpp2
-rw-r--r--tests/headers/opaque-template-instantiation.hpp2
-rw-r--r--tests/headers/opaque-tracing.hpp2
-rw-r--r--tests/headers/opaque_in_struct.hpp2
-rw-r--r--tests/headers/opaque_pointer.hpp2
-rw-r--r--tests/headers/opaque_typedef.hpp2
-rw-r--r--tests/headers/struct_containing_forward_declared_struct.h2
-rw-r--r--tests/headers/struct_typedef.h2
-rw-r--r--tests/headers/struct_typedef_ns.hpp2
-rw-r--r--tests/headers/struct_with_anon_struct.h2
-rw-r--r--tests/headers/struct_with_anon_struct_array.h2
-rw-r--r--tests/headers/struct_with_anon_struct_pointer.h2
-rw-r--r--tests/headers/struct_with_anon_union.h4
-rw-r--r--tests/headers/struct_with_anon_union_1_0.h2
-rw-r--r--tests/headers/struct_with_anon_unnamed_struct.h2
-rw-r--r--tests/headers/struct_with_anon_unnamed_union.h3
-rw-r--r--tests/headers/struct_with_anon_unnamed_union_1_0.h2
-rw-r--r--tests/headers/struct_with_bitfields.h2
-rw-r--r--tests/headers/struct_with_derive_debug.h2
-rw-r--r--tests/headers/struct_with_large_array.hpp2
-rw-r--r--tests/headers/struct_with_nesting.h4
-rw-r--r--tests/headers/struct_with_nesting_1_0.h2
-rw-r--r--tests/headers/struct_with_packing.h2
-rw-r--r--tests/headers/struct_with_struct.h2
-rw-r--r--tests/headers/struct_with_typedef_template_arg.hpp2
-rw-r--r--tests/headers/template-fun-ty.hpp2
-rw-r--r--tests/headers/template.hpp2
-rw-r--r--tests/headers/template_alias.hpp2
-rw-r--r--tests/headers/template_alias_namespace.hpp2
-rw-r--r--tests/headers/template_typedef_transitive_param.hpp2
-rw-r--r--tests/headers/templateref_opaque.hpp2
-rw-r--r--tests/headers/typeref.hpp3
-rw-r--r--tests/headers/typeref_1_0.hpp2
-rw-r--r--tests/headers/union_fields.hpp4
-rw-r--r--tests/headers/union_fields_1_0.hpp2
-rw-r--r--tests/headers/union_template.hpp4
-rw-r--r--tests/headers/union_template_1_0.hpp2
-rw-r--r--tests/headers/union_with_anon_struct.h4
-rw-r--r--tests/headers/union_with_anon_struct_1_0.h2
-rw-r--r--tests/headers/union_with_anon_struct_bitfield.h4
-rw-r--r--tests/headers/union_with_anon_struct_bitfield_1_0.h2
-rw-r--r--tests/headers/union_with_anon_union.h4
-rw-r--r--tests/headers/union_with_anon_union_1_0.h2
-rw-r--r--tests/headers/union_with_anon_unnamed_struct.h4
-rw-r--r--tests/headers/union_with_anon_unnamed_struct_1_0.h2
-rw-r--r--tests/headers/union_with_anon_unnamed_union.h4
-rw-r--r--tests/headers/union_with_anon_unnamed_union_1_0.h2
-rw-r--r--tests/headers/union_with_big_member.h4
-rw-r--r--tests/headers/union_with_big_member_1_0.h2
-rw-r--r--tests/headers/union_with_nesting.h4
-rw-r--r--tests/headers/union_with_nesting_1_0.h2
-rw-r--r--tests/headers/use-core.h2
-rw-r--r--tests/headers/use-core_1_0.h2
193 files changed, 946 insertions, 414 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 6113e5d5..1e4a5d48 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -14,7 +14,7 @@ use ir::comment;
use ir::comp::{Base, Bitfield, BitfieldUnit, CompInfo, CompKind, Field,
FieldData, FieldMethods, Method, MethodKind};
use ir::context::{BindgenContext, ItemId};
-use ir::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash};
+use ir::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash, CanDerivePartialEq};
use ir::dot;
use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue};
use ir::function::{Abi, Function, FunctionSig};
@@ -1495,6 +1495,10 @@ impl CodeGenerator for CompInfo {
derives.push("Hash");
}
+ if item.can_derive_partialeq(ctx) {
+ derives.push("PartialEq");
+ }
+
if !derives.is_empty() {
attributes.push(attributes::derives(&derives))
}
@@ -3569,13 +3573,23 @@ mod utils {
)
.unwrap();
+ let union_field_partialeq_impl = quote_item!(&ctx.ext_cx(),
+ impl<T> ::$prefix::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool {
+ true
+ }
+ }
+ )
+ .unwrap();
+
let items = vec![union_field_decl,
union_field_impl,
union_field_default_impl,
union_field_clone_impl,
union_field_copy_impl,
union_field_debug_impl,
- union_field_hash_impl];
+ union_field_hash_impl,
+ union_field_partialeq_impl];
let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
diff --git a/src/ir/analysis/derive_partial_eq.rs b/src/ir/analysis/derive_partial_eq.rs
new file mode 100644
index 00000000..f8624d1f
--- /dev/null
+++ b/src/ir/analysis/derive_partial_eq.rs
@@ -0,0 +1,334 @@
+//! Determining which types for which we can emit `#[derive(PartialEq)]`.
+
+use super::{ConstrainResult, MonotoneFramework, generate_dependencies};
+use std::collections::HashSet;
+use std::collections::HashMap;
+use ir::context::{BindgenContext, ItemId};
+use ir::item::IsOpaque;
+use ir::traversal::EdgeKind;
+use ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
+use ir::ty::TypeKind;
+use ir::comp::Field;
+use ir::comp::FieldMethods;
+use ir::derive::CanTriviallyDerivePartialEq;
+use ir::comp::CompKind;
+
+/// An analysis that finds for each IR item whether partialeq cannot be derived.
+///
+/// We use the monotone constraint function `cannot_derive_partial_eq`, defined as
+/// follows:
+///
+/// * If T is Opaque and layout of the type is known, get this layout as opaque
+/// type and check whether it can be derived using trivial checks.
+/// * If T is Array type, partialeq cannot be derived if the length of the array is
+/// larger than the limit or the type of data the array contains cannot derive
+/// partialeq.
+/// * If T is a type alias, a templated alias or an indirection to another type,
+/// partialeq cannot be derived if the type T refers to cannot be derived partialeq.
+/// * If T is a compound type, partialeq cannot be derived if any of its base member
+/// or field cannot be derived partialeq.
+/// * If T is a pointer, T cannot be derived partialeq if T is a function pointer
+/// and the function signature cannot be derived partialeq.
+/// * If T is an instantiation of an abstract template definition, T cannot be
+/// derived partialeq if any of the template arguments or template definition
+/// cannot derive partialeq.
+#[derive(Debug, Clone)]
+pub struct CannotDerivePartialEq<'ctx, 'gen>
+ where 'gen: 'ctx
+{
+ ctx: &'ctx BindgenContext<'gen>,
+
+ // The incremental result of this analysis's computation. Everything in this
+ // set cannot derive partialeq.
+ cannot_derive_partialeq: HashSet<ItemId>,
+
+ // Dependencies saying that if a key ItemId has been inserted into the
+ // `cannot_derive_partialeq` set, then each of the ids in Vec<ItemId> need to be
+ // considered again.
+ //
+ // This is a subset of the natural IR graph with reversed edges, where we
+ // only include the edges from the IR graph that can affect whether a type
+ // can derive partialeq or not.
+ dependencies: HashMap<ItemId, Vec<ItemId>>,
+}
+
+impl<'ctx, 'gen> CannotDerivePartialEq<'ctx, 'gen> {
+ fn consider_edge(kind: EdgeKind) -> bool {
+ match kind {
+ // These are the only edges that can affect whether a type can derive
+ // partialeq or not.
+ EdgeKind::BaseMember |
+ EdgeKind::Field |
+ EdgeKind::TypeReference |
+ EdgeKind::VarType |
+ EdgeKind::TemplateArgument |
+ EdgeKind::TemplateDeclaration |
+ EdgeKind::TemplateParameterDefinition => true,
+
+ EdgeKind::Constructor |
+ EdgeKind::Destructor |
+ EdgeKind::FunctionReturn |
+ EdgeKind::FunctionParameter |
+ EdgeKind::InnerType |
+ EdgeKind::InnerVar |
+ EdgeKind::Method => false,
+ EdgeKind::Generic => false,
+ }
+ }
+
+ fn insert(&mut self, id: ItemId) -> ConstrainResult {
+ trace!("inserting {:?} into the cannot_derive_partialeq set", id);
+
+ let was_not_already_in_set = self.cannot_derive_partialeq.insert(id);
+ assert!(
+ was_not_already_in_set,
+ "We shouldn't try and insert {:?} twice because if it was \
+ already in the set, `constrain` should have exited early.",
+ id
+ );
+
+ ConstrainResult::Changed
+ }
+}
+
+impl<'ctx, 'gen> MonotoneFramework for CannotDerivePartialEq<'ctx, 'gen> {
+ type Node = ItemId;
+ type Extra = &'ctx BindgenContext<'gen>;
+ type Output = HashSet<ItemId>;
+
+ fn new(ctx: &'ctx BindgenContext<'gen>) -> CannotDerivePartialEq<'ctx, 'gen> {
+ let cannot_derive_partialeq = HashSet::new();
+ let dependencies = generate_dependencies(ctx, Self::consider_edge);
+
+ CannotDerivePartialEq {
+ ctx,
+ cannot_derive_partialeq,
+ dependencies,
+ }
+ }
+
+ fn initial_worklist(&self) -> Vec<ItemId> {
+ self.ctx.whitelisted_items().iter().cloned().collect()
+ }
+
+ fn constrain(&mut self, id: ItemId) -> ConstrainResult {
+ trace!("constrain: {:?}", id);
+
+ if self.cannot_derive_partialeq.contains(&id) {
+ trace!(" already know it cannot derive PartialEq");
+ return ConstrainResult::Same;
+ }
+
+ let item = self.ctx.resolve_item(id);
+ let ty = match item.as_type() {
+ Some(ty) => ty,
+ None => {
+ trace!(" not a type; ignoring");
+ return ConstrainResult::Same;
+ }
+ };
+
+ trace!("ty: {:?}", ty);
+ if item.is_opaque(self.ctx, &()) {
+ let layout_can_derive = ty.layout(self.ctx).map_or(true, |l| {
+ l.opaque().can_trivially_derive_partialeq()
+ });
+ return if layout_can_derive {
+ trace!(" we can trivially derive PartialEq for the layout");
+ ConstrainResult::Same
+ } else {
+ trace!(" we cannot derive PartialEq for the layout");
+ self.insert(id)
+ };
+ }
+
+ if ty.layout(self.ctx).map_or(false, |l| l.align > RUST_DERIVE_IN_ARRAY_LIMIT) {
+ // We have to be conservative: the struct *could* have enough
+ // padding that we emit an array that is longer than
+ // `RUST_DERIVE_IN_ARRAY_LIMIT`. If we moved padding calculations
+ // into the IR and computed them before this analysis, then we could
+ // be precise rather than conservative here.
+ return self.insert(id);
+ }
+
+ match *ty.kind() {
+ // Handle the simple cases. These can derive partialeq without further
+ // information.
+ TypeKind::Void |
+ TypeKind::NullPtr |
+ TypeKind::Int(..) |
+ TypeKind::Complex(..) |
+ TypeKind::Float(..) |
+ TypeKind::Enum(..) |
+ TypeKind::Named |
+ TypeKind::UnresolvedTypeRef(..) |
+ TypeKind::BlockPointer |
+ TypeKind::Reference(..) |
+ TypeKind::ObjCInterface(..) |
+ TypeKind::ObjCId |
+ TypeKind::ObjCSel => {
+ trace!(" simple type that can always derive PartialEq");
+ ConstrainResult::Same
+ }
+
+ TypeKind::Array(t, len) => {
+ if self.cannot_derive_partialeq.contains(&t) {
+ trace!(" arrays of T for which we cannot derive PartialEq \
+ also cannot derive PartialEq");
+ return self.insert(id);
+ }
+
+ if len <= RUST_DERIVE_IN_ARRAY_LIMIT {
+ trace!(" array is small enough to derive PartialEq");
+ ConstrainResult::Same
+ } else {
+ trace!(" array is too large to derive PartialEq");
+ self.insert(id)
+ }
+ }
+
+ TypeKind::Pointer(inner) => {
+ let inner_type = self.ctx.resolve_type(inner).canonical_type(self.ctx);
+ if let TypeKind::Function(ref sig) = *inner_type.kind() {
+ if !sig.can_trivially_derive_partialeq() {
+ trace!(" function pointer that can't trivially derive PartialEq");
+ return self.insert(id);
+ }
+ }
+ trace!(" pointers can derive PartialEq");
+ ConstrainResult::Same
+ }
+
+ TypeKind::Function(ref sig) => {
+ if !sig.can_trivially_derive_partialeq() {
+ trace!(" function that can't trivially derive PartialEq");
+ return self.insert(id);
+ }
+ trace!(" function can derive PartialEq");
+ ConstrainResult::Same
+ }
+
+ TypeKind::ResolvedTypeRef(t) |
+ TypeKind::TemplateAlias(t, _) |
+ TypeKind::Alias(t) => {
+ if self.cannot_derive_partialeq.contains(&t) {
+ trace!(" aliases and type refs to T which cannot derive \
+ PartialEq also cannot derive PartialEq");
+ self.insert(id)
+ } else {
+ trace!(" aliases and type refs to T which can derive \
+ PartialEq can also derive PartialEq");
+ ConstrainResult::Same
+ }
+ }
+
+ TypeKind::Comp(ref info) => {
+ assert!(
+ !info.has_non_type_template_params(),
+ "The early ty.is_opaque check should have handled this case"
+ );
+
+ if info.kind() == CompKind::Union {
+ if self.ctx.options().rust_features().untagged_union() {
+ trace!(" cannot derive PartialEq for Rust unions");
+ return self.insert(id);
+ }
+
+ if ty.layout(self.ctx)
+ .map_or(true,
+ |l| l.opaque().can_trivially_derive_partialeq()) {
+ trace!(" union layout can trivially derive PartialEq");
+ return ConstrainResult::Same;
+ } else {
+ trace!(" union layout cannot derive PartialEq");
+ return self.insert(id);
+ }
+ }
+
+ let bases_cannot_derive = info.base_members()
+ .iter()
+ .any(|base| !self.ctx.whitelisted_items().contains(&base.ty) ||
+ self.cannot_derive_partialeq.contains(&base.ty));
+ if bases_cannot_derive {
+ trace!(" base members cannot derive PartialEq, so we can't \
+ either");
+ return self.insert(id);
+ }
+
+ let fields_cannot_derive = info.fields()
+ .iter()
+ .any(|f| {
+ match *f {
+ Field::DataMember(ref data) => {
+ !self.ctx.whitelisted_items().contains(&data.ty()) ||
+ self.cannot_derive_partialeq.contains(&data.ty())
+ }
+ Field::Bitfields(ref bfu) => {
+ bfu.bitfields()
+ .iter().any(|b| {
+ !self.ctx.whitelisted_items().contains(&b.ty()) ||
+ self.cannot_derive_partialeq.contains(&b.ty())
+ })
+ }
+ }
+ });
+ if fields_cannot_derive {
+ trace!(" fields cannot derive PartialEq, so we can't either");
+ return self.insert(id);
+ }
+
+ trace!(" comp can derive PartialEq");
+ ConstrainResult::Same
+ }
+
+ TypeKind::TemplateInstantiation(ref template) => {
+ let args_cannot_derive = template.template_arguments()
+ .iter()
+ .any(|arg| self.cannot_derive_partialeq.contains(&arg));
+ if args_cannot_derive {
+ trace!(" template args cannot derive PartialEq, so \
+ insantiation can't either");
+ return self.insert(id);
+ }
+
+ assert!(
+ !template.template_definition().is_opaque(self.ctx, &()),
+ "The early ty.is_opaque check should have handled this case"
+ );
+ let def_cannot_derive = self.cannot_derive_partialeq
+ .contains(&template.template_definition());
+ if def_cannot_derive {
+ trace!(" template definition cannot derive PartialEq, so \
+ insantiation can't either");
+ return self.insert(id);
+ }
+
+ trace!(" template instantiation can derive PartialEq");
+ ConstrainResult::Same
+ }
+
+ TypeKind::Opaque => {
+ unreachable!(
+ "The early ty.is_opaque check should have handled this case"
+ )
+ }
+ }
+ }
+
+ fn each_depending_on<F>(&self, id: ItemId, mut f: F)
+ where F: FnMut(ItemId),
+ {
+ if let Some(edges) = self.dependencies.get(&id) {
+ for item in edges {
+ trace!("enqueue {:?} into worklist", item);
+ f(*item);
+ }
+ }
+ }
+}
+
+impl<'ctx, 'gen> From<CannotDerivePartialEq<'ctx, 'gen>> for HashSet<ItemId> {
+ fn from(analysis: CannotDerivePartialEq<'ctx, 'gen>) -> Self {
+ analysis.cannot_derive_partialeq
+ }
+}
diff --git a/src/ir/analysis/mod.rs b/src/ir/analysis/mod.rs
index 28ca09aa..ef42e58d 100644
--- a/src/ir/analysis/mod.rs
+++ b/src/ir/analysis/mod.rs
@@ -53,6 +53,8 @@ mod has_type_param_in_array;
pub use self::has_type_param_in_array::HasTypeParameterInArray;
mod derive_hash;
pub use self::derive_hash::CannotDeriveHash;
+mod derive_partial_eq;
+pub use self::derive_partial_eq::CannotDerivePartialEq;
use ir::context::{BindgenContext, ItemId};
use ir::traversal::{EdgeKind, Trace};
diff --git a/src/ir/context.rs b/src/ir/context.rs
index a2493aee..edf320bf 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -1,13 +1,13 @@
//! Common context that is passed around during parsing and codegen.
-use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash};
+use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash, CanDerivePartialEq};
use super::int::IntKind;
use super::item::{IsOpaque, HasTypeParamInArray, Item, ItemAncestors, ItemCanonicalPath, ItemSet};
use super::item_kind::ItemKind;
use super::module::{Module, ModuleKind};
use super::analysis::{analyze, UsedTemplateParameters, CannotDeriveDebug, HasVtableAnalysis,
CannotDeriveDefault, CannotDeriveCopy, HasTypeParameterInArray,
- CannotDeriveHash};
+ CannotDeriveHash, CannotDerivePartialEq};
use super::template::{TemplateInstantiation, TemplateParameters};
use super::traversal::{self, Edge, ItemTraversal};
use super::ty::{FloatKind, Type, TypeKind};
@@ -65,6 +65,12 @@ impl CanDeriveHash for ItemId {
}
}
+impl CanDerivePartialEq for ItemId {
+ fn can_derive_partialeq(&self, ctx: &BindgenContext) -> bool {
+ ctx.options().derive_partialeq && ctx.lookup_item_id_can_derive_partialeq(*self)
+ }
+}
+
/// A key used to index a resolved type, so we only process it once.
///
/// This is almost always a USR string (an unique identifier generated by
@@ -207,6 +213,12 @@ pub struct BindgenContext<'ctx> {
/// and is always `None` before that and `Some` after.
cannot_derive_hash: Option<HashSet<ItemId>>,
+ /// The set of (`ItemId`s of) types that can't derive hash.
+ ///
+ /// This is populated when we enter codegen by `compute_can_derive_partialeq`
+ /// and is always `None` before that and `Some` after.
+ cannot_derive_partialeq: Option<HashSet<ItemId>>,
+
/// The set of (`ItemId's of`) types that has vtable.
///
/// Populated when we enter codegen by `compute_has_vtable`; always `None`
@@ -348,6 +360,7 @@ impl<'ctx> BindgenContext<'ctx> {
cannot_derive_copy: None,
cannot_derive_copy_in_array: None,
cannot_derive_hash: None,
+ cannot_derive_partialeq: None,
have_vtable: None,
has_type_param_in_array: None,
};
@@ -827,6 +840,7 @@ impl<'ctx> BindgenContext<'ctx> {
self.compute_cannot_derive_copy();
self.compute_has_type_param_in_array();
self.compute_cannot_derive_hash();
+ self.compute_cannot_derive_partialeq();
let ret = cb(self);
self.gen_ctx = None;
@@ -1844,6 +1858,23 @@ impl<'ctx> BindgenContext<'ctx> {
!self.cannot_derive_hash.as_ref().unwrap().contains(&id)
}
+ /// Compute whether we can derive hash.
+ fn compute_cannot_derive_partialeq(&mut self) {
+ assert!(self.cannot_derive_partialeq.is_none());
+ self.cannot_derive_partialeq = Some(analyze::<CannotDerivePartialEq>(self));
+ }
+
+ /// Look up whether the item with `id` can
+ /// derive partialeq or not.
+ pub fn lookup_item_id_can_derive_partialeq(&self, id: ItemId) -> bool {
+ assert!(self.in_codegen_phase(),
+ "We only compute can_derive_debug when we enter codegen");
+
+ // Look up the computed value for whether the item with `id` can
+ // derive partialeq or not.
+ !self.cannot_derive_partialeq.as_ref().unwrap().contains(&id)
+ }
+
/// Look up whether the item with `id` can
/// derive copy or not.
pub fn lookup_item_id_can_derive_copy(&self, id: ItemId) -> bool {
diff --git a/src/ir/derive.rs b/src/ir/derive.rs
index 128ef9f2..acbe20fd 100644
--- a/src/ir/derive.rs
+++ b/src/ir/derive.rs
@@ -88,6 +88,22 @@ pub trait CanDeriveHash {
-> bool;
}
+/// A trait that encapsulates the logic for whether or not we can derive `PartialEq`
+/// for a given thing.
+///
+/// This should ideally be a no-op that just returns `true`, but instead needs
+/// to be a recursive method that checks whether all the proper members can
+/// derive default or not, because of the limit rust has on 32 items as max in the
+/// array.
+pub trait CanDerivePartialEq {
+
+ /// Return `true` if `Default` can be derived for this thing, `false`
+ /// otherwise.
+ fn can_derive_partialeq(&self,
+ ctx: &BindgenContext)
+ -> bool;
+}
+
/// A trait that encapsulates the logic for whether or not we can derive `Hash`.
/// The difference between this trait and the CanDeriveHash is that the type
/// implementing this trait cannot use recursion or lookup result from fix point
@@ -98,3 +114,14 @@ pub trait CanTriviallyDeriveHash {
/// otherwise.
fn can_trivially_derive_hash(&self) -> bool;
}
+
+/// A trait that encapsulates the logic for whether or not we can derive `PartialEq`.
+/// The difference between this trait and the CanDerivePartialEq is that the type
+/// implementing this trait cannot use recursion or lookup result from fix point
+/// analysis. It's a helper trait for fix point analysis.
+pub trait CanTriviallyDerivePartialEq {
+
+ /// Return `true` if `PartialEq` can be derived for this thing, `false`
+ /// otherwise.
+ fn can_trivially_derive_partialeq(&self) -> bool;
+}
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 20c026a4..241dcefe 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -8,7 +8,7 @@ use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::TypeKind;
use clang;
use clang_sys::{self, CXCallingConv};
-use ir::derive::{CanTriviallyDeriveDebug, CanTriviallyDeriveHash};
+use ir::derive::{CanTriviallyDeriveDebug, CanTriviallyDeriveHash, CanTriviallyDerivePartialEq};
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use std::io;
use syntax::abi;
@@ -508,3 +508,17 @@ impl CanTriviallyDeriveHash for FunctionSig {
}
}
}
+
+impl CanTriviallyDerivePartialEq for FunctionSig {
+ fn can_trivially_derive_partialeq(&self) -> bool {
+ if self.argument_types.len() > RUST_DERIVE_FUNPTR_LIMIT {
+ return false;
+ }
+
+ match self.abi {
+ Abi::Known(abi::Abi::C) |
+ Abi::Unknown(..) => true,
+ _ => false,
+ }
+ }
+}
diff --git a/src/ir/item.rs b/src/ir/item.rs
index b51a45ac..4109b5e8 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -5,7 +5,8 @@ use super::annotations::Annotations;
use super::comment;
use super::comp::MethodKind;
use super::context::{BindgenContext, ItemId, PartialType};
-use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash};
+use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveHash,
+ CanDerivePartialEq};
use super::dot::DotAttributes;
use super::function::{Function, FunctionKind};
use super::item_kind::ItemKind;
@@ -300,6 +301,12 @@ impl CanDeriveHash for Item {
}
}
+impl CanDerivePartialEq for Item {
+ fn can_derive_partialeq(&self, ctx: &BindgenContext) -> bool {
+ ctx.options().derive_partialeq && ctx.lookup_item_id_can_derive_partialeq(self.id())
+ }
+}
+
/// An item is the base of the bindgen representation, it can be either a
/// module, a type, a function, or a variable (see `ItemKind` for more
/// information).
diff --git a/src/ir/layout.rs b/src/ir/layout.rs
index bac664f1..60cf4678 100644
--- a/src/ir/layout.rs
+++ b/src/ir/layout.rs
@@ -2,7 +2,7 @@
use super::derive::{CanTriviallyDeriveDebug,
CanTriviallyDeriveDefault, CanTriviallyDeriveCopy,
- CanTriviallyDeriveHash};
+ CanTriviallyDeriveHash, CanTriviallyDerivePartialEq};
use super::ty::{RUST_DERIVE_IN_ARRAY_LIMIT, Type, TypeKind};
use clang;
use std::{cmp, mem};
@@ -132,3 +132,11 @@ impl CanTriviallyDeriveHash for Opaque {
.map_or(false, |size| size <= RUST_DERIVE_IN_ARRAY_LIMIT)
}
}
+
+impl CanTriviallyDerivePartialEq for Opaque {
+
+ fn can_trivially_derive_partialeq(&self) -> bool {
+ self.array_size()
+ .map_or(false, |size| size <= RUST_DERIVE_IN_ARRAY_LIMIT)
+ }
+}
diff --git a/src/lib.rs b/src/lib.rs
index 12ab8ac2..74a20292 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -262,6 +262,10 @@ impl Builder {
output_vector.push("--with-derive-hash".into());
}
+ if self.options.derive_partialeq {
+ output_vector.push("--with-derive-partialeq".into());
+ }
+
if !self.options.generate_comments {
output_vector.push("--no-doc-comments".into());
}
@@ -721,6 +725,12 @@ impl Builder {
self
}
+ /// Set whether `PartialEq` should be derived by default.
+ pub fn derive_partialeq(mut self, doit: bool) -> Self {
+ self.options.derive_partialeq = doit;
+ self
+ }
+
/// Emit Clang AST.
pub fn emit_clang_ast(mut self) -> Builder {
self.options.emit_ast = true;
@@ -1055,6 +1065,10 @@ pub struct BindgenOptions {
/// and types.
pub derive_hash: bool,
+ /// True if we should derive PartialEq trait implementations for C/C++ structures
+ /// and types.
+ pub derive_partialeq: bool,
+
/// True if we should avoid using libstd to use libcore instead.
pub use_core: bool,
@@ -1198,6 +1212,7 @@ impl Default for BindgenOptions {
impl_debug: false,
derive_default: false,
derive_hash: false,
+ derive_partialeq: false,
enable_cxx_namespaces: false,
disable_name_namespacing: false,
use_core: false,
diff --git a/src/options.rs b/src/options.rs
index 7b5169b7..6640fad4 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -76,6 +76,9 @@ where
Arg::with_name("with-derive-hash")
.long("with-derive-hash")
.help("Derive hash on any type."),
+ Arg::with_name("with-derive-partialeq")
+ .long("with-derive-partialeq")
+ .help("Derive partialeq on any type."),
Arg::with_name("no-doc-comments")
.long("no-doc-comments")
.help("Avoid including doc comments in the output, see: \
@@ -314,6 +317,10 @@ where
builder = builder.derive_hash(true);
}
+ if matches.is_present("with-derive-partialeq") {
+ builder = builder.derive_partialeq(true);
+ }
+
if matches.is_present("no-derive-default") {
builder = builder.derive_default(false);
}
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 72f2a8a9..45ec2ead 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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 1068f3f5..ee8a3261 100644
--- a/tests/expectations/tests/16-byte-alignment_1_0.rs
+++ b/tests/expectations/tests/16-byte-alignment_1_0.rs
@@ -31,22 +31,25 @@ 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 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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
@@ -119,21 +122,21 @@ impl Clone for rte_ipv4_tuple {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs
index 715688ff..b1004274 100644
--- a/tests/expectations/tests/anon_enum.rs
+++ b/tests/expectations/tests/anon_enum.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct Test {
pub foo: ::std::os::raw::c_int,
pub bar: f32,
diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs
index 38ed0268..c2ae221b 100644
--- a/tests/expectations/tests/anon_enum_trait.rs
+++ b/tests/expectations/tests/anon_enum_trait.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct DataType {
pub _address: u8,
}
@@ -27,7 +27,7 @@ pub const DataType_type_: DataType__bindgen_ty_1 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum DataType__bindgen_ty_1 { generic_type = 0, }
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Foo {
pub _address: u8,
}
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index 02a3d314..9dbf30de 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -16,7 +16,7 @@ pub union s__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct s__bindgen_ty_1_inner {
pub b: ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs
index b4820319..74b6fe4a 100644
--- a/tests/expectations/tests/anon_struct_in_union_1_0.rs
+++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs
@@ -31,19 +31,22 @@ 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 s {
pub u: s__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct s__bindgen_ty_1 {
pub field: __BindgenUnionField<s__bindgen_ty_1_inner>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct s__bindgen_ty_1_inner {
pub b: ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs
index d1c51f29..a055cbe5 100644
--- a/tests/expectations/tests/anon_union.rs
+++ b/tests/expectations/tests/anon_union.rs
@@ -17,12 +17,12 @@ pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TErrorResult_UnionState { HasMessage = 0, }
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult_Message {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult_DOMExceptionInfo {
pub _address: u8,
}
diff --git a/tests/expectations/tests/anon_union_1_0.rs b/tests/expectations/tests/anon_union_1_0.rs
index 71c2d4f7..64a17776 100644
--- a/tests/expectations/tests/anon_union_1_0.rs
+++ b/tests/expectations/tests/anon_union_1_0.rs
@@ -31,8 +31,11 @@ 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, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult {
pub mResult: ::std::os::raw::c_int,
pub __bindgen_anon_1: TErrorResult__bindgen_ty_1,
@@ -45,17 +48,17 @@ pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TErrorResult_UnionState { HasMessage = 0, }
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult_Message {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult_DOMExceptionInfo {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct TErrorResult__bindgen_ty_1 {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
@@ -65,7 +68,7 @@ impl Default for TErrorResult {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ErrorResult {
pub _base: TErrorResult,
}
diff --git a/tests/expectations/tests/anonymous-template-types.rs b/tests/expectations/tests/anonymous-template-types.rs
index 6d231330..cc682751 100644
--- a/tests/expectations/tests/anonymous-template-types.rs
+++ b/tests/expectations/tests/anonymous-template-types.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Foo<T> {
pub t_member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -14,12 +14,12 @@ impl <T> Default for Foo<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Bar {
pub member: ::std::os::raw::c_char,
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Quux<V> {
pub v_member: V,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
@@ -28,7 +28,7 @@ impl <V> Default for Quux<V> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Lobo {
pub also_member: ::std::os::raw::c_char,
}
diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs
index f34e075d..ac1700f5 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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Test {
pub ch: ::std::os::raw::c_char,
pub u: ::std::os::raw::c_uchar,
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/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs
index 08d5d453..805733c7 100644
--- a/tests/expectations/tests/complex.rs
+++ b/tests/expectations/tests/complex.rs
@@ -11,7 +11,7 @@ pub struct __BindgenComplex<T> {
pub im: T,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct TestDouble {
pub mMember: __BindgenComplex<f64>,
}
@@ -31,7 +31,7 @@ impl Clone for TestDouble {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct TestDoublePtr {
pub mMember: *mut __BindgenComplex<f64>,
}
@@ -54,7 +54,7 @@ impl Default for TestDoublePtr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, PartialEq)]
pub struct TestFloat {
pub mMember: __BindgenComplex<f32>,
}
@@ -74,7 +74,7 @@ impl Clone for TestFloat {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct TestFloatPtr {
pub mMember: *mut __BindgenComplex<f32>,
}
diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs
index fca1f4e5..c98f2ec7 100644
--- a/tests/expectations/tests/derive-fn-ptr.rs
+++ b/tests/expectations/tests/derive-fn-ptr.rs
@@ -58,7 +58,7 @@ pub type my_fun2_t =
arg11: ::std::os::raw::c_int,
arg12: ::std::os::raw::c_int)>;
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct Bar {
pub callback: my_fun2_t,
}
diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
index 007fd2f9..a11d738f 100644
--- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
@@ -4,9 +4,9 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// Pointers can derive hash
+/// Pointers can derive hash/PartialEq
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ConstPtrMutObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -29,7 +29,7 @@ impl Default for ConstPtrMutObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct MutPtrMutObj {
pub bar: *mut ::std::os::raw::c_int,
}
@@ -52,7 +52,7 @@ impl Default for MutPtrMutObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct MutPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -75,7 +75,7 @@ impl Default for MutPtrConstObj {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ConstPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs
index 07f27e54..aff9d14d 100644
--- a/tests/expectations/tests/empty_template_param_name.rs
+++ b/tests/expectations/tests/empty_template_param_name.rs
@@ -6,7 +6,7 @@
pub type __void_t = ::std::os::raw::c_void;
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct __iterator_traits {
pub _address: u8,
}
diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs
index a855d8cf..d0e076ee 100644
--- a/tests/expectations/tests/func_ptr_in_struct.rs
+++ b/tests/expectations/tests/func_ptr_in_struct.rs
@@ -7,7 +7,7 @@
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum baz { }
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct Foo {
pub bar: ::std::option::Option<unsafe extern "C" fn(x:
::std::os::raw::c_int,
diff --git a/tests/expectations/tests/issue-493.rs b/tests/expectations/tests/issue-493.rs
index 21a08233..d5486ccc 100644
--- a/tests/expectations/tests/issue-493.rs
+++ b/tests/expectations/tests/issue-493.rs
@@ -31,8 +31,11 @@ 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, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string {
pub _address: u8,
}
@@ -40,7 +43,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)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___long {
pub __cap_: basic_string_size_type,
pub __size_: basic_string_size_type,
@@ -86,7 +89,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)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
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 d25bb4a0..4ddc6188 100644
--- a/tests/expectations/tests/issue-493_1_0.rs
+++ b/tests/expectations/tests/issue-493_1_0.rs
@@ -31,8 +31,11 @@ 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, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string {
pub _address: u8,
}
@@ -40,7 +43,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)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___long {
pub __cap_: basic_string_size_type,
pub __size_: basic_string_size_type,
@@ -55,13 +58,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)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___short__bindgen_ty_1 {
pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
pub __lx: __BindgenUnionField<basic_string_value_type>,
@@ -86,7 +89,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)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct basic_string___raw {
pub __words: *mut basic_string_size_type,
}
diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
index 0e22eedf..b77b0e60 100644
--- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
+++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
@@ -30,8 +30,8 @@ impl Clone for NoDebug {
impl Default for NoDebug {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/// This should derive Debug/Hash because the padding size is less than the max derive
-/// Debug/Hash impl for arrays. However, we conservatively don't derive Debug/Hash because
+/// 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
/// we determine Debug derive-ability before we compute padding, which happens at
/// codegen. (Again, we expect to get the alignment wrong for similar reasons.)
#[repr(C)]
diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
index cd2c4fac..b1462ca9 100644
--- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs
+++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
@@ -10,7 +10,7 @@ pub struct A {
_unused: [u8; 0],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct B {
pub _bindgen_opaque_blob: u8,
}
@@ -29,7 +29,7 @@ extern "C" {
pub static mut B_a: A;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct C {
pub b: B,
}
diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
index 2826ec5d..debfd32e 100644
--- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
+++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Pupper {
pub _address: u8,
}
@@ -20,7 +20,7 @@ impl Clone for Pupper {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Doggo {
pub _address: u8,
}
@@ -35,7 +35,7 @@ impl Clone for Doggo {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct SuchWow {
pub _address: u8,
}
@@ -50,7 +50,7 @@ impl Clone for SuchWow {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Opaque {
pub _bindgen_opaque_blob: u8,
}
@@ -89,7 +89,7 @@ extern "C" {
pub static mut Opaque_MAJESTIC_AF: Doggo;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Whitelisted {
pub some_member: Opaque,
}
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index e052b4d5..587fafe3 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -84,7 +84,7 @@ pub union jsval_layout {
_bindgen_union_align: u64,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct jsval_layout__bindgen_ty_1 {
pub _bitfield_1: u64,
pub __bindgen_align: [u64; 0usize],
diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
index 536d8c59..fd71f862 100644
--- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs
+++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
@@ -31,6 +31,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 }
+}
pub const JSVAL_TAG_SHIFT: ::std::os::raw::c_uint = 47;
pub const JSVAL_PAYLOAD_MASK: ::std::os::raw::c_ulonglong = 140737488355327;
pub const JSVAL_TAG_MASK: ::std::os::raw::c_longlong = -140737488355328;
@@ -99,7 +102,7 @@ pub enum JSWhyMagic {
JS_WHY_MAGIC_COUNT = 18,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct jsval_layout {
pub asBits: __BindgenUnionField<u64>,
pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>,
@@ -111,7 +114,7 @@ pub struct jsval_layout {
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct jsval_layout__bindgen_ty_1 {
pub _bitfield_1: u64,
pub __bindgen_align: [u64; 0usize],
@@ -217,12 +220,12 @@ impl jsval_layout__bindgen_ty_1 {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct jsval_layout__bindgen_ty_2 {
pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct jsval_layout__bindgen_ty_2__bindgen_ty_1 {
pub i32: __BindgenUnionField<i32>,
pub u32: __BindgenUnionField<u32>,
@@ -329,7 +332,7 @@ impl Clone for jsval_layout {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Value {
pub data: jsval_layout,
}
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index 8ec289d4..081000bd 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -106,7 +106,7 @@ impl Default for rte_mempool_ops {
}
/// The rte_spinlock_t type.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_spinlock_t {
/// < lock status 0 = unlocked, 1 = locked
pub locked: ::std::os::raw::c_int,
@@ -181,7 +181,7 @@ pub struct malloc_heap {
pub total_size: usize,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct malloc_heap__bindgen_ty_1 {
pub lh_first: *mut malloc_elem,
}
@@ -239,7 +239,7 @@ impl Default for malloc_heap {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct malloc_elem {
pub _address: u8,
}
diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs
index 6078e2cc..b68d9a33 100644
--- a/tests/expectations/tests/layout_array_too_long.rs
+++ b/tests/expectations/tests/layout_array_too_long.rs
@@ -20,7 +20,7 @@ pub enum _bindgen_ty_1 {
}
/// @internal fragmented mbuf
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ip_frag {
/// < offset into the packet
pub ofs: u16,
@@ -59,7 +59,7 @@ impl Default for ip_frag {
}
/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct ip_frag_key {
/// < src address, first 8 bytes used for IPv4
pub src_dst: [u64; 4usize],
@@ -115,7 +115,7 @@ pub struct ip_frag_pkt {
pub __bindgen_padding_0: [u64; 6usize],
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ip_frag_pkt__bindgen_ty_1 {
pub tqe_next: *mut ip_frag_pkt,
pub tqe_prev: *mut *mut ip_frag_pkt,
@@ -196,7 +196,7 @@ impl Default for ip_frag_pkt {
}
/// < fragment mbuf
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf {
pub _address: u8,
}
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index 962cc52f..1926ae7c 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -52,7 +52,7 @@ pub enum rte_eth_rx_mq_mode {
}
/// A structure used to configure the RX features of an Ethernet port.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_rxmode {
/// The multi-queue packet distribution mode to be used, e.g. RSS.
pub mq_mode: rte_eth_rx_mq_mode,
@@ -470,7 +470,7 @@ pub enum rte_eth_tx_mq_mode {
}
/// A structure used to configure the TX features of an Ethernet port.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_txmode {
/// < TX multi-queues mode.
pub mq_mode: rte_eth_tx_mq_mode,
@@ -641,7 +641,7 @@ impl rte_eth_txmode {
/// types of IPv4/IPv6 packets to which the RSS hashing must be applied.
/// Supplying an *rss_hf* equal to zero disables the RSS feature.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_rss_conf {
/// < If not NULL, 40-byte hash key.
pub rss_key: *mut u8,
@@ -718,7 +718,7 @@ pub struct rte_eth_vmdq_dcb_conf {
pub dcb_tc: [u8; 8usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -798,7 +798,7 @@ impl Default for rte_eth_vmdq_dcb_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_dcb_rx_conf {
/// < Possible DCB TCs, 4 or 8 TCs
pub nb_tcs: rte_eth_nb_tcs,
@@ -830,7 +830,7 @@ impl Default for rte_eth_dcb_rx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_dcb_tx_conf {
/// < With DCB, 16 or 32 pools.
pub nb_queue_pools: rte_eth_nb_pools,
@@ -864,7 +864,7 @@ impl Default for rte_eth_vmdq_dcb_tx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_dcb_tx_conf {
/// < Possible DCB TCs, 4 or 8 TCs.
pub nb_tcs: rte_eth_nb_tcs,
@@ -896,7 +896,7 @@ impl Default for rte_eth_dcb_tx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_tx_conf {
/// < VMDq mode, 64 pools.
pub nb_queue_pools: rte_eth_nb_pools,
@@ -939,7 +939,7 @@ pub struct rte_eth_vmdq_rx_conf {
pub pool_map: [rte_eth_vmdq_rx_conf__bindgen_ty_1; 64usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -1052,7 +1052,7 @@ pub enum rte_fdir_status_mode {
}
/// A structure used to define the input for IPV4 flow
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_ipv4_flow {
/// < IPv4 source address in big endian.
pub src_ip: u32,
@@ -1102,7 +1102,7 @@ impl Clone for rte_eth_ipv4_flow {
}
/// A structure used to define the input for IPV6 flow
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_ipv6_flow {
/// < IPv6 source address in big endian.
pub src_ip: [u32; 4usize],
@@ -1153,7 +1153,7 @@ impl Clone for rte_eth_ipv6_flow {
/// A structure used to configure FDIR masks that are used by the device
/// to match the various fields of RX packet headers.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_masks {
/// < Bit mask for vlan_tci in big endian
pub vlan_tci_mask: u16,
@@ -1239,7 +1239,7 @@ pub enum rte_eth_payload_type {
/// A structure used to select bytes extracted from the protocol layers to
/// flexible payload for filter
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_flex_payload_cfg {
/// < Payload type
pub type_: rte_eth_payload_type,
@@ -1274,7 +1274,7 @@ impl Default for rte_eth_flex_payload_cfg {
/// A structure used to define FDIR masks for flexible payload
/// for each flow type
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_flex_mask {
pub flow_type: u16,
pub mask: [u8; 16usize],
@@ -1304,7 +1304,7 @@ impl Clone for rte_eth_fdir_flex_mask {
/// A structure used to define all flexible payload related setting
/// include flex payload and flex mask
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_flex_conf {
/// < The number of following payload cfg
pub nb_payloads: u16,
@@ -1353,7 +1353,7 @@ impl Default for rte_eth_fdir_flex_conf {
///
/// If mode is RTE_FDIR_DISABLE, the pballoc value is ignored.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_fdir_conf {
/// < Flow Director mode.
pub mode: rte_fdir_mode,
@@ -1411,7 +1411,7 @@ impl Default for rte_fdir_conf {
}
/// A structure used to enable/disable specific device interrupts.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_intr_conf {
/// enable/disable lsc interrupt. 0 (default) - disable, 1 enable
pub lsc: u16,
diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs
index 6cf37ac5..b845321e 100644
--- a/tests/expectations/tests/layout_eth_conf_1_0.rs
+++ b/tests/expectations/tests/layout_eth_conf_1_0.rs
@@ -31,6 +31,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 }
+}
pub const ETH_MQ_RX_RSS_FLAG: ::std::os::raw::c_uint = 1;
pub const ETH_MQ_RX_DCB_FLAG: ::std::os::raw::c_uint = 2;
pub const ETH_MQ_RX_VMDQ_FLAG: ::std::os::raw::c_uint = 4;
@@ -79,7 +82,7 @@ pub enum rte_eth_rx_mq_mode {
}
/// A structure used to configure the RX features of an Ethernet port.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_rxmode {
/// The multi-queue packet distribution mode to be used, e.g. RSS.
pub mq_mode: rte_eth_rx_mq_mode,
@@ -497,7 +500,7 @@ pub enum rte_eth_tx_mq_mode {
}
/// A structure used to configure the TX features of an Ethernet port.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_txmode {
/// < TX multi-queues mode.
pub mq_mode: rte_eth_tx_mq_mode,
@@ -668,7 +671,7 @@ impl rte_eth_txmode {
/// types of IPv4/IPv6 packets to which the RSS hashing must be applied.
/// Supplying an *rss_hf* equal to zero disables the RSS feature.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_rss_conf {
/// < If not NULL, 40-byte hash key.
pub rss_key: *mut u8,
@@ -745,7 +748,7 @@ pub struct rte_eth_vmdq_dcb_conf {
pub dcb_tc: [u8; 8usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -825,7 +828,7 @@ impl Default for rte_eth_vmdq_dcb_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_dcb_rx_conf {
/// < Possible DCB TCs, 4 or 8 TCs
pub nb_tcs: rte_eth_nb_tcs,
@@ -857,7 +860,7 @@ impl Default for rte_eth_dcb_rx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_dcb_tx_conf {
/// < With DCB, 16 or 32 pools.
pub nb_queue_pools: rte_eth_nb_pools,
@@ -891,7 +894,7 @@ impl Default for rte_eth_vmdq_dcb_tx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_dcb_tx_conf {
/// < Possible DCB TCs, 4 or 8 TCs.
pub nb_tcs: rte_eth_nb_tcs,
@@ -923,7 +926,7 @@ impl Default for rte_eth_dcb_tx_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_tx_conf {
/// < VMDq mode, 64 pools.
pub nb_queue_pools: rte_eth_nb_pools,
@@ -966,7 +969,7 @@ pub struct rte_eth_vmdq_rx_conf {
pub pool_map: [rte_eth_vmdq_rx_conf__bindgen_ty_1; 64usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -1079,7 +1082,7 @@ pub enum rte_fdir_status_mode {
}
/// A structure used to define the input for IPV4 flow
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_ipv4_flow {
/// < IPv4 source address in big endian.
pub src_ip: u32,
@@ -1129,7 +1132,7 @@ impl Clone for rte_eth_ipv4_flow {
}
/// A structure used to define the input for IPV6 flow
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_ipv6_flow {
/// < IPv6 source address in big endian.
pub src_ip: [u32; 4usize],
@@ -1180,7 +1183,7 @@ impl Clone for rte_eth_ipv6_flow {
/// A structure used to configure FDIR masks that are used by the device
/// to match the various fields of RX packet headers.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_masks {
/// < Bit mask for vlan_tci in big endian
pub vlan_tci_mask: u16,
@@ -1266,7 +1269,7 @@ pub enum rte_eth_payload_type {
/// A structure used to select bytes extracted from the protocol layers to
/// flexible payload for filter
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_flex_payload_cfg {
/// < Payload type
pub type_: rte_eth_payload_type,
@@ -1301,7 +1304,7 @@ impl Default for rte_eth_flex_payload_cfg {
/// A structure used to define FDIR masks for flexible payload
/// for each flow type
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_flex_mask {
pub flow_type: u16,
pub mask: [u8; 16usize],
@@ -1331,7 +1334,7 @@ impl Clone for rte_eth_fdir_flex_mask {
/// A structure used to define all flexible payload related setting
/// include flex payload and flex mask
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_eth_fdir_flex_conf {
/// < The number of following payload cfg
pub nb_payloads: u16,
@@ -1380,7 +1383,7 @@ impl Default for rte_eth_fdir_flex_conf {
///
/// If mode is RTE_FDIR_DISABLE, the pballoc value is ignored.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct rte_fdir_conf {
/// < Flow Director mode.
pub mode: rte_fdir_mode,
@@ -1438,7 +1441,7 @@ impl Default for rte_fdir_conf {
}
/// A structure used to enable/disable specific device interrupts.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_intr_conf {
/// enable/disable lsc interrupt. 0 (default) - disable, 1 enable
pub lsc: u16,
@@ -1551,7 +1554,7 @@ impl Default for rte_eth_conf__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 rte_eth_conf__bindgen_ty_2 {
pub vmdq_dcb_tx_conf: __BindgenUnionField<rte_eth_vmdq_dcb_tx_conf>,
pub dcb_tx_conf: __BindgenUnionField<rte_eth_dcb_tx_conf>,
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index 2cfd88ab..b336e548 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -12,7 +12,7 @@ pub type MARKER8 = [u8; 0usize];
pub type MARKER64 = [u64; 0usize];
/// The atomic counter structure.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_atomic16_t {
/// < An internal counter value.
pub cnt: i16,
@@ -128,7 +128,7 @@ pub union rte_mbuf__bindgen_ty_2 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_1: [u8; 4usize],
pub __bindgen_align: [u32; 0usize],
@@ -480,7 +480,7 @@ pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
pub hash: u16,
pub id: u16,
@@ -570,7 +570,7 @@ impl Default for rte_mbuf__bindgen_ty_3__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 rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
pub lo: u32,
pub hi: u32,
@@ -679,7 +679,7 @@ pub union rte_mbuf__bindgen_ty_5 {
_bindgen_union_align: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
pub _bitfield_1: [u16; 4usize],
pub __bindgen_align: [u64; 0usize],
@@ -1079,7 +1079,7 @@ impl Default for rte_mbuf {
}
/// < Pool from which mbuf was allocated.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mempool {
pub _address: u8,
}
diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs
index 5e08af3c..afe46930 100644
--- a/tests/expectations/tests/layout_mbuf_1_0.rs
+++ b/tests/expectations/tests/layout_mbuf_1_0.rs
@@ -31,6 +31,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 }
+}
pub const RTE_CACHE_LINE_MIN_SIZE: ::std::os::raw::c_uint = 64;
pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
pub type phys_addr_t = u64;
@@ -39,7 +42,7 @@ pub type MARKER8 = [u8; 0usize];
pub type MARKER64 = [u64; 0usize];
/// The atomic counter structure.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_atomic16_t {
/// < An internal counter value.
pub cnt: i16,
@@ -113,7 +116,7 @@ pub struct rte_mbuf {
/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
/// config option.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_1 {
/// < Atomically accessed refcnt
pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>,
@@ -144,7 +147,7 @@ impl Clone for rte_mbuf__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_2 {
/// < L2/L3/L4 and tunnel information.
pub packet_type: __BindgenUnionField<u32>,
@@ -152,7 +155,7 @@ pub struct rte_mbuf__bindgen_ty_2 {
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_1: [u8; 4usize],
pub __bindgen_align: [u32; 0usize],
@@ -475,7 +478,7 @@ impl Clone for rte_mbuf__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3 {
/// < RSS hash result if RSS enabled
pub rss: __BindgenUnionField<u32>,
@@ -488,20 +491,20 @@ pub struct rte_mbuf__bindgen_ty_3 {
pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
pub hi: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1>,
pub lo: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
pub hash: u16,
pub id: u16,
@@ -585,7 +588,7 @@ impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
pub lo: u32,
pub hi: u32,
@@ -649,7 +652,7 @@ impl Clone for rte_mbuf__bindgen_ty_3 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_4 {
/// < Can be used for external metadata
pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>,
@@ -680,7 +683,7 @@ impl Clone for rte_mbuf__bindgen_ty_4 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_5 {
/// < combined for easy fetch
pub tx_offload: __BindgenUnionField<u64>,
@@ -688,7 +691,7 @@ pub struct rte_mbuf__bindgen_ty_5 {
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
pub _bitfield_1: [u16; 4usize],
pub __bindgen_align: [u64; 0usize],
@@ -1085,7 +1088,7 @@ impl Default for rte_mbuf {
}
/// < Pool from which mbuf was allocated.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct rte_mempool {
pub _address: u8,
}
diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs
index 8c098c8f..848babe4 100644
--- a/tests/expectations/tests/opaque-template-inst-member-2.rs
+++ b/tests/expectations/tests/opaque-template-inst-member-2.rs
@@ -5,14 +5,14 @@
/// This is like `opaque-template-inst-member.hpp` except exercising the cases
-/// where we are OK to derive Debug/Hash.
+/// where we are OK to derive Debug/Hash/PartialEq.
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct OpaqueTemplate {
}
-/// Should derive Debug/Hash.
+/// Should derive Debug/Hash/PartialEq.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct ContainsOpaqueTemplate {
pub mBlah: u32,
pub mBaz: ::std::os::raw::c_int,
@@ -39,9 +39,9 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() {
impl Clone for ContainsOpaqueTemplate {
fn clone(&self) -> Self { *self }
}
-/// Should also derive Debug/Hash.
+/// Should also derive Debug/Hash/PartialEq.
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct InheritsOpaqueTemplate {
pub _base: u8,
pub wow: *mut ::std::os::raw::c_char,
diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs
index 11c3cc84..bab28917 100644
--- a/tests/expectations/tests/opaque-template-inst-member.rs
+++ b/tests/expectations/tests/opaque-template-inst-member.rs
@@ -5,11 +5,11 @@
#[repr(C)]
-#[derive(Default, Copy, Clone, Hash)]
+#[derive(Default, Copy, Clone, Hash, PartialEq)]
pub struct OpaqueTemplate {
}
-/// This should not end up deriving Debug/Hash because its `mBlah` field cannot derive
-/// Debug/Hash because the instantiation's definition cannot derive Debug/Hash.
+/// This should not end up deriving Debug/Hash/PartialEq because its `mBlah` field cannot derive
+/// Debug/Hash/PartialEq because the instantiation's definition cannot derive Debug/Hash/PartialEq.
#[repr(C)]
pub struct ContainsOpaqueTemplate {
pub mBlah: [u32; 101usize],
@@ -37,7 +37,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() {
impl Default for ContainsOpaqueTemplate {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/// This shold not end up deriving Debug/Hash either, for similar reasons, although
+/// This shold not end up deriving Debug/Hash/PartialEq either, for similar reasons, although
/// we're exercising base member edges now.
#[repr(C)]
pub struct InheritsOpaqueTemplate {
diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
index 396edbd6..6fc0f840 100644
--- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
+++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
@@ -12,7 +12,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Copy, Clone, Hash)]
+ #[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Template<T> {
pub member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -21,7 +21,7 @@ pub mod root {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash)]
+ #[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Foo {
pub c: ::std::os::raw::c_char,
}
@@ -41,7 +41,7 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash)]
+ #[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Bar {
pub i: ::std::os::raw::c_int,
}
@@ -61,7 +61,7 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
- #[derive(Debug, Copy, Hash)]
+ #[derive(Debug, Copy, Hash, PartialEq)]
pub struct ContainsInstantiation {
pub not_opaque: root::zoidberg::Template<root::zoidberg::Foo>,
}
@@ -89,7 +89,7 @@ pub mod root {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash)]
+ #[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct ContainsOpaqueInstantiation {
pub opaque: u32,
}
diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs
index aafe702f..89f42e53 100644
--- a/tests/expectations/tests/opaque-template-instantiation.rs
+++ b/tests/expectations/tests/opaque-template-instantiation.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Template<T> {
pub member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -14,7 +14,7 @@ impl <T> Default for Template<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct ContainsInstantiation {
pub not_opaque: Template<::std::os::raw::c_char>,
}
@@ -39,7 +39,7 @@ impl Default for ContainsInstantiation {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct ContainsOpaqueInstantiation {
pub opaque: u32,
}
diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs
index 5113ccf3..a5e0dc2b 100644
--- a/tests/expectations/tests/opaque-tracing.rs
+++ b/tests/expectations/tests/opaque-tracing.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Container {
pub _bindgen_opaque_blob: [u32; 2usize],
}
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
index db85246a..29da8da4 100644
--- a/tests/expectations/tests/opaque_in_struct.rs
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -6,7 +6,7 @@
/// <div rustbindgen opaque>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct opaque {
pub _bindgen_opaque_blob: u32,
}
@@ -21,7 +21,7 @@ impl Clone for opaque {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct container {
pub contained: opaque,
}
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
index 2e566dc4..7988a261 100644
--- a/tests/expectations/tests/opaque_pointer.rs
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -6,7 +6,7 @@
/// <div rustbindgen opaque></div>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct OtherOpaque {
pub _bindgen_opaque_blob: u32,
}
@@ -22,11 +22,11 @@ impl Clone for OtherOpaque {
}
/// <div rustbindgen opaque></div>
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Opaque {
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct WithOpaquePtr {
pub whatever: *mut u8,
pub other: u32,
diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs
index 53cf6f64..09717396 100644
--- a/tests/expectations/tests/opaque_typedef.rs
+++ b/tests/expectations/tests/opaque_typedef.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct RandomTemplate {
pub _address: u8,
}
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
index b72d67c9..5bd5b394 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, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 c01d3963..834a6de9 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
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 47234321..4180564c 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, Hash)]
+ #[derive(Debug, Default, Copy, Hash, PartialEq)]
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, Hash)]
+ #[derive(Debug, Default, Copy, Hash, PartialEq)]
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 26e06c0b..f31f0b1b 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 a2ab1b2b..7baf1022 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 cfe5dbd7..4636e5c8 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, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct foo {
pub bar: *mut foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs
index 84be35ed..e39a0934 100644
--- a/tests/expectations/tests/struct_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs
@@ -31,13 +31,16 @@ 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 foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 8a5d6194..7e0f7e19 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
index 226f7db9..d0b86cb8 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
@@ -31,13 +31,16 @@ 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 foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 97cefe06..6455356a 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 2fd00fb1..18e50353 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 ef7a9365..4df90fd0 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -19,7 +19,7 @@ pub union foo__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub c1: ::std::os::raw::c_ushort,
pub c2: ::std::os::raw::c_ushort,
@@ -51,7 +51,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs
index 63df2729..6e06a368 100644
--- a/tests/expectations/tests/struct_with_nesting_1_0.rs
+++ b/tests/expectations/tests/struct_with_nesting_1_0.rs
@@ -31,14 +31,17 @@ 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 foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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>,
@@ -46,7 +49,7 @@ pub struct foo__bindgen_ty_1 {
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub c1: ::std::os::raw::c_ushort,
pub c2: ::std::os::raw::c_ushort,
@@ -78,7 +81,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 7e587a07..e0731da4 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 d6509a14..ad8551a3 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, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 7566bf4a..15d48e05 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, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Proxy {
pub _address: u8,
}
diff --git a/tests/expectations/tests/template-fun-ty.rs b/tests/expectations/tests/template-fun-ty.rs
index a4c8ad44..1cecdada 100644
--- a/tests/expectations/tests/template-fun-ty.rs
+++ b/tests/expectations/tests/template-fun-ty.rs
@@ -5,19 +5,19 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Foo {
pub _address: u8,
}
pub type Foo_FunctionPtr<T> =
::std::option::Option<unsafe extern "C" fn() -> T>;
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct RefPtr {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct RefPtr_Proxy {
pub _address: u8,
}
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index f2d639b6..ff18874d 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct Foo<T> {
pub m_member: T,
pub m_member_ptr: *mut T,
@@ -16,7 +16,7 @@ impl <T> Default for Foo<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct B<T> {
pub m_member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -34,7 +34,7 @@ pub struct mozilla_Foo {
_unused: [u8; 0],
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct C {
pub mB: B<::std::os::raw::c_uint>,
pub mBConstPtr: B<*const ::std::os::raw::c_int>,
@@ -140,13 +140,13 @@ impl Default for C {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct D {
pub m_foo: D_MyFoo,
}
pub type D_MyFoo = Foo<::std::os::raw::c_int>;
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct D_U<Z> {
pub m_nested_foo: D_MyFoo,
pub m_baz: Z,
@@ -159,7 +159,7 @@ impl Default for D {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Rooted<T> {
pub prev: *mut T,
pub next: *mut Rooted<*mut ::std::os::raw::c_void>,
@@ -170,7 +170,7 @@ impl <T> Default for Rooted<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct RootedContainer {
pub root: Rooted<*mut ::std::os::raw::c_void>,
}
@@ -193,7 +193,7 @@ impl Default for RootedContainer {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct WithDtor<T> {
pub member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -203,7 +203,7 @@ impl <T> Default for WithDtor<T> {
}
pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>;
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct PODButContainsDtor {
pub member: WithDtorIntFwd,
}
@@ -224,11 +224,11 @@ impl Default for PODButContainsDtor {
}
/// <div rustbindgen opaque>
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Opaque {
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct POD {
pub opaque_member: u32,
}
@@ -249,7 +249,7 @@ impl Clone for POD {
}
/// <div rustbindgen replaces="NestedReplaced"></div>
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct NestedReplaced<T> {
pub buff: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -258,7 +258,7 @@ impl <T> Default for NestedReplaced<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct NestedBase<T> {
pub buff: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -267,7 +267,7 @@ impl <T> Default for NestedBase<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Incomplete<T> {
pub d: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -276,7 +276,7 @@ impl <T> Default for Incomplete<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct NestedContainer<T> {
pub c: T,
pub nested: NestedReplaced<T>,
@@ -287,7 +287,7 @@ impl <T> Default for NestedContainer<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct Untemplated {
pub _address: u8,
}
@@ -302,7 +302,7 @@ impl Clone for Untemplated {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Templated {
pub m_untemplated: Untemplated,
}
@@ -311,7 +311,7 @@ pub struct Templated {
///
/// <div rustbindgen replaces="ReplacedWithoutDestructor"></div>
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct ReplacedWithoutDestructor<T> {
pub buff: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -320,7 +320,7 @@ impl <T> Default for ReplacedWithoutDestructor<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct ShouldNotBeCopiable<T> {
pub m_member: ReplacedWithoutDestructor<T>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
@@ -329,7 +329,7 @@ impl <T> Default for ShouldNotBeCopiable<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct ShouldNotBeCopiableAsWell<U> {
pub m_member: ReplacedWithoutDestructorFwd<U>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
@@ -342,7 +342,7 @@ impl <U> Default for ShouldNotBeCopiableAsWell<U> {
///
/// <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div>
#[repr(C)]
-#[derive(Debug, Hash)]
+#[derive(Debug, Hash, PartialEq)]
pub struct ReplacedWithoutDestructorFwd<T> {
pub buff: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs
index 537fc376..1857e714 100644
--- a/tests/expectations/tests/template_alias.rs
+++ b/tests/expectations/tests/template_alias.rs
@@ -6,7 +6,7 @@
pub type JS_detail_Wrapped<T> = T;
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct JS_Rooted<T> {
pub ptr: JS_detail_Wrapped<T>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs
index ba94dd7d..46db54dd 100644
--- a/tests/expectations/tests/template_alias_namespace.rs
+++ b/tests/expectations/tests/template_alias_namespace.rs
@@ -17,7 +17,7 @@ pub mod root {
pub type Wrapped<T> = T;
}
#[repr(C)]
- #[derive(Debug, Copy, Clone, Hash)]
+ #[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Rooted<T> {
pub ptr: root::JS::detail::Wrapped<T>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs
index 6a0026fb..d3114413 100644
--- a/tests/expectations/tests/template_typedef_transitive_param.rs
+++ b/tests/expectations/tests/template_typedef_transitive_param.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Wrapper {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Copy, Clone, Hash)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct Wrapper_Wrapped<T> {
pub t: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
diff --git a/tests/expectations/tests/templateref_opaque.rs b/tests/expectations/tests/templateref_opaque.rs
index a20dd691..3f119382 100644
--- a/tests/expectations/tests/templateref_opaque.rs
+++ b/tests/expectations/tests/templateref_opaque.rs
@@ -5,13 +5,13 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct detail_PointerType {
pub _address: u8,
}
pub type detail_PointerType_Type<T> = *mut T;
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct UniquePtr {
pub _address: u8,
}
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index 044b8eaa..0a4edf4c 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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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)]
+#[derive(Debug, Copy, Hash, PartialEq)]
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 43427f08..d472f02b 100644
--- a/tests/expectations/tests/typeref_1_0.rs
+++ b/tests/expectations/tests/typeref_1_0.rs
@@ -31,8 +31,11 @@ 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 nsFoo {
pub mBar: mozilla_StyleShapeSource,
}
@@ -52,7 +55,7 @@ impl Clone for nsFoo {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_FragmentOrURL {
pub mIsLocalRef: bool,
}
@@ -74,7 +77,7 @@ impl Clone for mozilla_FragmentOrURL {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct mozilla_Position {
pub _address: u8,
}
@@ -89,19 +92,19 @@ impl Clone for mozilla_Position {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct mozilla_StyleShapeSource {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
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)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct Bar {
pub mFoo: *mut nsFoo,
}
diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs
index 968b1f83..aea426f4 100644
--- a/tests/expectations/tests/union-in-ns_1_0.rs
+++ b/tests/expectations/tests/union-in-ns_1_0.rs
@@ -37,6 +37,9 @@ pub mod root {
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 }
+ }
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs
index 6f7eba41..47ed49c2 100644
--- a/tests/expectations/tests/union_dtor_1_0.rs
+++ b/tests/expectations/tests/union_dtor_1_0.rs
@@ -31,6 +31,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(Debug, Default)]
pub struct UnionWithDtor {
diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs
index fd4ac5ab..2bbd90ed 100644
--- a/tests/expectations/tests/union_fields_1_0.rs
+++ b/tests/expectations/tests/union_fields_1_0.rs
@@ -31,8 +31,11 @@ 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 nsStyleUnion {
pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
pub mFloat: __BindgenUnionField<f32>,
diff --git a/tests/expectations/tests/union_template_1_0.rs b/tests/expectations/tests/union_template_1_0.rs
index df5e87ee..f322be64 100644
--- a/tests/expectations/tests/union_template_1_0.rs
+++ b/tests/expectations/tests/union_template_1_0.rs
@@ -31,29 +31,32 @@ 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, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct NastyStruct {
pub mIsSome: bool,
pub mStorage: NastyStruct__bindgen_ty_1,
pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct NastyStruct__bindgen_ty_1 {
pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct NastyStruct__bindgen_ty_2 {
pub wat: __BindgenUnionField<::std::os::raw::c_short>,
pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
pub bindgen_union_field: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, Hash)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Whatever {
pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index e6247bec..3526e674 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -11,7 +11,7 @@ pub union foo {
_bindgen_union_align: [u32; 2usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs
index 5afaa876..a04b59db 100644
--- a/tests/expectations/tests/union_with_anon_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs
@@ -31,14 +31,17 @@ 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 foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index 955548a0..68ba92e4 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -12,7 +12,7 @@ pub union foo {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
index ba1cdf47..29ca26cc 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield_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 foo {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs
index 99c0c817..0a96374f 100644
--- a/tests/expectations/tests/union_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_union_1_0.rs
@@ -31,14 +31,17 @@ 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 foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 6d0c381e..d5734f03 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -12,7 +12,7 @@ pub union pixel {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
index afe12dce..277071af 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_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 pixel {
pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
index 67dcd521..3f782a63 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union_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 foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs
index 836fe1a5..9ba01a14 100644
--- a/tests/expectations/tests/union_with_big_member_1_0.rs
+++ b/tests/expectations/tests/union_with_big_member_1_0.rs
@@ -31,6 +31,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 WithBigArray {
@@ -62,7 +65,7 @@ impl Default for WithBigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct WithBigArray2 {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs
index 59caccf4..73192a45 100644
--- a/tests/expectations/tests/union_with_nesting_1_0.rs
+++ b/tests/expectations/tests/union_with_nesting_1_0.rs
@@ -31,21 +31,24 @@ 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 foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
@@ -78,7 +81,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
pub struct foo__bindgen_ty_1__bindgen_ty_2 {
pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index 09c6a86e..508e3b5d 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)]
+#[derive(Debug, Copy, Hash, PartialEq)]
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 fd89783f..b382454a 100644
--- a/tests/expectations/tests/use-core_1_0.rs
+++ b/tests/expectations/tests/use-core_1_0.rs
@@ -32,8 +32,11 @@ impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
impl <T> ::core::hash::Hash for __BindgenUnionField<T> {
fn hash<H: ::core::hash::Hasher>(&self, _state: &mut H) { }
}
+impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> {
+ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true }
+}
#[repr(C)]
-#[derive(Debug, Copy, Hash)]
+#[derive(Debug, Copy, Hash, PartialEq)]
pub struct foo {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -68,7 +71,7 @@ impl Default for foo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash)]
+#[derive(Debug, Default, Copy, Hash, PartialEq)]
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 cca4d285..2fb3e2f3 100644
--- a/tests/headers/16-byte-alignment.h
+++ b/tests/headers/16-byte-alignment.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
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 f0ec0e64..89574e9f 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
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp
index 1a55a8d1..48df3c7a 100644
--- a/tests/headers/anon_enum.hpp
+++ b/tests/headers/anon_enum.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct Test {
int foo;
float bar;
diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp
index 22137392..7d164054 100644
--- a/tests/headers/anon_enum_trait.hpp
+++ b/tests/headers/anon_enum_trait.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template<typename _Tp>
class DataType {
diff --git a/tests/headers/anon_struct_in_union.h b/tests/headers/anon_struct_in_union.h
index 2e6ac5e9..98d55056 100644
--- a/tests/headers/anon_struct_in_union.h
+++ b/tests/headers/anon_struct_in_union.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct s {
union {
struct inner {
diff --git a/tests/headers/anon_struct_in_union_1_0.h b/tests/headers/anon_struct_in_union_1_0.h
index 5e5023ba..86e5ca73 100644
--- a/tests/headers/anon_struct_in_union_1_0.h
+++ b/tests/headers/anon_struct_in_union_1_0.h
@@ -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
struct s {
union {
diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp
index 250dcb1a..ca1d3bc1 100644
--- a/tests/headers/anon_union.hpp
+++ b/tests/headers/anon_union.hpp
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template<typename T>
struct TErrorResult {
enum UnionState {
diff --git a/tests/headers/anon_union_1_0.hpp b/tests/headers/anon_union_1_0.hpp
index 33ab48ca..1a5e2b0d 100644
--- a/tests/headers/anon_union_1_0.hpp
+++ b/tests/headers/anon_union_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
template<typename T>
struct TErrorResult {
diff --git a/tests/headers/anonymous-template-types.hpp b/tests/headers/anonymous-template-types.hpp
index 34924fc9..883f60f5 100644
--- a/tests/headers/anonymous-template-types.hpp
+++ b/tests/headers/anonymous-template-types.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash -- -std=c++14
+// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++14
template <typename T, typename>
struct Foo {
diff --git a/tests/headers/char.h b/tests/headers/char.h
index 8db9ccf0..71bce553 100644
--- a/tests/headers/char.h
+++ b/tests/headers/char.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
typedef char Char;
typedef signed char SChar;
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 {
diff --git a/tests/headers/complex.h b/tests/headers/complex.h
index 9696b606..d0fb05b4 100644
--- a/tests/headers/complex.h
+++ b/tests/headers/complex.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
#define COMPLEX_TEST(ty_, name_) \
struct Test##name_ { \
diff --git a/tests/headers/complex_global.h b/tests/headers/complex_global.h
index 7b9e8872..6ceb62da 100644
--- a/tests/headers/complex_global.h
+++ b/tests/headers/complex_global.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
float _Complex globalValueFloat;
double _Complex globalValueDouble;
long double _Complex globalValueLongDouble;
diff --git a/tests/headers/derive-fn-ptr.h b/tests/headers/derive-fn-ptr.h
index fb89daad..2dc36f3a 100644
--- a/tests/headers/derive-fn-ptr.h
+++ b/tests/headers/derive-fn-ptr.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
typedef void (*my_fun_t)(int, int, int, int,
int, int, int, int,
diff --git a/tests/headers/derive-hash-struct-with-pointer.h b/tests/headers/derive-hash-struct-with-pointer.h
index 262b6fb4..ed5199d4 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
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
-/// Pointers can derive hash
+/// Pointers can derive hash/PartialEq
struct ConstPtrMutObj {
int* const bar;
};
diff --git a/tests/headers/empty_template_param_name.hpp b/tests/headers/empty_template_param_name.hpp
index ef212d55..11b6221c 100644
--- a/tests/headers/empty_template_param_name.hpp
+++ b/tests/headers/empty_template_param_name.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
// bindgen-flags: -- -std=c++11
template<typename...> using __void_t = void;
diff --git a/tests/headers/func_ptr.h b/tests/headers/func_ptr.h
index 377c172f..bbbf677b 100644
--- a/tests/headers/func_ptr.h
+++ b/tests/headers/func_ptr.h
@@ -1,3 +1,3 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
int (*foo) (int x, int y);
diff --git a/tests/headers/func_ptr_in_struct.h b/tests/headers/func_ptr_in_struct.h
index 6340e3a6..8718dd9b 100644
--- a/tests/headers/func_ptr_in_struct.h
+++ b/tests/headers/func_ptr_in_struct.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
enum baz;
diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp
index 40105e29..7c58a351 100644
--- a/tests/headers/issue-493.hpp
+++ b/tests/headers/issue-493.hpp
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
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 ed8c7df8..2f43b16e 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
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
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 fbe98678..e3433b07 100644
--- a/tests/headers/issue-648-derive-debug-with-padding.h
+++ b/tests/headers/issue-648-derive-debug-with-padding.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
/**
* We emit a `[u8; 63usize]` padding field for this struct, which cannot derive
* Debug/Hash because 63 is over the hard coded limit. (Yes, this struct doesn't end
@@ -11,8 +11,8 @@ struct NoDebug {
} __attribute__((__aligned__(64)));
/**
- * This should derive Debug/Hash because the padding size is less than the max derive
- * Debug/Hash impl for arrays. However, we conservatively don't derive Debug/Hash because
+ * 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
* 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/issue-801-opaque-sloppiness.hpp b/tests/headers/issue-801-opaque-sloppiness.hpp
index 275be023..72d234fb 100644
--- a/tests/headers/issue-801-opaque-sloppiness.hpp
+++ b/tests/headers/issue-801-opaque-sloppiness.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --opaque-type "B" --whitelist-type "C" --with-derive-hash
+// bindgen-flags: --opaque-type "B" --whitelist-type "C" --with-derive-hash --with-derive-partialeq
class A;
diff --git a/tests/headers/issue-807-opaque-types-methods-being-generated.hpp b/tests/headers/issue-807-opaque-types-methods-being-generated.hpp
index f2133427..e66ccc5e 100644
--- a/tests/headers/issue-807-opaque-types-methods-being-generated.hpp
+++ b/tests/headers/issue-807-opaque-types-methods-being-generated.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --whitelist-type Whitelisted --opaque-type Opaque --with-derive-hash -- -std=c++11
+// bindgen-flags: --whitelist-type Whitelisted --opaque-type Opaque --with-derive-hash --with-derive-partialeq -- -std=c++11
// These types are not explicitly whitelisted, but are reachable through the
// opaque type.
diff --git a/tests/headers/jsval_layout_opaque.hpp b/tests/headers/jsval_layout_opaque.hpp
index 4a4f367b..6a730e8e 100644
--- a/tests/headers/jsval_layout_opaque.hpp
+++ b/tests/headers/jsval_layout_opaque.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
// bindgen-flags: -- -std=c++11
/**
diff --git a/tests/headers/jsval_layout_opaque_1_0.hpp b/tests/headers/jsval_layout_opaque_1_0.hpp
index edb84cb7..dd598274 100644
--- a/tests/headers/jsval_layout_opaque_1_0.hpp
+++ b/tests/headers/jsval_layout_opaque_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
/**
diff --git a/tests/headers/layout_array.h b/tests/headers/layout_array.h
index fb071df6..9db81f91 100644
--- a/tests/headers/layout_array.h
+++ b/tests/headers/layout_array.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
diff --git a/tests/headers/layout_array_too_long.h b/tests/headers/layout_array_too_long.h
index 61f0c269..9db20a36 100644
--- a/tests/headers/layout_array_too_long.h
+++ b/tests/headers/layout_array_too_long.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
diff --git a/tests/headers/layout_eth_conf.h b/tests/headers/layout_eth_conf.h
index ae3edad4..3c09f9f5 100644
--- a/tests/headers/layout_eth_conf.h
+++ b/tests/headers/layout_eth_conf.h
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
diff --git a/tests/headers/layout_eth_conf_1_0.h b/tests/headers/layout_eth_conf_1_0.h
index ed9c68ba..7fcbcddb 100644
--- a/tests/headers/layout_eth_conf_1_0.h
+++ b/tests/headers/layout_eth_conf_1_0.h
@@ -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
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
diff --git a/tests/headers/layout_mbuf.h b/tests/headers/layout_mbuf.h
index 9166bac7..0e82846b 100644
--- a/tests/headers/layout_mbuf.h
+++ b/tests/headers/layout_mbuf.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
#define RTE_CACHE_LINE_MIN_SIZE 64 /**< Minimum Cache line size. */
diff --git a/tests/headers/layout_mbuf_1_0.h b/tests/headers/layout_mbuf_1_0.h
index 18ca60c1..ed815acb 100644
--- a/tests/headers/layout_mbuf_1_0.h
+++ b/tests/headers/layout_mbuf_1_0.h
@@ -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
#define RTE_CACHE_LINE_MIN_SIZE 64 /**< Minimum Cache line size. */
diff --git a/tests/headers/opaque-template-inst-member-2.hpp b/tests/headers/opaque-template-inst-member-2.hpp
index 9d31fa31..09a4ea05 100644
--- a/tests/headers/opaque-template-inst-member-2.hpp
+++ b/tests/headers/opaque-template-inst-member-2.hpp
@@ -1,20 +1,20 @@
-// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash
+// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash --with-derive-partialeq
/// This is like `opaque-template-inst-member.hpp` except exercising the cases
-/// where we are OK to derive Debug/Hash.
+/// where we are OK to derive Debug/Hash/PartialEq.
template<typename T>
class OpaqueTemplate {
T mData;
};
-/// Should derive Debug/Hash.
+/// Should derive Debug/Hash/PartialEq.
class ContainsOpaqueTemplate {
OpaqueTemplate<int> mBlah;
int mBaz;
};
-/// Should also derive Debug/Hash.
+/// Should also derive Debug/Hash/PartialEq.
class InheritsOpaqueTemplate : public OpaqueTemplate<bool> {
char* wow;
};
diff --git a/tests/headers/opaque-template-inst-member.hpp b/tests/headers/opaque-template-inst-member.hpp
index d5954144..2586850f 100644
--- a/tests/headers/opaque-template-inst-member.hpp
+++ b/tests/headers/opaque-template-inst-member.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash
+// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash --with-derive-partialeq
template<typename T>
class OpaqueTemplate {
@@ -6,14 +6,14 @@ class OpaqueTemplate {
bool mCannotDebug[400];
};
-/// This should not end up deriving Debug/Hash because its `mBlah` field cannot derive
-/// Debug/Hash because the instantiation's definition cannot derive Debug/Hash.
+/// This should not end up deriving Debug/Hash/PartialEq because its `mBlah` field cannot derive
+/// Debug/Hash/PartialEq because the instantiation's definition cannot derive Debug/Hash/PartialEq.
class ContainsOpaqueTemplate {
OpaqueTemplate<int> mBlah;
int mBaz;
};
-/// This shold not end up deriving Debug/Hash either, for similar reasons, although
+/// This shold not end up deriving Debug/Hash/PartialEq either, for similar reasons, although
/// we're exercising base member edges now.
class InheritsOpaqueTemplate : public OpaqueTemplate<bool> {
char* wow;
diff --git a/tests/headers/opaque-template-instantiation-namespaced.hpp b/tests/headers/opaque-template-instantiation-namespaced.hpp
index 85513fdf..0c78fc7d 100644
--- a/tests/headers/opaque-template-instantiation-namespaced.hpp
+++ b/tests/headers/opaque-template-instantiation-namespaced.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --enable-cxx-namespaces --opaque-type 'zoidberg::Template<zoidberg::Bar>' --with-derive-hash -- -std=c++14
+// bindgen-flags: --enable-cxx-namespaces --opaque-type 'zoidberg::Template<zoidberg::Bar>' --with-derive-hash --with-derive-partialeq -- -std=c++14
namespace zoidberg {
diff --git a/tests/headers/opaque-template-instantiation.hpp b/tests/headers/opaque-template-instantiation.hpp
index fe29948d..f0c860f0 100644
--- a/tests/headers/opaque-template-instantiation.hpp
+++ b/tests/headers/opaque-template-instantiation.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --opaque-type 'Template<int>' --with-derive-hash -- -std=c++14
+// bindgen-flags: --opaque-type 'Template<int>' --with-derive-hash --with-derive-partialeq -- -std=c++14
template <typename T>
class Template {
diff --git a/tests/headers/opaque-tracing.hpp b/tests/headers/opaque-tracing.hpp
index 42ef3ccf..5ea72947 100644
--- a/tests/headers/opaque-tracing.hpp
+++ b/tests/headers/opaque-tracing.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --opaque-type=.* --whitelist-function=foo --with-derive-hash
+// bindgen-flags: --opaque-type=.* --whitelist-function=foo --with-derive-hash --with-derive-partialeq
class Container;
diff --git a/tests/headers/opaque_in_struct.hpp b/tests/headers/opaque_in_struct.hpp
index 771b80bc..2de2de3e 100644
--- a/tests/headers/opaque_in_struct.hpp
+++ b/tests/headers/opaque_in_struct.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
/** <div rustbindgen opaque> */
diff --git a/tests/headers/opaque_pointer.hpp b/tests/headers/opaque_pointer.hpp
index cc99df99..40475b8b 100644
--- a/tests/headers/opaque_pointer.hpp
+++ b/tests/headers/opaque_pointer.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
/**
* <div rustbindgen opaque></div>
diff --git a/tests/headers/opaque_typedef.hpp b/tests/headers/opaque_typedef.hpp
index f39f2fce..80586778 100644
--- a/tests/headers/opaque_typedef.hpp
+++ b/tests/headers/opaque_typedef.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash -- -std=c++11
+// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++11
template<typename T>
class RandomTemplate;
diff --git a/tests/headers/struct_containing_forward_declared_struct.h b/tests/headers/struct_containing_forward_declared_struct.h
index 68828192..c118786c 100644
--- a/tests/headers/struct_containing_forward_declared_struct.h
+++ b/tests/headers/struct_containing_forward_declared_struct.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct a {
struct b* val_a;
};
diff --git a/tests/headers/struct_typedef.h b/tests/headers/struct_typedef.h
index f8eacd87..b1f21354 100644
--- a/tests/headers/struct_typedef.h
+++ b/tests/headers/struct_typedef.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
typedef struct {
_Bool has_name;
diff --git a/tests/headers/struct_typedef_ns.hpp b/tests/headers/struct_typedef_ns.hpp
index 62a8ceac..bed8634b 100644
--- a/tests/headers/struct_typedef_ns.hpp
+++ b/tests/headers/struct_typedef_ns.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --enable-cxx-namespaces
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --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 e6a8ab97..4578a875 100644
--- a/tests/headers/struct_with_anon_struct.h
+++ b/tests/headers/struct_with_anon_struct.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct foo {
struct {
diff --git a/tests/headers/struct_with_anon_struct_array.h b/tests/headers/struct_with_anon_struct_array.h
index 459e274a..c66bb10e 100644
--- a/tests/headers/struct_with_anon_struct_array.h
+++ b/tests/headers/struct_with_anon_struct_array.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct foo {
struct {
diff --git a/tests/headers/struct_with_anon_struct_pointer.h b/tests/headers/struct_with_anon_struct_pointer.h
index de628402..5844b509 100644
--- a/tests/headers/struct_with_anon_struct_pointer.h
+++ b/tests/headers/struct_with_anon_struct_pointer.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct foo {
struct {
int a;
diff --git a/tests/headers/struct_with_anon_union.h b/tests/headers/struct_with_anon_union.h
index dd183b7a..1d7b7a43 100644
--- a/tests/headers/struct_with_anon_union.h
+++ b/tests/headers/struct_with_anon_union.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
struct foo {
union {
unsigned int a;
diff --git a/tests/headers/struct_with_anon_union_1_0.h b/tests/headers/struct_with_anon_union_1_0.h
index 65ec5951..c727ce41 100644
--- a/tests/headers/struct_with_anon_union_1_0.h
+++ b/tests/headers/struct_with_anon_union_1_0.h
@@ -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
struct foo {
union {
diff --git a/tests/headers/struct_with_anon_unnamed_struct.h b/tests/headers/struct_with_anon_unnamed_struct.h
index 5962a12c..399056e7 100644
--- a/tests/headers/struct_with_anon_unnamed_struct.h
+++ b/tests/headers/struct_with_anon_unnamed_struct.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
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 b4447528..1961ebc8 100644
--- a/tests/headers/struct_with_anon_unnamed_union.h
+++ b/tests/headers/struct_with_anon_unnamed_union.h
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct foo {
union {
unsigned int a;
diff --git a/tests/headers/struct_with_anon_unnamed_union_1_0.h b/tests/headers/struct_with_anon_unnamed_union_1_0.h
index 6fa955f1..1f8280cd 100644
--- a/tests/headers/struct_with_anon_unnamed_union_1_0.h
+++ b/tests/headers/struct_with_anon_unnamed_union_1_0.h
@@ -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
struct foo {
union {
diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h
index 88a167a0..7b58c4b8 100644
--- a/tests/headers/struct_with_bitfields.h
+++ b/tests/headers/struct_with_bitfields.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct bitfield {
unsigned short
diff --git a/tests/headers/struct_with_derive_debug.h b/tests/headers/struct_with_derive_debug.h
index d13bb466..493b29ca 100644
--- a/tests/headers/struct_with_derive_debug.h
+++ b/tests/headers/struct_with_derive_debug.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct LittleArray {
int a[32];
diff --git a/tests/headers/struct_with_large_array.hpp b/tests/headers/struct_with_large_array.hpp
index c9aaa697..2c925527 100644
--- a/tests/headers/struct_with_large_array.hpp
+++ b/tests/headers/struct_with_large_array.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct S {
char large_array[33];
diff --git a/tests/headers/struct_with_nesting.h b/tests/headers/struct_with_nesting.h
index 93231e33..532b46e2 100644
--- a/tests/headers/struct_with_nesting.h
+++ b/tests/headers/struct_with_nesting.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
struct foo {
unsigned int a;
union {
diff --git a/tests/headers/struct_with_nesting_1_0.h b/tests/headers/struct_with_nesting_1_0.h
index 94717a9e..125a9026 100644
--- a/tests/headers/struct_with_nesting_1_0.h
+++ b/tests/headers/struct_with_nesting_1_0.h
@@ -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
struct foo {
unsigned int a;
diff --git a/tests/headers/struct_with_packing.h b/tests/headers/struct_with_packing.h
index 2184e8ec..41b5840f 100644
--- a/tests/headers/struct_with_packing.h
+++ b/tests/headers/struct_with_packing.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct a {
char b;
diff --git a/tests/headers/struct_with_struct.h b/tests/headers/struct_with_struct.h
index 975b0af4..953472c8 100644
--- a/tests/headers/struct_with_struct.h
+++ b/tests/headers/struct_with_struct.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
//
struct foo {
struct {
diff --git a/tests/headers/struct_with_typedef_template_arg.hpp b/tests/headers/struct_with_typedef_template_arg.hpp
index f299e322..38a1ab3d 100644
--- a/tests/headers/struct_with_typedef_template_arg.hpp
+++ b/tests/headers/struct_with_typedef_template_arg.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template<typename T, typename ...Args>
struct Proxy {
typedef void (*foo)(T* bar);
diff --git a/tests/headers/template-fun-ty.hpp b/tests/headers/template-fun-ty.hpp
index cc33fb74..ea820e2a 100644
--- a/tests/headers/template-fun-ty.hpp
+++ b/tests/headers/template-fun-ty.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template <typename T>
class Foo
{
diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp
index 24638745..b7566c71 100644
--- a/tests/headers/template.hpp
+++ b/tests/headers/template.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash -- -std=c++11
+// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++11
//
template<typename T, typename U> class Foo {
T m_member;
diff --git a/tests/headers/template_alias.hpp b/tests/headers/template_alias.hpp
index 684bf286..1877db5c 100644
--- a/tests/headers/template_alias.hpp
+++ b/tests/headers/template_alias.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash -- -std=c++14
+// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++14
namespace JS {
namespace detail {
diff --git a/tests/headers/template_alias_namespace.hpp b/tests/headers/template_alias_namespace.hpp
index b24e4bd3..fafa6f27 100644
--- a/tests/headers/template_alias_namespace.hpp
+++ b/tests/headers/template_alias_namespace.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash --enable-cxx-namespaces -- -std=c++14
+// bindgen-flags: --with-derive-hash --with-derive-partialeq --enable-cxx-namespaces -- -std=c++14
namespace JS {
namespace detail {
diff --git a/tests/headers/template_typedef_transitive_param.hpp b/tests/headers/template_typedef_transitive_param.hpp
index 2c50cda6..0f657c1e 100644
--- a/tests/headers/template_typedef_transitive_param.hpp
+++ b/tests/headers/template_typedef_transitive_param.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
template<typename T>
struct Wrapper {
struct Wrapped {
diff --git a/tests/headers/templateref_opaque.hpp b/tests/headers/templateref_opaque.hpp
index 1dcf4778..e52f7e82 100644
--- a/tests/headers/templateref_opaque.hpp
+++ b/tests/headers/templateref_opaque.hpp
@@ -1,4 +1,4 @@
-// bindgen-flags: --with-derive-hash
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
namespace detail {
template<typename T>
diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp
index ff1d788e..d0710bfb 100644
--- a/tests/headers/typeref.hpp
+++ b/tests/headers/typeref.hpp
@@ -1,5 +1,4 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
struct nsFoo;
namespace mozilla {
diff --git a/tests/headers/typeref_1_0.hpp b/tests/headers/typeref_1_0.hpp
index 183cf7a1..0dad19b2 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
+// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq
struct nsFoo;
diff --git a/tests/headers/union_fields.hpp b/tests/headers/union_fields.hpp
index dd15d741..7397ad58 100644
--- a/tests/headers/union_fields.hpp
+++ b/tests/headers/union_fields.hpp
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
typedef union {
int mInt;
float mFloat;
diff --git a/tests/headers/union_fields_1_0.hpp b/tests/headers/union_fields_1_0.hpp
index 6f20900f..ef0272f0 100644
--- a/tests/headers/union_fields_1_0.hpp
+++ b/tests/headers/union_fields_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
typedef union {
int mInt;
diff --git a/tests/headers/union_template.hpp b/tests/headers/union_template.hpp
index c505cb72..fbebb44f 100644
--- a/tests/headers/union_template.hpp
+++ b/tests/headers/union_template.hpp
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
template<typename T>
struct NastyStruct {
bool mIsSome;
diff --git a/tests/headers/union_template_1_0.hpp b/tests/headers/union_template_1_0.hpp
index 22e46bfa..65a11b30 100644
--- a/tests/headers/union_template_1_0.hpp
+++ b/tests/headers/union_template_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
template<typename T>
struct NastyStruct {
diff --git a/tests/headers/union_with_anon_struct.h b/tests/headers/union_with_anon_struct.h
index 8f15eb49..5968a48c 100644
--- a/tests/headers/union_with_anon_struct.h
+++ b/tests/headers/union_with_anon_struct.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union foo {
struct {
unsigned int a;
diff --git a/tests/headers/union_with_anon_struct_1_0.h b/tests/headers/union_with_anon_struct_1_0.h
index 8c77734e..a24f5a90 100644
--- a/tests/headers/union_with_anon_struct_1_0.h
+++ b/tests/headers/union_with_anon_struct_1_0.h
@@ -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
union foo {
struct {
diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h
index d2ceac0d..8a6a6a74 100644
--- a/tests/headers/union_with_anon_struct_bitfield.h
+++ b/tests/headers/union_with_anon_struct_bitfield.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union foo {
int a;
struct {
diff --git a/tests/headers/union_with_anon_struct_bitfield_1_0.h b/tests/headers/union_with_anon_struct_bitfield_1_0.h
index f73591ec..ae069c50 100644
--- a/tests/headers/union_with_anon_struct_bitfield_1_0.h
+++ b/tests/headers/union_with_anon_struct_bitfield_1_0.h
@@ -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
union foo {
int a;
diff --git a/tests/headers/union_with_anon_union.h b/tests/headers/union_with_anon_union.h
index 730e17bb..8f76cbde 100644
--- a/tests/headers/union_with_anon_union.h
+++ b/tests/headers/union_with_anon_union.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union foo {
union {
unsigned int a;
diff --git a/tests/headers/union_with_anon_union_1_0.h b/tests/headers/union_with_anon_union_1_0.h
index cd6654d1..77876c08 100644
--- a/tests/headers/union_with_anon_union_1_0.h
+++ b/tests/headers/union_with_anon_union_1_0.h
@@ -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
union foo {
union {
diff --git a/tests/headers/union_with_anon_unnamed_struct.h b/tests/headers/union_with_anon_unnamed_struct.h
index 0d00c688..5214db4c 100644
--- a/tests/headers/union_with_anon_unnamed_struct.h
+++ b/tests/headers/union_with_anon_unnamed_struct.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union pixel {
unsigned int rgba;
struct {
diff --git a/tests/headers/union_with_anon_unnamed_struct_1_0.h b/tests/headers/union_with_anon_unnamed_struct_1_0.h
index be649c3f..a9954535 100644
--- a/tests/headers/union_with_anon_unnamed_struct_1_0.h
+++ b/tests/headers/union_with_anon_unnamed_struct_1_0.h
@@ -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
union pixel {
unsigned int rgba;
diff --git a/tests/headers/union_with_anon_unnamed_union.h b/tests/headers/union_with_anon_unnamed_union.h
index 163d3157..74345dd8 100644
--- a/tests/headers/union_with_anon_unnamed_union.h
+++ b/tests/headers/union_with_anon_unnamed_union.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union foo {
unsigned int a;
union {
diff --git a/tests/headers/union_with_anon_unnamed_union_1_0.h b/tests/headers/union_with_anon_unnamed_union_1_0.h
index 1d0421c9..bae55773 100644
--- a/tests/headers/union_with_anon_unnamed_union_1_0.h
+++ b/tests/headers/union_with_anon_unnamed_union_1_0.h
@@ -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
union foo {
unsigned int a;
diff --git a/tests/headers/union_with_big_member.h b/tests/headers/union_with_big_member.h
index 24d012da..7bff36ea 100644
--- a/tests/headers/union_with_big_member.h
+++ b/tests/headers/union_with_big_member.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union WithBigArray {
int a;
int b[33];
diff --git a/tests/headers/union_with_big_member_1_0.h b/tests/headers/union_with_big_member_1_0.h
index 9f2dfd28..2cffd2c5 100644
--- a/tests/headers/union_with_big_member_1_0.h
+++ b/tests/headers/union_with_big_member_1_0.h
@@ -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
union WithBigArray {
int a;
diff --git a/tests/headers/union_with_nesting.h b/tests/headers/union_with_nesting.h
index f3135b47..95c55581 100644
--- a/tests/headers/union_with_nesting.h
+++ b/tests/headers/union_with_nesting.h
@@ -1,5 +1,5 @@
-// bindgen-flags: --with-derive-hash
-
+// bindgen-flags: --with-derive-hash --with-derive-partialeq
+//
union foo {
unsigned int a;
struct {
diff --git a/tests/headers/union_with_nesting_1_0.h b/tests/headers/union_with_nesting_1_0.h
index bfd59635..e89c3212 100644
--- a/tests/headers/union_with_nesting_1_0.h
+++ b/tests/headers/union_with_nesting_1_0.h
@@ -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
union foo {
unsigned int a;
diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h
index b34a71e7..b5fd0515 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
+// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
struct foo {
int a, b;
diff --git a/tests/headers/use-core_1_0.h b/tests/headers/use-core_1_0.h
index fa3a9648..f525bccf 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
+// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq
struct foo {
int a, b;