diff options
200 files changed, 803 insertions, 414 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 2ab507da..7066003b 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -15,7 +15,7 @@ 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, CanDerivePartialEq}; + CanDeriveHash, CanDerivePartialEq, CanDeriveEq}; use ir::dot; use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue}; use ir::function::{Abi, Function, FunctionSig}; @@ -1516,6 +1516,10 @@ impl CodeGenerator for CompInfo { derives.push("PartialEq"); } + if item.can_derive_eq(ctx) { + derives.push("Eq"); + } + if !derives.is_empty() { attributes.push(attributes::derives(&derives)) } @@ -3617,6 +3621,12 @@ mod utils { } ).unwrap(); + let union_field_eq_impl = quote_item!(&ctx.ext_cx(), + impl<T> ::$prefix::cmp::Eq for __BindgenUnionField<T> { + } + ) + .unwrap(); + let items = vec![union_field_decl, union_field_impl, union_field_default_impl, @@ -3624,7 +3634,8 @@ mod utils { union_field_copy_impl, union_field_debug_impl, union_field_hash_impl, - union_field_partialeq_impl]; + union_field_partialeq_impl, + union_field_eq_impl]; let old_items = mem::replace(result, items); result.extend(old_items.into_iter()); diff --git a/src/ir/analysis/has_float.rs b/src/ir/analysis/has_float.rs new file mode 100644 index 00000000..85fe241e --- /dev/null +++ b/src/ir/analysis/has_float.rs @@ -0,0 +1,239 @@ +//! Determining which types has float. + +use super::{ConstrainResult, MonotoneFramework, generate_dependencies}; +use std::collections::HashSet; +use std::collections::HashMap; +use ir::context::{BindgenContext, ItemId}; +use ir::traversal::EdgeKind; +use ir::ty::TypeKind; +use ir::comp::Field; +use ir::comp::FieldMethods; + +/// An analysis that finds for each IR item whether it has float or not. +/// +/// We use the monotone constraint function `has_float`, +/// defined as follows: +/// +/// * If T is float or complex float, T trivially has. +/// * If T is a type alias, a templated alias or an indirection to another type, +/// it has float if the type T refers to has. +/// * If T is a compound type, it has float if any of base memter or field +/// has. +/// * If T is an instantiation of an abstract template definition, T has +/// float if any of the template arguments or template definition +/// has. +#[derive(Debug, Clone)] +pub struct HasFloat<'ctx, 'gen> + where 'gen: 'ctx +{ + ctx: &'ctx BindgenContext<'gen>, + + // The incremental result of this analysis's computation. Everything in this + // set has float. + has_float: HashSet<ItemId>, + + // Dependencies saying that if a key ItemId has been inserted into the + // `has_float` 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 + // has float or not. + dependencies: HashMap<ItemId, Vec<ItemId>>, +} + +impl<'ctx, 'gen> HasFloat<'ctx, 'gen> { + fn consider_edge(kind: EdgeKind) -> bool { + match kind { + 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 has_float set", id); + + let was_not_already_in_set = self.has_float.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 HasFloat<'ctx, 'gen> { + type Node = ItemId; + type Extra = &'ctx BindgenContext<'gen>; + type Output = HashSet<ItemId>; + + fn new(ctx: &'ctx BindgenContext<'gen>) -> HasFloat<'ctx, 'gen> { + let has_float = HashSet::new(); + let dependencies = generate_dependencies(ctx, Self::consider_edge); + + HasFloat { + ctx, + has_float, + 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.has_float.contains(&id) { + trace!(" already know it do not have float"); + 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; + } + }; + + match *ty.kind() { + TypeKind::Void | + TypeKind::NullPtr | + TypeKind::Int(..) | + TypeKind::Function(..) | + TypeKind::Enum(..) | + TypeKind::Reference(..) | + TypeKind::BlockPointer | + TypeKind::TypeParam | + TypeKind::Opaque | + TypeKind::Pointer(..) | + TypeKind::UnresolvedTypeRef(..) | + TypeKind::ObjCInterface(..) | + TypeKind::ObjCId | + TypeKind::ObjCSel => { + trace!(" simple type that do not have float"); + ConstrainResult::Same + } + + TypeKind::Float(..) | + TypeKind::Complex(..) => { + trace!(" float type has float"); + self.insert(id) + } + + TypeKind::Array(t, _) => { + if self.has_float.contains(&t) { + trace!(" Array with type T that has float also has float"); + return self.insert(id) + } + trace!(" Array with type T that do not have float also do not have float"); + ConstrainResult::Same + } + + TypeKind::ResolvedTypeRef(t) | + TypeKind::TemplateAlias(t, _) | + TypeKind::Alias(t) => { + if self.has_float.contains(&t) { + trace!(" aliases and type refs to T which have float \ + also have float"); + self.insert(id) + } else { + trace!(" aliases and type refs to T which do not have float \ + also do not have floaarrayt"); + ConstrainResult::Same + } + } + + TypeKind::Comp(ref info) => { + let bases_have = info.base_members() + .iter() + .any(|base| self.has_float.contains(&base.ty)); + if bases_have { + trace!(" bases have float, so we also have"); + return self.insert(id); + } + let fields_have = info.fields() + .iter() + .any(|f| { + match *f { + Field::DataMember(ref data) => { + self.has_float.contains(&data.ty()) + } + Field::Bitfields(ref bfu) => { + bfu.bitfields() + .iter().any(|b| { + self.has_float.contains(&b.ty()) + }) + }, + } + }); + if fields_have { + trace!(" fields have float, so we also have"); + return self.insert(id); + } + + trace!(" comp doesn't have float"); + ConstrainResult::Same + } + + TypeKind::TemplateInstantiation(ref template) => { + let args_have = template.template_arguments() + .iter() + .any(|arg| self.has_float.contains(&arg)); + if args_have { + trace!(" template args have float, so \ + insantiation also has float"); + return self.insert(id); + } + + let def_has = self.has_float + .contains(&template.template_definition()); + if def_has { + trace!(" template definition has float, so \ + insantiation also has"); + return self.insert(id); + } + + trace!(" template instantiation do not have float"); + ConstrainResult::Same + } + } + } + + 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<HasFloat<'ctx, 'gen>> for HashSet<ItemId> { + fn from(analysis: HasFloat<'ctx, 'gen>) -> Self { + analysis.has_float + } +} diff --git a/src/ir/analysis/mod.rs b/src/ir/analysis/mod.rs index cf4e3b4d..42aa4a8f 100644 --- a/src/ir/analysis/mod.rs +++ b/src/ir/analysis/mod.rs @@ -55,6 +55,8 @@ mod derive_hash; pub use self::derive_hash::CannotDeriveHash; mod derive_partial_eq; pub use self::derive_partial_eq::CannotDerivePartialEq; +mod has_float; +pub use self::has_float::HasFloat; use ir::context::{BindgenContext, ItemId}; use ir::traversal::{EdgeKind, Trace}; diff --git a/src/ir/context.rs b/src/ir/context.rs index eb599dd0..67245c29 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -3,9 +3,10 @@ use super::analysis::{CannotDeriveCopy, CannotDeriveDebug, CannotDeriveDefault, CannotDeriveHash, CannotDerivePartialEq, HasTypeParameterInArray, - HasVtableAnalysis, UsedTemplateParameters, analyze}; + HasVtableAnalysis, UsedTemplateParameters, HasFloat, + analyze}; use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, - CanDeriveHash, CanDerivePartialEq}; + CanDeriveHash, CanDerivePartialEq, CanDeriveEq}; use super::int::IntKind; use super::item::{HasTypeParamInArray, IsOpaque, Item, ItemAncestors, ItemCanonicalPath, ItemSet}; @@ -76,6 +77,14 @@ impl CanDerivePartialEq for ItemId { } } +impl CanDeriveEq for ItemId { + fn can_derive_eq(&self, ctx: &BindgenContext) -> bool { + ctx.options().derive_eq && + ctx.lookup_item_id_can_derive_partialeq(*self) && + !ctx.lookup_item_id_has_float(&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 @@ -235,6 +244,12 @@ pub struct BindgenContext<'ctx> { /// Populated when we enter codegen by `compute_has_type_param_in_array`; always `None` /// before that and `Some` after. has_type_param_in_array: Option<HashSet<ItemId>>, + + /// The set of (`ItemId's of`) types that has float. + /// + /// Populated when we enter codegen by `compute_has_float`; always `None` + /// before that and `Some` after. + has_float: Option<HashSet<ItemId>>, } /// A traversal of whitelisted items. @@ -376,6 +391,7 @@ impl<'ctx> BindgenContext<'ctx> { cannot_derive_partialeq: None, have_vtable: None, has_type_param_in_array: None, + has_float: None, }; me.add_item(root_module, None, None); @@ -890,8 +906,9 @@ impl<'ctx> BindgenContext<'ctx> { self.compute_cannot_derive_default(); self.compute_cannot_derive_copy(); self.compute_has_type_param_in_array(); + self.compute_has_float(); self.compute_cannot_derive_hash(); - self.compute_cannot_derive_partialeq(); + self.compute_cannot_derive_partialeq_or_eq(); let ret = cb(self); self.gen_ctx = None; @@ -2018,12 +2035,12 @@ impl<'ctx> BindgenContext<'ctx> { !self.cannot_derive_hash.as_ref().unwrap().contains(&id) } - /// Compute whether we can derive partialeq. - fn compute_cannot_derive_partialeq(&mut self) { + /// Compute whether we can derive PartialEq. This method is also used in calculating + /// whether we can derive Eq + fn compute_cannot_derive_partialeq_or_eq(&mut self) { assert!(self.cannot_derive_partialeq.is_none()); - if self.options.derive_partialeq { - self.cannot_derive_partialeq = - Some(analyze::<CannotDerivePartialEq>(self)); + if self.options.derive_partialeq || self.options.derive_eq { + self.cannot_derive_partialeq = Some(analyze::<CannotDerivePartialEq>(self)); } } @@ -2072,6 +2089,24 @@ impl<'ctx> BindgenContext<'ctx> { // type parameter in array or not. self.has_type_param_in_array.as_ref().unwrap().contains(id) } + + /// Compute whether the type has float. + fn compute_has_float(&mut self) { + assert!(self.has_float.is_none()); + if self.options.derive_eq { + self.has_float = Some(analyze::<HasFloat>(self)); + } + } + + /// Look up whether the item with `id` has array or not. + pub fn lookup_item_id_has_float(&self, id: &ItemId) -> bool { + assert!(self.in_codegen_phase(), + "We only compute has float when we enter codegen"); + + // Look up the computed value for whether the item with `id` has + // float or not. + self.has_float.as_ref().unwrap().contains(id) + } } /// A builder struct for configuring item resolution options. diff --git a/src/ir/derive.rs b/src/ir/derive.rs index ef511694..909d5e42 100644 --- a/src/ir/derive.rs +++ b/src/ir/derive.rs @@ -92,6 +92,22 @@ pub trait CanDerivePartialEq { fn can_derive_partialeq(&self, ctx: &BindgenContext) -> bool; } +/// A trait that encapsulates the logic for whether or not we can derive `Eq` +/// 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 eq or not, because of the limit rust has on 32 items as max in the +/// array. +pub trait CanDeriveEq { + + /// Return `true` if `Eq` can be derived for this thing, `false` + /// otherwise. + fn can_derive_eq(&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 diff --git a/src/ir/item.rs b/src/ir/item.rs index dfb2697d..b6fe6d43 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -6,7 +6,7 @@ use super::comment; use super::comp::MethodKind; use super::context::{BindgenContext, ItemId, PartialType}; use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, - CanDeriveHash, CanDerivePartialEq}; + CanDeriveHash, CanDerivePartialEq, CanDeriveEq}; use super::dot::DotAttributes; use super::function::{Function, FunctionKind}; use super::item_kind::ItemKind; @@ -83,6 +83,12 @@ pub trait HasTypeParamInArray { fn has_type_param_in_array(&self, ctx: &BindgenContext) -> bool; } +/// A trait for determining if some IR thing has float or not. +pub trait HasFloat { + /// Returns `true` if the thing has float, and `false` otherwise. + fn has_float(&self, ctx: &BindgenContext) -> bool; +} + /// A trait for iterating over an item and its parents and up its ancestor chain /// up to (but not including) the implicit root module. pub trait ItemAncestors { @@ -340,6 +346,14 @@ impl CanDerivePartialEq for Item { } } +impl CanDeriveEq for Item { + fn can_derive_eq(&self, ctx: &BindgenContext) -> bool { + ctx.options().derive_eq && + ctx.lookup_item_id_can_derive_partialeq(self.id()) && + !ctx.lookup_item_id_has_float(&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). @@ -989,6 +1003,22 @@ impl HasTypeParamInArray for Item { } } +impl HasFloat for ItemId { + fn has_float(&self, ctx: &BindgenContext) -> bool { + debug_assert!(ctx.in_codegen_phase(), + "You're not supposed to call this yet"); + ctx.lookup_item_id_has_float(self) + } +} + +impl HasFloat for Item { + fn has_float(&self, ctx: &BindgenContext) -> bool { + debug_assert!(ctx.in_codegen_phase(), + "You're not supposed to call this yet"); + ctx.lookup_item_id_has_float(&self.id()) + } +} + /// A set of items. pub type ItemSet = BTreeSet<ItemId>; @@ -274,6 +274,10 @@ impl Builder { output_vector.push("--with-derive-partialeq".into()); } + if self.options.derive_eq { + output_vector.push("--with-derive-eq".into()); + } + if !self.options.generate_comments { output_vector.push("--no-doc-comments".into()); } @@ -751,8 +755,22 @@ impl Builder { } /// Set whether `PartialEq` should be derived by default. + /// If we don't compute partialeq, we also cannot compute + /// eq. Set the derive_eq to `false` when doit is `false`. pub fn derive_partialeq(mut self, doit: bool) -> Self { self.options.derive_partialeq = doit; + if !doit { + self.options.derive_eq = false; + } + self + } + + /// Set whether `Eq` should be derived by default. + /// We can't compute Eq without computing PartialEq, so + /// we set the same option to derive_partialeq. + pub fn derive_eq(mut self, doit: bool) -> Self { + self.options.derive_eq = doit; + self.options.derive_partialeq = doit; self } @@ -1094,6 +1112,10 @@ pub struct BindgenOptions { /// and types. pub derive_partialeq: bool, + /// True if we should derive Eq trait implementations for C/C++ structures + /// and types. + pub derive_eq: bool, + /// True if we should avoid using libstd to use libcore instead. pub use_core: bool, @@ -1237,6 +1259,7 @@ impl Default for BindgenOptions { derive_default: false, derive_hash: false, derive_partialeq: false, + derive_eq: false, enable_cxx_namespaces: false, disable_name_namespacing: false, use_core: false, diff --git a/src/options.rs b/src/options.rs index 68b127ae..780959e2 100644 --- a/src/options.rs +++ b/src/options.rs @@ -81,6 +81,9 @@ where Arg::with_name("with-derive-partialeq") .long("with-derive-partialeq") .help("Derive partialeq on any type."), + Arg::with_name("with-derive-eq") + .long("with-derive-eq") + .help("Derive eq on any type. Enable this option also enables --with-derive-partialeq"), Arg::with_name("no-doc-comments") .long("no-doc-comments") .help("Avoid including doc comments in the output, see: \ @@ -325,6 +328,10 @@ where builder = builder.derive_partialeq(true); } + if matches.is_present("with-derive-eq") { + builder = builder.derive_eq(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 45ec2ead..86103656 100644 --- a/tests/expectations/tests/16-byte-alignment.rs +++ b/tests/expectations/tests/16-byte-alignment.rs @@ -19,7 +19,7 @@ pub union rte_ipv4_tuple__bindgen_ty_1 { _bindgen_union_align: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, @@ -112,7 +112,7 @@ pub union rte_ipv6_tuple__bindgen_ty_1 { _bindgen_union_align: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs index ee8a3261..98cb1a49 100644 --- a/tests/expectations/tests/16-byte-alignment_1_0.rs +++ b/tests/expectations/tests/16-byte-alignment_1_0.rs @@ -34,22 +34,23 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple { pub src_addr: u32, pub dst_addr: u32, pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1 { pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>, pub sctp_tag: __BindgenUnionField<u32>, pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, @@ -122,21 +123,21 @@ impl Clone for rte_ipv4_tuple { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple { pub src_addr: [u8; 16usize], pub dst_addr: [u8; 16usize], pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1 { pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>, pub sctp_tag: __BindgenUnionField<u32>, pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { pub dport: u16, pub sport: u16, diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs index c2ae221b..f0c1d364 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 9dbf30de..783a62cf 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 74b6fe4a..8c29f8e4 100644 --- a/tests/expectations/tests/anon_struct_in_union_1_0.rs +++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs @@ -34,19 +34,20 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct s { pub u: s__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 a055cbe5..f2da118d 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult_Message { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 64a17776..b96928d4 100644 --- a/tests/expectations/tests/anon_union_1_0.rs +++ b/tests/expectations/tests/anon_union_1_0.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult { pub mResult: ::std::os::raw::c_int, pub __bindgen_anon_1: TErrorResult__bindgen_ty_1, @@ -48,17 +49,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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult_Message { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult_DOMExceptionInfo { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct TErrorResult__bindgen_ty_1 { pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>, pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>, @@ -68,7 +69,7 @@ impl Default for TErrorResult { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 cc682751..532e2427 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Bar { pub member: ::std::os::raw::c_char, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 ac1700f5..1e45c743 100644 --- a/tests/expectations/tests/char.rs +++ b/tests/expectations/tests/char.rs @@ -8,7 +8,7 @@ pub type Char = ::std::os::raw::c_char; pub type SChar = ::std::os::raw::c_schar; pub type UChar = ::std::os::raw::c_uchar; #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct Test { pub ch: ::std::os::raw::c_char, pub u: ::std::os::raw::c_uchar, diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs index 0332c50e..d1216655 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, PartialEq)] +#[derive(Debug, Default, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 21399a49..8ccf4e01 100644 --- a/tests/expectations/tests/class_1_0.rs +++ b/tests/expectations/tests/class_1_0.rs @@ -67,6 +67,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] #[derive(Copy)] pub struct C { @@ -171,7 +172,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, PartialEq)] +#[derive(Debug, Default, Hash, PartialEq, Eq)] pub struct WithDtor { pub b: ::std::os::raw::c_int, } @@ -253,7 +254,7 @@ impl Clone for WithUnion { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct RealAbstractionWithTonsOfMethods { pub _address: u8, } diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index dc40fd06..76658b2e 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct A { pub member_a: ::std::os::raw::c_int, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Templated<T> { pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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 4eb883d9..7fc05c5f 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 703fa072..84f129df 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 27e5b645..9a4b5425 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 c721f1ae..4d2ae275 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 0ef190a9..8171288a 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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 7cc0024f..03df6008 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B { pub d: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 aa4bc2f0..42376dee 100644 --- a/tests/expectations/tests/class_with_inner_struct_1_0.rs +++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs @@ -34,15 +34,16 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct A_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -68,7 +69,7 @@ impl Clone for A_Segment { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct A__bindgen_ty_1 { pub f: __BindgenUnionField<::std::os::raw::c_int>, pub bindgen_union_field: u32, @@ -89,7 +90,7 @@ impl Clone for A__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct A__bindgen_ty_2 { pub d: __BindgenUnionField<::std::os::raw::c_int>, pub bindgen_union_field: u32, @@ -129,12 +130,12 @@ impl Clone for A { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B { pub d: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B_Segment { pub begin: ::std::os::raw::c_int, pub end: ::std::os::raw::c_int, @@ -240,7 +241,7 @@ impl Clone for C__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct C__bindgen_ty_1__bindgen_ty_2 { pub mStepSyntax: StepSyntax, pub mSteps: ::std::os::raw::c_uint, @@ -289,7 +290,7 @@ impl Clone for C__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 053bc06b..159f2735 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct C { pub c: C_MyInt, pub ptr: *mut C_MyInt, @@ -85,7 +85,7 @@ impl C { } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 805733c7..6159f979 100644 --- a/tests/expectations/tests/complex.rs +++ b/tests/expectations/tests/complex.rs @@ -31,7 +31,7 @@ impl Clone for TestDouble { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct TestDoublePtr { pub mMember: *mut __BindgenComplex<f64>, } @@ -74,7 +74,7 @@ impl Clone for TestFloat { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 c98f2ec7..ac479296 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { pub callback: my_fun2_t, } diff --git a/tests/expectations/tests/derive-hash-blacklisting.rs b/tests/expectations/tests/derive-hash-blacklisting.rs index c345d1aa..d24586be 100644 --- a/tests/expectations/tests/derive-hash-blacklisting.rs +++ b/tests/expectations/tests/derive-hash-blacklisting.rs @@ -3,10 +3,10 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -#[repr(C)] #[derive(Debug, Hash, Copy, Clone)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> } +#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> } -/// This would derive(Hash) if it didn't contain a blacklisted type, -/// causing us to conservatively avoid deriving hash for it. +/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type, +/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it. #[repr(C)] #[derive(Debug, Copy)] pub struct WhitelistedOne { @@ -30,7 +30,7 @@ impl Clone for WhitelistedOne { impl Default for WhitelistedOne { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } -/// This can't derive(Hash) even if it didn't contain a blacklisted type. +/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type. #[repr(C)] #[derive(Debug, Copy)] pub struct WhitelistedTwo { diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs index 051a3636..3457afef 100644 --- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs +++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs @@ -4,14 +4,14 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -/// A struct containing a struct containing a float that cannot derive hash. +/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq. #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct foo__bindgen_ty_1 { pub a: f32, pub b: f32, diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs index bb4a6b5d..9ee6785c 100644 --- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs +++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs @@ -4,9 +4,9 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -/// A struct containing an array of floats that cannot derive hash. +/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq. #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, PartialEq)] pub struct foo { pub bar: [f32; 3usize], } diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs index a11d738f..c29f9b1e 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/PartialEq +/// Pointers can derive hash/PartialEq/Eq #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct ConstPtrConstObj { pub bar: *const ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/derive-hash-template-def-float.rs b/tests/expectations/tests/derive-hash-template-def-float.rs index e1d7836c..23bf702d 100644 --- a/tests/expectations/tests/derive-hash-template-def-float.rs +++ b/tests/expectations/tests/derive-hash-template-def-float.rs @@ -4,9 +4,9 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -/// Template definition containing a float, which cannot derive hash. +/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq. #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq)] pub struct foo<T> { pub data: T, pub b: f32, diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs index dd18053f..58848f87 100644 --- a/tests/expectations/tests/derive-hash-template-inst-float.rs +++ b/tests/expectations/tests/derive-hash-template-inst-float.rs @@ -4,9 +4,9 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -/// Template definition that doesn't contain float can derive hash +/// Template definition that doesn't contain float can derive hash/partialeq/eq #[repr(C)] -#[derive(Debug, Copy, Clone, Hash)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct foo<T> { pub data: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -14,9 +14,9 @@ pub struct foo<T> { impl <T> Default for foo<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } -/// Can derive hash when instantiated with int +/// Can derive hash/partialeq/eq when instantiated with int #[repr(C)] -#[derive(Debug, Copy, Hash)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct IntStr { pub a: foo<::std::os::raw::c_int>, } @@ -38,9 +38,9 @@ impl Clone for IntStr { impl Default for IntStr { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } -/// Cannot derive hash when instantiated with float +/// Cannot derive hash/eq when instantiated with float but can derive partialeq #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, PartialEq)] pub struct FloatStr { pub a: foo<f32>, } diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs index aff9d14d..30289ce4 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 d0e076ee..e3d1abff 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 d5486ccc..7a947366 100644 --- a/tests/expectations/tests/issue-493.rs +++ b/tests/expectations/tests/issue-493.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string { pub _address: u8, } @@ -43,7 +44,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong; pub type basic_string_value_type = ::std::os::raw::c_char; pub type basic_string_pointer = *mut basic_string_value_type; #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___long { pub __cap_: basic_string_size_type, pub __size_: basic_string_size_type, @@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_2 { __n_words = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___raw { pub __words: *mut basic_string_size_type, } diff --git a/tests/expectations/tests/issue-493_1_0.rs b/tests/expectations/tests/issue-493_1_0.rs index 4ddc6188..710cd41e 100644 --- a/tests/expectations/tests/issue-493_1_0.rs +++ b/tests/expectations/tests/issue-493_1_0.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string { pub _address: u8, } @@ -43,7 +44,7 @@ pub type basic_string_size_type = ::std::os::raw::c_ulonglong; pub type basic_string_value_type = ::std::os::raw::c_char; pub type basic_string_pointer = *mut basic_string_value_type; #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___long { pub __cap_: basic_string_size_type, pub __size_: basic_string_size_type, @@ -58,13 +59,13 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_1 { __min_cap = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___short { pub __bindgen_anon_1: basic_string___short__bindgen_ty_1, pub __data_: *mut basic_string_value_type, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___short__bindgen_ty_1 { pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>, pub __lx: __BindgenUnionField<basic_string_value_type>, @@ -89,7 +90,7 @@ pub const basic_string___n_words: basic_string__bindgen_ty_2 = #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum basic_string__bindgen_ty_2 { __n_words = 0, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct basic_string___raw { pub __words: *mut basic_string_size_type, } diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs index b77b0e60..85937c3f 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/PartialEq because the padding size is less than the max derive -/// Debug/Hash/PartialEq impl for arrays. However, we conservatively don't derive Debug/Hash because +/// This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive +/// Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don't derive Debug/Hash because /// we determine Debug derive-ability before we compute padding, which happens at /// codegen. (Again, we expect to get the alignment wrong for similar reasons.) #[repr(C)] diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs index b1462ca9..dbf21cf9 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 debfd32e..ed7d8a73 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 587fafe3..0a77b24e 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 fd71f862..563124d5 100644 --- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs +++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } 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; @@ -114,7 +115,7 @@ pub struct jsval_layout { pub bindgen_union_field: u64, } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct jsval_layout__bindgen_ty_1 { pub _bitfield_1: u64, pub __bindgen_align: [u64; 0usize], @@ -220,12 +221,12 @@ impl jsval_layout__bindgen_ty_1 { } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct jsval_layout__bindgen_ty_2 { pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct jsval_layout__bindgen_ty_2__bindgen_ty_1 { pub i32: __BindgenUnionField<i32>, pub u32: __BindgenUnionField<u32>, diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs index 081000bd..9f2082ec 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 b68d9a33..1a3da41e 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 1926ae7c..38c105d3 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 b845321e..c03a3dd4 100644 --- a/tests/expectations/tests/layout_eth_conf_1_0.rs +++ b/tests/expectations/tests/layout_eth_conf_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } 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; @@ -82,7 +83,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, @@ -500,7 +501,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_txmode { /// < TX multi-queues mode. pub mq_mode: rte_eth_tx_mq_mode, @@ -671,7 +672,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_rss_conf { /// < If not NULL, 40-byte hash key. pub rss_key: *mut u8, @@ -748,7 +749,7 @@ pub struct rte_eth_vmdq_dcb_conf { pub dcb_tc: [u8; 8usize], } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 { /// < The vlan id of the received frame pub vlan_id: u16, @@ -828,7 +829,7 @@ impl Default for rte_eth_vmdq_dcb_conf { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_rx_conf { /// < Possible DCB TCs, 4 or 8 TCs pub nb_tcs: rte_eth_nb_tcs, @@ -860,7 +861,7 @@ impl Default for rte_eth_dcb_rx_conf { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_dcb_tx_conf { /// < With DCB, 16 or 32 pools. pub nb_queue_pools: rte_eth_nb_pools, @@ -894,7 +895,7 @@ impl Default for rte_eth_vmdq_dcb_tx_conf { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_dcb_tx_conf { /// < Possible DCB TCs, 4 or 8 TCs. pub nb_tcs: rte_eth_nb_tcs, @@ -926,7 +927,7 @@ impl Default for rte_eth_dcb_tx_conf { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_tx_conf { /// < VMDq mode, 64 pools. pub nb_queue_pools: rte_eth_nb_pools, @@ -969,7 +970,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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 { /// < The vlan id of the received frame pub vlan_id: u16, @@ -1082,7 +1083,7 @@ pub enum rte_fdir_status_mode { } /// A structure used to define the input for IPV4 flow #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_ipv4_flow { /// < IPv4 source address in big endian. pub src_ip: u32, @@ -1132,7 +1133,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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_ipv6_flow { /// < IPv6 source address in big endian. pub src_ip: [u32; 4usize], @@ -1183,7 +1184,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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_masks { /// < Bit mask for vlan_tci in big endian pub vlan_tci_mask: u16, @@ -1269,7 +1270,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_flex_payload_cfg { /// < Payload type pub type_: rte_eth_payload_type, @@ -1304,7 +1305,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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_mask { pub flow_type: u16, pub mask: [u8; 16usize], @@ -1334,7 +1335,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_eth_fdir_flex_conf { /// < The number of following payload cfg pub nb_payloads: u16, @@ -1383,7 +1384,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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct rte_fdir_conf { /// < Flow Director mode. pub mode: rte_fdir_mode, @@ -1441,7 +1442,7 @@ impl Default for rte_fdir_conf { } /// A structure used to enable/disable specific device interrupts. #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_intr_conf { /// enable/disable lsc interrupt. 0 (default) - disable, 1 enable pub lsc: u16, @@ -1554,7 +1555,7 @@ impl Default for rte_eth_conf__bindgen_ty_1 { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 b336e548..63cd92bb 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 afe46930..b9c6e69b 100644 --- a/tests/expectations/tests/layout_mbuf_1_0.rs +++ b/tests/expectations/tests/layout_mbuf_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } 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; @@ -42,7 +43,7 @@ pub type MARKER8 = [u8; 0usize]; pub type MARKER64 = [u64; 0usize]; /// The atomic counter structure. #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_atomic16_t { /// < An internal counter value. pub cnt: i16, @@ -116,7 +117,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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_1 { /// < Atomically accessed refcnt pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>, @@ -147,7 +148,7 @@ impl Clone for rte_mbuf__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_2 { /// < L2/L3/L4 and tunnel information. pub packet_type: __BindgenUnionField<u32>, @@ -155,7 +156,7 @@ pub struct rte_mbuf__bindgen_ty_2 { pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 { pub _bitfield_1: [u8; 4usize], pub __bindgen_align: [u32; 0usize], @@ -478,7 +479,7 @@ impl Clone for rte_mbuf__bindgen_ty_2 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_3 { /// < RSS hash result if RSS enabled pub rss: __BindgenUnionField<u32>, @@ -491,20 +492,20 @@ pub struct rte_mbuf__bindgen_ty_3 { pub bindgen_union_field: [u32; 2usize], } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { pub hash: u16, pub id: u16, @@ -588,7 +589,7 @@ impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_2 { pub lo: u32, pub hi: u32, @@ -652,7 +653,7 @@ impl Clone for rte_mbuf__bindgen_ty_3 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_4 { /// < Can be used for external metadata pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>, @@ -683,7 +684,7 @@ impl Clone for rte_mbuf__bindgen_ty_4 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_5 { /// < combined for easy fetch pub tx_offload: __BindgenUnionField<u64>, @@ -691,7 +692,7 @@ pub struct rte_mbuf__bindgen_ty_5 { pub bindgen_union_field: u64, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 { pub _bitfield_1: [u16; 4usize], pub __bindgen_align: [u64; 0usize], @@ -1088,7 +1089,7 @@ impl Default for rte_mbuf { } /// < Pool from which mbuf was allocated. #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 848babe4..53122ba6 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -7,12 +7,12 @@ /// This is like `opaque-template-inst-member.hpp` except exercising the cases /// where we are OK to derive Debug/Hash/PartialEq. #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct OpaqueTemplate { } /// Should derive Debug/Hash/PartialEq. #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct ContainsOpaqueTemplate { pub mBlah: u32, pub mBaz: ::std::os::raw::c_int, @@ -41,7 +41,7 @@ impl Clone for ContainsOpaqueTemplate { } /// Should also derive Debug/Hash/PartialEq. #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 bab28917..32995873 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Default, Copy, Clone, Hash, PartialEq)] +#[derive(Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct OpaqueTemplate { } /// This should not end up deriving Debug/Hash/PartialEq because its `mBlah` field cannot derive diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs index 6fc0f840..7bf657ed 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, PartialEq)] + #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] + #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] + #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] + #[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] + #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 89f42e53..010186a5 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct ContainsOpaqueInstantiation { pub opaque: u32, } diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs index a5e0dc2b..8c80c83a 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 29da8da4..a4ba4649 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct container { pub contained: opaque, } diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs index 7988a261..bd2a624e 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct OtherOpaque { pub _bindgen_opaque_blob: u32, } @@ -22,7 +22,7 @@ impl Clone for OtherOpaque { } /// <div rustbindgen opaque></div> #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Opaque { } #[repr(C)] diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs index 09717396..96df276c 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 5bd5b394..db47ce6f 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 834a6de9..fb680b69 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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 4180564c..74c60923 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, PartialEq)] + #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] + #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 f31f0b1b..024eaac4 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 7baf1022..fe3e8b0c 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 4636e5c8..006de1cd 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: *mut foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 e39a0934..4a25fd6d 100644 --- a/tests/expectations/tests/struct_with_anon_union_1_0.rs +++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs @@ -34,13 +34,14 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 7e0f7e19..0349d70c 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 d0b86cb8..5ce4064f 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 @@ -34,13 +34,14 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 6455356a..d874351b 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 18e50353..03046674 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 4df90fd0..7b82964f 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 6e06a368..5d014b95 100644 --- a/tests/expectations/tests/struct_with_nesting_1_0.rs +++ b/tests/expectations/tests/struct_with_nesting_1_0.rs @@ -34,14 +34,15 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub a: ::std::os::raw::c_uint, pub __bindgen_anon_1: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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>, @@ -49,7 +50,7 @@ pub struct foo__bindgen_ty_1 { pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo__bindgen_ty_1__bindgen_ty_1 { pub c1: ::std::os::raw::c_ushort, pub c2: ::std::os::raw::c_ushort, @@ -81,7 +82,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 e0731da4..1b3f4ca2 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 ad8551a3..47c99937 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: foo__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 15d48e05..ad4f394a 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 1cecdada..8403f794 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct RefPtr { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct RefPtr_Proxy { pub _address: u8, } diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index ff18874d..91bdee72 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Hash, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] pub struct D { pub m_foo: D_MyFoo, } pub type D_MyFoo = Foo<::std::os::raw::c_int>; #[repr(C)] -#[derive(Debug, Hash, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Opaque { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Templated { pub m_untemplated: Untemplated, } @@ -311,7 +311,7 @@ pub struct Templated { /// /// <div rustbindgen replaces="ReplacedWithoutDestructor"></div> #[repr(C)] -#[derive(Debug, Hash, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Hash, PartialEq, Eq)] 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 1857e714..c3f080db 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, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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 46db54dd..a9cd315d 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, PartialEq)] + #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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 d3114413..7768d522 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Wrapper { pub _address: u8, } #[repr(C)] -#[derive(Debug, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 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 3f119382..481a31bb 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct detail_PointerType { pub _address: u8, } pub type detail_PointerType_Type<T> = *mut T; #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct UniquePtr { pub _address: u8, } diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index 0a4edf4c..cefd02ba 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -24,7 +24,7 @@ impl Default for nsFoo { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, } @@ -46,7 +46,7 @@ impl Clone for mozilla_FragmentOrURL { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_Position { pub _address: u8, } @@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { pub mFoo: *mut nsFoo, } diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index d472f02b..0d240743 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -34,8 +34,9 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct nsFoo { pub mBar: mozilla_StyleShapeSource, } @@ -55,7 +56,7 @@ impl Clone for nsFoo { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, } @@ -77,7 +78,7 @@ impl Clone for mozilla_FragmentOrURL { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_Position { pub _address: u8, } @@ -92,19 +93,19 @@ impl Clone for mozilla_Position { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct mozilla_StyleShapeSource { pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct mozilla_StyleShapeSource__bindgen_ty_1 { pub mPosition: __BindgenUnionField<*mut mozilla_Position>, pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>, pub bindgen_union_field: u64, } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { pub mFoo: *mut nsFoo, } diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs index aea426f4..b3618ab7 100644 --- a/tests/expectations/tests/union-in-ns_1_0.rs +++ b/tests/expectations/tests/union-in-ns_1_0.rs @@ -40,6 +40,7 @@ pub mod root { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } + impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[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 47ed49c2..2c8f80d7 100644 --- a/tests/expectations/tests/union_dtor_1_0.rs +++ b/tests/expectations/tests/union_dtor_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] #[derive(Debug, Default)] pub struct UnionWithDtor { diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs index 2bbd90ed..3f244b78 100644 --- a/tests/expectations/tests/union_fields_1_0.rs +++ b/tests/expectations/tests/union_fields_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct nsStyleUnion { diff --git a/tests/expectations/tests/union_template_1_0.rs b/tests/expectations/tests/union_template_1_0.rs index f322be64..afe14c70 100644 --- a/tests/expectations/tests/union_template_1_0.rs +++ b/tests/expectations/tests/union_template_1_0.rs @@ -34,29 +34,30 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] 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 3526e674..d48538a0 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 a04b59db..8c0971f7 100644 --- a/tests/expectations/tests/union_with_anon_struct_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs @@ -34,14 +34,15 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: __BindgenUnionField<foo__bindgen_ty_1>, pub bindgen_union_field: [u32; 2usize], } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 68ba92e4..c258f901 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 29ca26cc..53faf3a4 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 @@ -34,15 +34,16 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 0a96374f..62a62f85 100644 --- a/tests/expectations/tests/union_with_anon_union_1_0.rs +++ b/tests/expectations/tests/union_with_anon_union_1_0.rs @@ -34,14 +34,15 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct foo { pub bar: __BindgenUnionField<foo__bindgen_ty_1>, pub bindgen_union_field: u32, } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 d5734f03..61b36d1a 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 277071af..45d824ba 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 @@ -34,15 +34,16 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 3f782a63..a33c1ccd 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 @@ -34,15 +34,16 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 9ba01a14..03226cce 100644 --- a/tests/expectations/tests/union_with_big_member_1_0.rs +++ b/tests/expectations/tests/union_with_big_member_1_0.rs @@ -34,6 +34,7 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] #[derive(Copy)] pub struct WithBigArray { @@ -65,7 +66,7 @@ impl Default for WithBigArray { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 73192a45..13870758 100644 --- a/tests/expectations/tests/union_with_nesting_1_0.rs +++ b/tests/expectations/tests/union_with_nesting_1_0.rs @@ -34,21 +34,22 @@ impl <T> ::std::hash::Hash for __BindgenUnionField<T> { impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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>, @@ -81,7 +82,7 @@ impl Clone for foo__bindgen_ty_1__bindgen_ty_1 { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] 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 508e3b5d..6fe4a0ca 100644 --- a/tests/expectations/tests/use-core.rs +++ b/tests/expectations/tests/use-core.rs @@ -6,7 +6,7 @@ extern crate core; #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct foo { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs index b382454a..1e5ef337 100644 --- a/tests/expectations/tests/use-core_1_0.rs +++ b/tests/expectations/tests/use-core_1_0.rs @@ -35,8 +35,9 @@ impl <T> ::core::hash::Hash for __BindgenUnionField<T> { impl <T> ::core::cmp::PartialEq for __BindgenUnionField<T> { fn eq(&self, _other: &__BindgenUnionField<T>) -> bool { true } } +impl <T> ::core::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] -#[derive(Debug, Copy, Hash, PartialEq)] +#[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct foo { pub a: ::std::os::raw::c_int, pub b: ::std::os::raw::c_int, @@ -71,7 +72,7 @@ impl Default for foo { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct _bindgen_ty_1 { pub bar: __BindgenUnionField<::std::os::raw::c_int>, pub baz: __BindgenUnionField<::std::os::raw::c_long>, diff --git a/tests/headers/16-byte-alignment.h b/tests/headers/16-byte-alignment.h index 2fb3e2f3..235a994a 100644 --- a/tests/headers/16-byte-alignment.h +++ b/tests/headers/16-byte-alignment.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/16-byte-alignment_1_0.h b/tests/headers/16-byte-alignment_1_0.h index 89574e9f..8a9fd491 100644 --- a/tests/headers/16-byte-alignment_1_0.h +++ b/tests/headers/16-byte-alignment_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp index 48df3c7a..3e8ff3d4 100644 --- a/tests/headers/anon_enum.hpp +++ b/tests/headers/anon_enum.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq struct Test { int foo; float bar; diff --git a/tests/headers/anon_enum_trait.hpp b/tests/headers/anon_enum_trait.hpp index 7d164054..865411e2 100644 --- a/tests/headers/anon_enum_trait.hpp +++ b/tests/headers/anon_enum_trait.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template<typename _Tp> class DataType { diff --git a/tests/headers/anon_struct_in_union.h b/tests/headers/anon_struct_in_union.h index 98d55056..2587ede5 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 86e5ca73..6b59723a 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct s { union { diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp index ca1d3bc1..8e649abb 100644 --- a/tests/headers/anon_union.hpp +++ b/tests/headers/anon_union.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template<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 1a5e2b0d..699efa32 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq template<typename T> struct TErrorResult { diff --git a/tests/headers/anonymous-template-types.hpp b/tests/headers/anonymous-template-types.hpp index 883f60f5..d4ad534b 100644 --- a/tests/headers/anonymous-template-types.hpp +++ b/tests/headers/anonymous-template-types.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++14 +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++14 template <typename T, typename> struct Foo { diff --git a/tests/headers/char.h b/tests/headers/char.h index 71bce553..7cffd865 100644 --- a/tests/headers/char.h +++ b/tests/headers/char.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // typedef char Char; typedef signed char SChar; diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp index c8c041dc..ac2da1a4 100644 --- a/tests/headers/class.hpp +++ b/tests/headers/class.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // class C { int a; diff --git a/tests/headers/class_1_0.hpp b/tests/headers/class_1_0.hpp index 7400a2a5..ee00c2b7 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq class C { int a; diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp index 09213576..d6ca02c2 100644 --- a/tests/headers/class_nested.hpp +++ b/tests/headers/class_nested.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq class A { public: int member_a; diff --git a/tests/headers/class_no_members.hpp b/tests/headers/class_no_members.hpp index 4c80f7f8..6963e372 100644 --- a/tests/headers/class_no_members.hpp +++ b/tests/headers/class_no_members.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // bindgen-flags: -- -std=c++11 class whatever { diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp index 18660132..d8f9be6d 100644 --- a/tests/headers/class_static.hpp +++ b/tests/headers/class_static.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq class MyClass { public: static const int* example; diff --git a/tests/headers/class_static_const.hpp b/tests/headers/class_static_const.hpp index 7742c782..3e320edc 100644 --- a/tests/headers/class_static_const.hpp +++ b/tests/headers/class_static_const.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 267185c7..b7eaf29b 100644 --- a/tests/headers/class_use_as.hpp +++ b/tests/headers/class_use_as.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq /** * <div rustbindgen="true" replaces="whatever"></div> diff --git a/tests/headers/class_with_dtor.hpp b/tests/headers/class_with_dtor.hpp index 42374c47..f52858a7 100644 --- a/tests/headers/class_with_dtor.hpp +++ b/tests/headers/class_with_dtor.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template <typename T> diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp index c50cfa2b..3cb6cfed 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // 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 86338b06..0bb8a57f 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq // bindgen-flags: -- -std=c++11 class A { diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp index df2afb98..7c3d3c97 100644 --- a/tests/headers/class_with_typedef.hpp +++ b/tests/headers/class_with_typedef.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq typedef int AnotherInt; class C { diff --git a/tests/headers/complex.h b/tests/headers/complex.h index d0fb05b4..2996be1f 100644 --- a/tests/headers/complex.h +++ b/tests/headers/complex.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq #define COMPLEX_TEST(ty_, name_) \ struct Test##name_ { \ diff --git a/tests/headers/complex_global.h b/tests/headers/complex_global.h index 6ceb62da..6b9ffa53 100644 --- a/tests/headers/complex_global.h +++ b/tests/headers/complex_global.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 2dc36f3a..93b980e6 100644 --- a/tests/headers/derive-fn-ptr.h +++ b/tests/headers/derive-fn-ptr.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // typedef void (*my_fun_t)(int, int, int, int, int, int, int, int, diff --git a/tests/headers/derive-hash-blacklisting.hpp b/tests/headers/derive-hash-blacklisting.hpp index ee819c17..c39c31ad 100644 --- a/tests/headers/derive-hash-blacklisting.hpp +++ b/tests/headers/derive-hash-blacklisting.hpp @@ -1,17 +1,17 @@ -// bindgen-flags: --with-derive-hash --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --whitelist-type 'Whitelisted.*' --blacklist-type Blacklisted --raw-line "#[repr(C)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct Blacklisted<T> {t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>> }" // -template<class T> +template <class T> struct Blacklisted { - T t; + T t; }; -/// This would derive(Hash) if it didn't contain a blacklisted type, -/// causing us to conservatively avoid deriving hash for it. +/// This would derive(Hash, Eq, PartialEq) if it didn't contain a blacklisted type, +/// causing us to conservatively avoid deriving hash/Eq/PartialEq for it. struct WhitelistedOne { - Blacklisted<int> a; + Blacklisted<int> a; }; -/// This can't derive(Hash) even if it didn't contain a blacklisted type. +/// This can't derive(Hash/Eq) even if it didn't contain a blacklisted type. struct WhitelistedTwo { - Blacklisted<float> b; + Blacklisted<float> b; }; diff --git a/tests/headers/derive-hash-struct-with-anon-struct-float.h b/tests/headers/derive-hash-struct-with-anon-struct-float.h index 2b76cd23..64fe7fd9 100644 --- a/tests/headers/derive-hash-struct-with-anon-struct-float.h +++ b/tests/headers/derive-hash-struct-with-anon-struct-float.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // -/// A struct containing a struct containing a float that cannot derive hash. +/// A struct containing a struct containing a float that cannot derive hash/eq but can derive partial eq. struct foo { struct { float a; diff --git a/tests/headers/derive-hash-struct-with-float-array.h b/tests/headers/derive-hash-struct-with-float-array.h index 53f0c79d..a34904f7 100644 --- a/tests/headers/derive-hash-struct-with-float-array.h +++ b/tests/headers/derive-hash-struct-with-float-array.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // -/// A struct containing an array of floats that cannot derive hash. +/// A struct containing an array of floats that cannot derive hash/eq but can derive partialeq. struct foo { float bar[3]; }; diff --git a/tests/headers/derive-hash-struct-with-pointer.h b/tests/headers/derive-hash-struct-with-pointer.h index ed5199d4..d7f18a6d 100644 --- a/tests/headers/derive-hash-struct-with-pointer.h +++ b/tests/headers/derive-hash-struct-with-pointer.h @@ -1,6 +1,6 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // -/// Pointers can derive hash/PartialEq +/// Pointers can derive hash/PartialEq/Eq struct ConstPtrMutObj { int* const bar; }; diff --git a/tests/headers/derive-hash-template-def-float.hpp b/tests/headers/derive-hash-template-def-float.hpp index 28885ed1..8c1a14d1 100644 --- a/tests/headers/derive-hash-template-def-float.hpp +++ b/tests/headers/derive-hash-template-def-float.hpp @@ -1,7 +1,7 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // -/// Template definition containing a float, which cannot derive hash. -template<typename T> +/// Template definition containing a float, which cannot derive hash/eq but can derive partialeq. +template <typename T> struct foo { T data; float b; diff --git a/tests/headers/derive-hash-template-inst-float.hpp b/tests/headers/derive-hash-template-inst-float.hpp index 59af69bd..14fd89a0 100644 --- a/tests/headers/derive-hash-template-inst-float.hpp +++ b/tests/headers/derive-hash-template-inst-float.hpp @@ -1,17 +1,17 @@ -// bindgen-flags: --with-derive-hash +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // -/// Template definition that doesn't contain float can derive hash -template<typename T> +/// Template definition that doesn't contain float can derive hash/partialeq/eq +template <typename T> struct foo { T data; }; -/// Can derive hash when instantiated with int +/// Can derive hash/partialeq/eq when instantiated with int struct IntStr { foo<int> a; }; -/// Cannot derive hash when instantiated with float +/// Cannot derive hash/eq when instantiated with float but can derive partialeq struct FloatStr { foo<float> a; }; diff --git a/tests/headers/empty_template_param_name.hpp b/tests/headers/empty_template_param_name.hpp index 11b6221c..ab2aab92 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // 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 bbbf677b..34dc48d1 100644 --- a/tests/headers/func_ptr.h +++ b/tests/headers/func_ptr.h @@ -1,3 +1,3 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // 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 8718dd9b..24e1f44f 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // enum baz; diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp index 7c58a351..5d4cb4b8 100644 --- a/tests/headers/issue-493.hpp +++ b/tests/headers/issue-493.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template<class _CharT, class _Traits, class _Allocator> class basic_string { diff --git a/tests/headers/issue-493_1_0.hpp b/tests/headers/issue-493_1_0.hpp index 2f43b16e..4e383be3 100644 --- a/tests/headers/issue-493_1_0.hpp +++ b/tests/headers/issue-493_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq template<class _CharT, class _Traits, class _Allocator> class basic_string diff --git a/tests/headers/issue-648-derive-debug-with-padding.h b/tests/headers/issue-648-derive-debug-with-padding.h index e3433b07..c9ec0210 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq /** * 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/PartialEq because the padding size is less than the max derive - * Debug/Hash/PartialEq impl for arrays. However, we conservatively don't derive Debug/Hash because + * This should derive Debug/Hash/PartialEq/Eq because the padding size is less than the max derive + * Debug/Hash/PartialEq/Eq impl for arrays. However, we conservatively don't derive Debug/Hash because * we determine Debug derive-ability before we compute padding, which happens at * codegen. (Again, we expect to get the alignment wrong for similar reasons.) */ diff --git a/tests/headers/issue-801-opaque-sloppiness.hpp b/tests/headers/issue-801-opaque-sloppiness.hpp index 72d234fb..67858634 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 --with-derive-partialeq +// bindgen-flags: --opaque-type "B" --whitelist-type "C" --with-derive-hash --with-derive-partialeq --with-derive-eq 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 e66ccc5e..91f221ce 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 --with-derive-partialeq -- -std=c++11 +// bindgen-flags: --whitelist-type Whitelisted --opaque-type Opaque --with-derive-hash --with-derive-partialeq --with-derive-eq -- -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 6a730e8e..09b5bebe 100644 --- a/tests/headers/jsval_layout_opaque.hpp +++ b/tests/headers/jsval_layout_opaque.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // 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 dd598274..61eefe1e 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq // bindgen-flags: -- -std=c++11 /** diff --git a/tests/headers/layout_array.h b/tests/headers/layout_array.h index 9db81f91..6a20f7c3 100644 --- a/tests/headers/layout_array.h +++ b/tests/headers/layout_array.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; diff --git a/tests/headers/layout_array_too_long.h b/tests/headers/layout_array_too_long.h index 9db20a36..5240f040 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 3c09f9f5..637b5696 100644 --- a/tests/headers/layout_eth_conf.h +++ b/tests/headers/layout_eth_conf.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; 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 7fcbcddb..285c8c7a 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq typedef unsigned char uint8_t; typedef unsigned short uint16_t; diff --git a/tests/headers/layout_mbuf.h b/tests/headers/layout_mbuf.h index 0e82846b..0e342f45 100644 --- a/tests/headers/layout_mbuf.h +++ b/tests/headers/layout_mbuf.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq #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 ed815acb..2854de50 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq #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 09a4ea05..85b648ff 100644 --- a/tests/headers/opaque-template-inst-member-2.hpp +++ b/tests/headers/opaque-template-inst-member-2.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash --with-derive-partialeq +// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash --with-derive-partialeq --with-derive-eq /// This is like `opaque-template-inst-member.hpp` except exercising the cases /// where we are OK to derive Debug/Hash/PartialEq. diff --git a/tests/headers/opaque-template-inst-member.hpp b/tests/headers/opaque-template-inst-member.hpp index 2586850f..4cb3dd72 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 --with-derive-partialeq +// bindgen-flags: --opaque-type 'OpaqueTemplate' --with-derive-hash --with-derive-partialeq --with-derive-eq template<typename T> class OpaqueTemplate { diff --git a/tests/headers/opaque-template-instantiation-namespaced.hpp b/tests/headers/opaque-template-instantiation-namespaced.hpp index 0c78fc7d..e1cadcc2 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 --with-derive-partialeq -- -std=c++14 +// bindgen-flags: --enable-cxx-namespaces --opaque-type 'zoidberg::Template<zoidberg::Bar>' --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++14 namespace zoidberg { diff --git a/tests/headers/opaque-template-instantiation.hpp b/tests/headers/opaque-template-instantiation.hpp index f0c860f0..fff49af2 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 --with-derive-partialeq -- -std=c++14 +// bindgen-flags: --opaque-type 'Template<int>' --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++14 template <typename T> class Template { diff --git a/tests/headers/opaque-tracing.hpp b/tests/headers/opaque-tracing.hpp index 5ea72947..326ebbe7 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 --with-derive-partialeq +// bindgen-flags: --opaque-type=.* --whitelist-function=foo --with-derive-hash --with-derive-partialeq --with-derive-eq class Container; diff --git a/tests/headers/opaque_in_struct.hpp b/tests/headers/opaque_in_struct.hpp index 2de2de3e..12910e1f 100644 --- a/tests/headers/opaque_in_struct.hpp +++ b/tests/headers/opaque_in_struct.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq /** <div rustbindgen opaque> */ diff --git a/tests/headers/opaque_pointer.hpp b/tests/headers/opaque_pointer.hpp index 40475b8b..00868985 100644 --- a/tests/headers/opaque_pointer.hpp +++ b/tests/headers/opaque_pointer.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq /** * <div rustbindgen opaque></div> diff --git a/tests/headers/opaque_typedef.hpp b/tests/headers/opaque_typedef.hpp index 80586778..878d5bcb 100644 --- a/tests/headers/opaque_typedef.hpp +++ b/tests/headers/opaque_typedef.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++11 +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -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 c118786c..cf7cb5c4 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq struct a { struct b* val_a; }; diff --git a/tests/headers/struct_typedef.h b/tests/headers/struct_typedef.h index b1f21354..de861c5f 100644 --- a/tests/headers/struct_typedef.h +++ b/tests/headers/struct_typedef.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // typedef struct { _Bool has_name; diff --git a/tests/headers/struct_typedef_ns.hpp b/tests/headers/struct_typedef_ns.hpp index bed8634b..07ecc160 100644 --- a/tests/headers/struct_typedef_ns.hpp +++ b/tests/headers/struct_typedef_ns.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --enable-cxx-namespaces +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --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 4578a875..a5e8476d 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { struct { diff --git a/tests/headers/struct_with_anon_struct_array.h b/tests/headers/struct_with_anon_struct_array.h index c66bb10e..94a8ea0a 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { struct { diff --git a/tests/headers/struct_with_anon_struct_pointer.h b/tests/headers/struct_with_anon_struct_pointer.h index 5844b509..d92c8011 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { struct { int a; diff --git a/tests/headers/struct_with_anon_union.h b/tests/headers/struct_with_anon_union.h index 1d7b7a43..bd75563d 100644 --- a/tests/headers/struct_with_anon_union.h +++ b/tests/headers/struct_with_anon_union.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { union { diff --git a/tests/headers/struct_with_anon_union_1_0.h b/tests/headers/struct_with_anon_union_1_0.h index c727ce41..847c354b 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { union { diff --git a/tests/headers/struct_with_anon_unnamed_struct.h b/tests/headers/struct_with_anon_unnamed_struct.h index 399056e7..92705238 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 1961ebc8..00fa4900 100644 --- a/tests/headers/struct_with_anon_unnamed_union.h +++ b/tests/headers/struct_with_anon_unnamed_union.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 1f8280cd..791a1593 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { union { diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h index 7b58c4b8..ba1af26d 100644 --- a/tests/headers/struct_with_bitfields.h +++ b/tests/headers/struct_with_bitfields.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct bitfield { unsigned short diff --git a/tests/headers/struct_with_derive_debug.h b/tests/headers/struct_with_derive_debug.h index 493b29ca..201748d9 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct LittleArray { int a[32]; diff --git a/tests/headers/struct_with_large_array.hpp b/tests/headers/struct_with_large_array.hpp index 2c925527..58e8e4d1 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct S { char large_array[33]; diff --git a/tests/headers/struct_with_nesting.h b/tests/headers/struct_with_nesting.h index 532b46e2..ac902b44 100644 --- a/tests/headers/struct_with_nesting.h +++ b/tests/headers/struct_with_nesting.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { unsigned int a; diff --git a/tests/headers/struct_with_nesting_1_0.h b/tests/headers/struct_with_nesting_1_0.h index 125a9026..a24ae1db 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { unsigned int a; diff --git a/tests/headers/struct_with_packing.h b/tests/headers/struct_with_packing.h index 41b5840f..9ed50317 100644 --- a/tests/headers/struct_with_packing.h +++ b/tests/headers/struct_with_packing.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct a { char b; diff --git a/tests/headers/struct_with_struct.h b/tests/headers/struct_with_struct.h index 953472c8..1a178074 100644 --- a/tests/headers/struct_with_struct.h +++ b/tests/headers/struct_with_struct.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { struct { diff --git a/tests/headers/struct_with_typedef_template_arg.hpp b/tests/headers/struct_with_typedef_template_arg.hpp index 38a1ab3d..ec1b55aa 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 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 ea820e2a..bb9d23cf 100644 --- a/tests/headers/template-fun-ty.hpp +++ b/tests/headers/template-fun-ty.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template <typename T> class Foo { diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp index b7566c71..eea2c4de 100644 --- a/tests/headers/template.hpp +++ b/tests/headers/template.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++11 +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -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 1877db5c..8b3ea692 100644 --- a/tests/headers/template_alias.hpp +++ b/tests/headers/template_alias.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq -- -std=c++14 +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++14 namespace JS { namespace detail { diff --git a/tests/headers/template_alias_namespace.hpp b/tests/headers/template_alias_namespace.hpp index fafa6f27..c20bf206 100644 --- a/tests/headers/template_alias_namespace.hpp +++ b/tests/headers/template_alias_namespace.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq --enable-cxx-namespaces -- -std=c++14 +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --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 0f657c1e..34a5b92c 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 --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq template<typename T> struct Wrapper { struct Wrapped { diff --git a/tests/headers/templateref_opaque.hpp b/tests/headers/templateref_opaque.hpp index e52f7e82..2f6a0027 100644 --- a/tests/headers/templateref_opaque.hpp +++ b/tests/headers/templateref_opaque.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq namespace detail { template<typename T> diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp index d0710bfb..bdc1b302 100644 --- a/tests/headers/typeref.hpp +++ b/tests/headers/typeref.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq struct nsFoo; namespace mozilla { diff --git a/tests/headers/typeref_1_0.hpp b/tests/headers/typeref_1_0.hpp index 0dad19b2..70dfc11f 100644 --- a/tests/headers/typeref_1_0.hpp +++ b/tests/headers/typeref_1_0.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq struct nsFoo; diff --git a/tests/headers/union_fields.hpp b/tests/headers/union_fields.hpp index 7397ad58..7bb2a3ce 100644 --- a/tests/headers/union_fields.hpp +++ b/tests/headers/union_fields.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // typedef union { int mInt; diff --git a/tests/headers/union_fields_1_0.hpp b/tests/headers/union_fields_1_0.hpp index ef0272f0..bbb67fbc 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq typedef union { int mInt; diff --git a/tests/headers/union_template.hpp b/tests/headers/union_template.hpp index fbebb44f..8b57f5a0 100644 --- a/tests/headers/union_template.hpp +++ b/tests/headers/union_template.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // template<typename T> struct NastyStruct { diff --git a/tests/headers/union_template_1_0.hpp b/tests/headers/union_template_1_0.hpp index 65a11b30..18e3d74a 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq template<typename T> struct NastyStruct { diff --git a/tests/headers/union_with_anon_struct.h b/tests/headers/union_with_anon_struct.h index 5968a48c..b239b2d8 100644 --- a/tests/headers/union_with_anon_struct.h +++ b/tests/headers/union_with_anon_struct.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union foo { struct { diff --git a/tests/headers/union_with_anon_struct_1_0.h b/tests/headers/union_with_anon_struct_1_0.h index a24f5a90..9313299e 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union foo { struct { diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h index 8a6a6a74..bbb1ef41 100644 --- a/tests/headers/union_with_anon_struct_bitfield.h +++ b/tests/headers/union_with_anon_struct_bitfield.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union foo { int a; 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 ae069c50..0b0e3d73 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union foo { int a; diff --git a/tests/headers/union_with_anon_union.h b/tests/headers/union_with_anon_union.h index 8f76cbde..02b09e2e 100644 --- a/tests/headers/union_with_anon_union.h +++ b/tests/headers/union_with_anon_union.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union foo { union { diff --git a/tests/headers/union_with_anon_union_1_0.h b/tests/headers/union_with_anon_union_1_0.h index 77876c08..28a7231d 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union foo { union { diff --git a/tests/headers/union_with_anon_unnamed_struct.h b/tests/headers/union_with_anon_unnamed_struct.h index 5214db4c..04903318 100644 --- a/tests/headers/union_with_anon_unnamed_struct.h +++ b/tests/headers/union_with_anon_unnamed_struct.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union pixel { unsigned int rgba; 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 a9954535..506a41f6 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq 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 74345dd8..dbccd5b5 100644 --- a/tests/headers/union_with_anon_unnamed_union.h +++ b/tests/headers/union_with_anon_unnamed_union.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union foo { unsigned int a; 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 bae55773..c556a613 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union foo { unsigned int a; diff --git a/tests/headers/union_with_big_member.h b/tests/headers/union_with_big_member.h index 7bff36ea..e8a3fe0a 100644 --- a/tests/headers/union_with_big_member.h +++ b/tests/headers/union_with_big_member.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union WithBigArray { int a; diff --git a/tests/headers/union_with_big_member_1_0.h b/tests/headers/union_with_big_member_1_0.h index 2cffd2c5..04294354 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union WithBigArray { int a; diff --git a/tests/headers/union_with_nesting.h b/tests/headers/union_with_nesting.h index 95c55581..ae25244a 100644 --- a/tests/headers/union_with_nesting.h +++ b/tests/headers/union_with_nesting.h @@ -1,4 +1,4 @@ -// bindgen-flags: --with-derive-hash --with-derive-partialeq +// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // union foo { unsigned int a; diff --git a/tests/headers/union_with_nesting_1_0.h b/tests/headers/union_with_nesting_1_0.h index e89c3212..3cdb7238 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 --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq union foo { unsigned int a; diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h index b5fd0515..b4135b44 100644 --- a/tests/headers/use-core.h +++ b/tests/headers/use-core.h @@ -1,4 +1,4 @@ -// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq +// bindgen-flags: --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { int a, b; diff --git a/tests/headers/use-core_1_0.h b/tests/headers/use-core_1_0.h index f525bccf..40de9d15 100644 --- a/tests/headers/use-core_1_0.h +++ b/tests/headers/use-core_1_0.h @@ -1,4 +1,4 @@ -// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq +// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;" --with-derive-hash --with-derive-partialeq --with-derive-eq struct foo { int a, b; |