summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Pepyakin <s.pepyakin@gmail.com>2017-10-14 17:18:38 +0300
committerSergey Pepyakin <s.pepyakin@gmail.com>2017-10-24 10:49:01 +0300
commit2e7d9972342c5a614319193cb75e8b1e135167b8 (patch)
tree87da2d9fc54f379392be140125cbd121d3b4af6f
parentdc1e546586b8f90cf280ed8b07799e878486961f (diff)
Derive `Clone` along with `Copy` on latest stable.
-rw-r--r--src/codegen/mod.rs5
-rw-r--r--src/features.rs11
-rw-r--r--tests/expectations/tests/16-byte-alignment.rs49
-rw-r--r--tests/expectations/tests/accessors.rs42
-rw-r--r--tests/expectations/tests/annotation_hide.rs14
-rw-r--r--tests/expectations/tests/anon_enum.rs7
-rw-r--r--tests/expectations/tests/anon_enum_trait.rs7
-rw-r--r--tests/expectations/tests/anon_struct_in_union.rs21
-rw-r--r--tests/expectations/tests/base-to-derived.rs7
-rw-r--r--tests/expectations/tests/bitfield-32bit-overflow.rs7
-rw-r--r--tests/expectations/tests/bitfield-enum-basic.rs7
-rw-r--r--tests/expectations/tests/bitfield-large.rs14
-rw-r--r--tests/expectations/tests/bitfield-method-same-name.rs7
-rw-r--r--tests/expectations/tests/bitfield_align.rs42
-rw-r--r--tests/expectations/tests/bitfield_align_2.rs7
-rw-r--r--tests/expectations/tests/bitfield_large_overflow.rs7
-rw-r--r--tests/expectations/tests/bitfield_method_mangling.rs7
-rw-r--r--tests/expectations/tests/c-empty-layout.rs7
-rw-r--r--tests/expectations/tests/canonical_path_without_namespacing.rs7
-rw-r--r--tests/expectations/tests/char.rs7
-rw-r--r--tests/expectations/tests/class.rs28
-rw-r--r--tests/expectations/tests/class_nested.rs28
-rw-r--r--tests/expectations/tests/class_no_members.rs21
-rw-r--r--tests/expectations/tests/class_static.rs7
-rw-r--r--tests/expectations/tests/class_static_const.rs7
-rw-r--r--tests/expectations/tests/class_use_as.rs14
-rw-r--r--tests/expectations/tests/class_with_inner_struct.rs77
-rw-r--r--tests/expectations/tests/class_with_typedef.rs14
-rw-r--r--tests/expectations/tests/comment-indent.rs35
-rw-r--r--tests/expectations/tests/complex.rs28
-rw-r--r--tests/expectations/tests/const_enum_unnamed.rs7
-rw-r--r--tests/expectations/tests/constify-all-enums.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-basic.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-namespace.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-shadow-name.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-simple-alias.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-simple-nonamespace.rs7
-rw-r--r--tests/expectations/tests/constify-module-enums-types.rs21
-rw-r--r--tests/expectations/tests/constructor-tp.rs7
-rw-r--r--tests/expectations/tests/constructors.rs14
-rw-r--r--tests/expectations/tests/convert-cpp-comment-to-rust.rs7
-rw-r--r--tests/expectations/tests/convert-floats.rs7
-rw-r--r--tests/expectations/tests/cpp-empty-layout.rs7
-rw-r--r--tests/expectations/tests/crtp.rs7
-rw-r--r--tests/expectations/tests/derive-bitfield-method-same-name.rs7
-rw-r--r--tests/expectations/tests/derive-clone.rs41
-rw-r--r--tests/expectations/tests/derive-clone_1_0.rs47
-rw-r--r--tests/expectations/tests/derive-debug-bitfield.rs7
-rw-r--r--tests/expectations/tests/derive-debug-function-pointer.rs7
-rw-r--r--tests/expectations/tests/derive-fn-ptr.rs14
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs14
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-float-array.rs7
-rw-r--r--tests/expectations/tests/derive-hash-struct-with-pointer.rs28
-rw-r--r--tests/expectations/tests/derive-hash-template-inst-float.rs14
-rw-r--r--tests/expectations/tests/derive-partialeq-anonfield.rs14
-rw-r--r--tests/expectations/tests/derive-partialeq-base.rs14
-rw-r--r--tests/expectations/tests/derive-partialeq-bitfield.rs7
-rw-r--r--tests/expectations/tests/derive-partialeq-core.rs7
-rw-r--r--tests/expectations/tests/derive-partialeq-pointer.rs28
-rw-r--r--tests/expectations/tests/derive-partialeq-union.rs7
-rw-r--r--tests/expectations/tests/doggo-or-null.rs21
-rw-r--r--tests/expectations/tests/duplicated-namespaces-definitions.rs14
-rw-r--r--tests/expectations/tests/enum_and_vtable_mangling.rs7
-rw-r--r--tests/expectations/tests/forward-declaration-autoptr.rs7
-rw-r--r--tests/expectations/tests/forward_declared_complex_types.rs14
-rw-r--r--tests/expectations/tests/forward_declared_struct.rs14
-rw-r--r--tests/expectations/tests/func_ptr_in_struct.rs7
-rw-r--r--tests/expectations/tests/gen-constructors-neg.rs7
-rw-r--r--tests/expectations/tests/gen-constructors.rs7
-rw-r--r--tests/expectations/tests/generate-inline.rs7
-rw-r--r--tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs28
-rw-r--r--tests/expectations/tests/inherit_typedef.rs14
-rw-r--r--tests/expectations/tests/inline_namespace.rs7
-rw-r--r--tests/expectations/tests/inline_namespace_conservative.rs7
-rw-r--r--tests/expectations/tests/inner_const.rs7
-rw-r--r--tests/expectations/tests/inner_template_self.rs7
-rw-r--r--tests/expectations/tests/issue-1034.rs7
-rw-r--r--tests/expectations/tests/issue-372.rs14
-rw-r--r--tests/expectations/tests/issue-410.rs7
-rw-r--r--tests/expectations/tests/issue-447.rs14
-rw-r--r--tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs7
-rw-r--r--tests/expectations/tests/issue-573-layout-test-failures.rs7
-rw-r--r--tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs7
-rw-r--r--tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs7
-rw-r--r--tests/expectations/tests/issue-639-typedef-anon-field.rs28
-rw-r--r--tests/expectations/tests/issue-643-inner-struct.rs21
-rw-r--r--tests/expectations/tests/issue-648-derive-debug-with-padding.rs14
-rw-r--r--tests/expectations/tests/issue-674-1.rs7
-rw-r--r--tests/expectations/tests/issue-674-2.rs14
-rw-r--r--tests/expectations/tests/issue-674-3.rs14
-rw-r--r--tests/expectations/tests/issue-691-template-parameter-virtual.rs14
-rw-r--r--tests/expectations/tests/issue-739-pointer-wide-bitfield.rs7
-rw-r--r--tests/expectations/tests/issue-801-opaque-sloppiness.rs14
-rw-r--r--tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs35
-rw-r--r--tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs7
-rw-r--r--tests/expectations/tests/issue-834.rs7
-rw-r--r--tests/expectations/tests/issue-888-enum-var-decl-jump.rs7
-rw-r--r--tests/expectations/tests/issue_311.rs14
-rw-r--r--tests/expectations/tests/jsval_layout_opaque.rs35
-rw-r--r--tests/expectations/tests/layout_align.rs7
-rw-r--r--tests/expectations/tests/layout_arp.rs21
-rw-r--r--tests/expectations/tests/layout_array.rs42
-rw-r--r--tests/expectations/tests/layout_array_too_long.rs35
-rw-r--r--tests/expectations/tests/layout_cmdline_token.rs28
-rw-r--r--tests/expectations/tests/layout_eth_conf.rs154
-rw-r--r--tests/expectations/tests/layout_kni_mbuf.rs7
-rw-r--r--tests/expectations/tests/layout_large_align_field.rs49
-rw-r--r--tests/expectations/tests/layout_mbuf.rs91
-rw-r--r--tests/expectations/tests/libclang-3.8/auto.rs7
-rw-r--r--tests/expectations/tests/libclang-3.8/call-conv-field.rs7
-rw-r--r--tests/expectations/tests/libclang-3.8/const_bool.rs7
-rw-r--r--tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs7
-rw-r--r--tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs7
-rw-r--r--tests/expectations/tests/libclang-3.9/auto.rs7
-rw-r--r--tests/expectations/tests/libclang-3.9/call-conv-field.rs7
-rw-r--r--tests/expectations/tests/libclang-3.9/const_bool.rs7
-rw-r--r--tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs7
-rw-r--r--tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs7
-rw-r--r--tests/expectations/tests/libclang-4/auto.rs19
-rw-r--r--tests/expectations/tests/libclang-4/call-conv-field.rs61
-rw-r--r--tests/expectations/tests/libclang-4/const_bool.rs19
-rw-r--r--tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs19
-rw-r--r--tests/expectations/tests/libclang-4/type_alias_template_specialized.rs18
-rw-r--r--tests/expectations/tests/mangling-linux32.rs7
-rw-r--r--tests/expectations/tests/mangling-linux64.rs7
-rw-r--r--tests/expectations/tests/mangling-macos.rs7
-rw-r--r--tests/expectations/tests/mangling-win32.rs7
-rw-r--r--tests/expectations/tests/mangling-win64.rs7
-rw-r--r--tests/expectations/tests/method-mangling.rs7
-rw-r--r--tests/expectations/tests/module-whitelisted.rs7
-rw-r--r--tests/expectations/tests/msvc-no-usr.rs7
-rw-r--r--tests/expectations/tests/multiple-inherit-empty-correct-layout.rs21
-rw-r--r--tests/expectations/tests/mutable.rs7
-rw-r--r--tests/expectations/tests/namespace.rs7
-rw-r--r--tests/expectations/tests/nested.rs28
-rw-r--r--tests/expectations/tests/nested_vtable.rs21
-rw-r--r--tests/expectations/tests/nested_within_namespace.rs21
-rw-r--r--tests/expectations/tests/no-comments.rs7
-rw-r--r--tests/expectations/tests/no-partialeq-opaque.rs7
-rw-r--r--tests/expectations/tests/no-partialeq-whitelisted.rs7
-rw-r--r--tests/expectations/tests/no-std.rs7
-rw-r--r--tests/expectations/tests/non-type-params.rs7
-rw-r--r--tests/expectations/tests/objc_interface_type.rs7
-rw-r--r--tests/expectations/tests/only_bitfields.rs7
-rw-r--r--tests/expectations/tests/opaque-template-inst-member-2.rs14
-rw-r--r--tests/expectations/tests/opaque-template-instantiation-namespaced.rs28
-rw-r--r--tests/expectations/tests/opaque-template-instantiation.rs14
-rw-r--r--tests/expectations/tests/opaque-tracing.rs7
-rw-r--r--tests/expectations/tests/opaque_in_struct.rs14
-rw-r--r--tests/expectations/tests/opaque_pointer.rs14
-rw-r--r--tests/expectations/tests/private.rs21
-rw-r--r--tests/expectations/tests/ref_argument_array.rs7
-rw-r--r--tests/expectations/tests/reparented_replacement.rs7
-rw-r--r--tests/expectations/tests/replace_use.rs7
-rw-r--r--tests/expectations/tests/same_struct_name_in_different_namespaces.rs7
-rw-r--r--tests/expectations/tests/sentry-defined-multiple-times.rs84
-rw-r--r--tests/expectations/tests/size_t_template.rs7
-rw-r--r--tests/expectations/tests/struct_containing_forward_declared_struct.rs14
-rw-r--r--tests/expectations/tests/struct_typedef.rs14
-rw-r--r--tests/expectations/tests/struct_typedef_ns.rs14
-rw-r--r--tests/expectations/tests/struct_with_anon_struct.rs14
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_array.rs21
-rw-r--r--tests/expectations/tests/struct_with_anon_struct_pointer.rs14
-rw-r--r--tests/expectations/tests/struct_with_anon_union.rs14
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_struct.rs14
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_union.rs14
-rw-r--r--tests/expectations/tests/struct_with_bitfields.rs7
-rw-r--r--tests/expectations/tests/struct_with_derive_debug.rs28
-rw-r--r--tests/expectations/tests/struct_with_large_array.rs7
-rw-r--r--tests/expectations/tests/struct_with_nesting.rs28
-rw-r--r--tests/expectations/tests/struct_with_packing.rs7
-rw-r--r--tests/expectations/tests/struct_with_struct.rs14
-rw-r--r--tests/expectations/tests/template.rs28
-rw-r--r--tests/expectations/tests/test_multiple_header_calls_in_builder.rs7
-rw-r--r--tests/expectations/tests/type-referenced-by-whitelisted-function.rs7
-rw-r--r--tests/expectations/tests/typeref.rs21
-rw-r--r--tests/expectations/tests/underscore.rs7
-rw-r--r--tests/expectations/tests/union-in-ns.rs7
-rw-r--r--tests/expectations/tests/union_bitfield.rs14
-rw-r--r--tests/expectations/tests/union_fields.rs7
-rw-r--r--tests/expectations/tests/union_with_anon_struct.rs14
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield.rs14
-rw-r--r--tests/expectations/tests/union_with_anon_union.rs14
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct.rs14
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union.rs14
-rw-r--r--tests/expectations/tests/union_with_big_member.rs21
-rw-r--r--tests/expectations/tests/union_with_nesting.rs28
-rw-r--r--tests/expectations/tests/unknown_attr.rs7
-rw-r--r--tests/expectations/tests/use-core.rs14
-rw-r--r--tests/expectations/tests/var-tracing.rs14
-rw-r--r--tests/expectations/tests/variadic-method.rs7
-rw-r--r--tests/expectations/tests/vector.rs7
-rw-r--r--tests/expectations/tests/virtual_inheritance.rs28
-rw-r--r--tests/expectations/tests/virtual_overloaded.rs7
-rw-r--r--tests/expectations/tests/vtable_recursive_sig.rs14
-rw-r--r--tests/expectations/tests/weird_bitfields.rs7
-rw-r--r--tests/expectations/tests/what_is_going_on.rs7
-rw-r--r--tests/expectations/tests/whitelist-namespaces-basic.rs7
-rw-r--r--tests/expectations/tests/whitelist-namespaces.rs14
-rw-r--r--tests/expectations/tests/whitelisted-item-references-no-partialeq.rs14
-rw-r--r--tests/expectations/tests/win32-thiscall_nightly.rs7
-rw-r--r--tests/headers/derive-clone.h5
-rw-r--r--tests/headers/derive-clone_1_0.h7
203 files changed, 601 insertions, 2493 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 6396e953..607ceafe 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1642,7 +1642,10 @@ impl CodeGenerator for CompInfo {
ctx.options().derive_copy
{
derives.push("Copy");
- if used_template_params.is_some() {
+
+ if ctx.options().rust_features().builtin_clone_impls() ||
+ used_template_params.is_some()
+ {
// FIXME: This requires extra logic if you have a big array in a
// templated struct. The reason for this is that the magic:
// fn clone(&self) -> Self { *self }
diff --git a/src/features.rs b/src/features.rs
index b89185fd..0954d87b 100644
--- a/src/features.rs
+++ b/src/features.rs
@@ -90,6 +90,8 @@ macro_rules! rust_target_base {
=> Stable_1_0 => 1.0;
/// Rust stable 1.19
=> Stable_1_19 => 1.19;
+ /// Rust stable 1.21
+ => Stable_1_21 => 1.21;
/// Nightly rust
=> Nightly => nightly;
);
@@ -100,7 +102,7 @@ rust_target_base!(rust_target_def);
rust_target_base!(rust_target_values_def);
/// Latest stable release of Rust
-pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_19;
+pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_21;
/// Create RustFeatures struct definition, new(), and a getter for each field
macro_rules! rust_feature_def {
@@ -142,6 +144,8 @@ rust_feature_def!(
=> const_fn;
/// `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
=> thiscall_abi;
+ /// builtin impls for `Clone` ([PR](https://github.com/rust-lang/rust/pull/43690))
+ => builtin_clone_impls;
);
impl From<RustTarget> for RustFeatures {
@@ -152,6 +156,10 @@ impl From<RustTarget> for RustFeatures {
features.untagged_union = true;
}
+ if rust_target >= RustTarget::Stable_1_21 {
+ features.builtin_clone_impls = true;
+ }
+
if rust_target >= RustTarget::Nightly {
features.const_fn = true;
features.thiscall_abi = true;
@@ -183,6 +191,7 @@ mod test {
fn str_to_target() {
test_target("1.0", RustTarget::Stable_1_0);
test_target("1.19", RustTarget::Stable_1_19);
+ test_target("1.21", RustTarget::Stable_1_21);
test_target("nightly", RustTarget::Nightly);
}
}
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 4b764daa..57bc753d 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -5,21 +5,21 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
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(Copy)]
+#[derive(Copy, Clone)]
pub union rte_ipv4_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
pub sctp_tag: u32,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
@@ -67,11 +67,6 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
assert_eq!(
@@ -95,11 +90,6 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
)
);
}
-impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_ipv4_tuple__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -138,32 +128,27 @@ fn bindgen_test_layout_rte_ipv4_tuple() {
)
);
}
-impl Clone for rte_ipv4_tuple {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_ipv4_tuple {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
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(Copy)]
+#[derive(Copy, Clone)]
pub union rte_ipv6_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
pub sctp_tag: u32,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
@@ -211,11 +196,6 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
assert_eq!(
@@ -239,11 +219,6 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
)
);
}
-impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_ipv6_tuple__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -282,18 +257,13 @@ fn bindgen_test_layout_rte_ipv6_tuple() {
)
);
}
-impl Clone for rte_ipv6_tuple {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_ipv6_tuple {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_thash_tuple {
pub v4: rte_ipv4_tuple,
pub v6: rte_ipv6_tuple,
@@ -327,11 +297,6 @@ fn bindgen_test_layout_rte_thash_tuple() {
)
);
}
-impl Clone for rte_thash_tuple {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_thash_tuple {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs
index 3c8953e6..ac2fb747 100644
--- a/tests/expectations/tests/accessors.rs
+++ b/tests/expectations/tests/accessors.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct SomeAccessors {
pub mNoAccessor: ::std::os::raw::c_int,
/// <div rustbindgen accessor></div>
@@ -68,11 +68,6 @@ fn bindgen_test_layout_SomeAccessors() {
)
);
}
-impl Clone for SomeAccessors {
- fn clone(&self) -> Self {
- *self
- }
-}
impl SomeAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -97,7 +92,7 @@ impl SomeAccessors {
}
/// <div rustbindgen accessor></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct AllAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
pub mAlsoBothAccessors: ::std::os::raw::c_int,
@@ -135,11 +130,6 @@ fn bindgen_test_layout_AllAccessors() {
)
);
}
-impl Clone for AllAccessors {
- fn clone(&self) -> Self {
- *self
- }
-}
impl AllAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -160,7 +150,7 @@ impl AllAccessors {
}
/// <div rustbindgen accessor="unsafe"></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct AllUnsafeAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
pub mAlsoBothAccessors: ::std::os::raw::c_int,
@@ -198,11 +188,6 @@ fn bindgen_test_layout_AllUnsafeAccessors() {
)
);
}
-impl Clone for AllUnsafeAccessors {
- fn clone(&self) -> Self {
- *self
- }
-}
impl AllUnsafeAccessors {
#[inline]
pub unsafe fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -223,7 +208,7 @@ impl AllUnsafeAccessors {
}
/// <div rustbindgen accessor></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct ContradictAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
/// <div rustbindgen accessor="false"></div>
@@ -286,11 +271,6 @@ fn bindgen_test_layout_ContradictAccessors() {
)
);
}
-impl Clone for ContradictAccessors {
- fn clone(&self) -> Self {
- *self
- }
-}
impl ContradictAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -315,7 +295,7 @@ impl ContradictAccessors {
}
/// <div rustbindgen accessor replaces="Replaced"></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Replaced {
pub mAccessor: ::std::os::raw::c_int,
}
@@ -342,11 +322,6 @@ fn bindgen_test_layout_Replaced() {
)
);
}
-impl Clone for Replaced {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Replaced {
#[inline]
pub fn get_mAccessor(&self) -> &::std::os::raw::c_int {
@@ -359,7 +334,7 @@ impl Replaced {
}
/// <div rustbindgen accessor></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Wrapper {
pub mReplaced: Replaced,
}
@@ -386,11 +361,6 @@ fn bindgen_test_layout_Wrapper() {
)
);
}
-impl Clone for Wrapper {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Wrapper {
#[inline]
pub fn get_mReplaced(&self) -> &Replaced {
diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs
index 0cd443a7..7f68d115 100644
--- a/tests/expectations/tests/annotation_hide.rs
+++ b/tests/expectations/tests/annotation_hide.rs
@@ -7,7 +7,7 @@
/// <div rustbindgen opaque></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct D {
pub _bindgen_opaque_blob: u32,
}
@@ -24,13 +24,8 @@ fn bindgen_test_layout_D() {
concat!("Alignment of ", stringify!(D))
);
}
-impl Clone for D {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct NotAnnotated {
pub f: ::std::os::raw::c_int,
}
@@ -57,8 +52,3 @@ fn bindgen_test_layout_NotAnnotated() {
)
);
}
-impl Clone for NotAnnotated {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs
index b185aae5..3dfd5ad3 100644
--- a/tests/expectations/tests/anon_enum.rs
+++ b/tests/expectations/tests/anon_enum.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct Test {
pub foo: ::std::os::raw::c_int,
pub bar: f32,
@@ -49,11 +49,6 @@ fn bindgen_test_layout_Test() {
)
);
}
-impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Baz {
diff --git a/tests/expectations/tests/anon_enum_trait.rs b/tests/expectations/tests/anon_enum_trait.rs
index c037a08b..9f5a6c56 100644
--- a/tests/expectations/tests/anon_enum_trait.rs
+++ b/tests/expectations/tests/anon_enum_trait.rs
@@ -24,7 +24,7 @@ pub enum DataType__bindgen_ty_1 {
generic_type = 0,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo {
pub _address: u8,
}
@@ -48,8 +48,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index 87329d1a..4a5054f6 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -5,18 +5,18 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct s {
pub u: s__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union s__bindgen_ty_1 {
pub field: s__bindgen_ty_1_inner,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct s__bindgen_ty_1_inner {
pub b: ::std::os::raw::c_int,
}
@@ -43,11 +43,6 @@ fn bindgen_test_layout_s__bindgen_ty_1_inner() {
)
);
}
-impl Clone for s__bindgen_ty_1_inner {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_s__bindgen_ty_1() {
assert_eq!(
@@ -71,11 +66,6 @@ fn bindgen_test_layout_s__bindgen_ty_1() {
)
);
}
-impl Clone for s__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for s__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -99,11 +89,6 @@ fn bindgen_test_layout_s() {
concat!("Alignment of field: ", stringify!(s), "::", stringify!(u))
);
}
-impl Clone for s {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for s {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/base-to-derived.rs b/tests/expectations/tests/base-to-derived.rs
index 7042226c..9df54d98 100644
--- a/tests/expectations/tests/base-to-derived.rs
+++ b/tests/expectations/tests/base-to-derived.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct false_type {
pub _address: u8,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_false_type() {
concat!("Alignment of ", stringify!(false_type))
);
}
-impl Clone for false_type {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/bitfield-32bit-overflow.rs b/tests/expectations/tests/bitfield-32bit-overflow.rs
index c9051371..dfd53847 100644
--- a/tests/expectations/tests/bitfield-32bit-overflow.rs
+++ b/tests/expectations/tests/bitfield-32bit-overflow.rs
@@ -5,7 +5,7 @@
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct MuchBitfield {
pub _bitfield_1: [u8; 5usize],
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout_MuchBitfield() {
concat!("Alignment of ", stringify!(MuchBitfield))
);
}
-impl Clone for MuchBitfield {
- fn clone(&self) -> Self {
- *self
- }
-}
impl MuchBitfield {
#[inline]
pub fn m0(&self) -> ::std::os::raw::c_char {
diff --git a/tests/expectations/tests/bitfield-enum-basic.rs b/tests/expectations/tests/bitfield-enum-basic.rs
index b7c24fb2..84362d12 100644
--- a/tests/expectations/tests/bitfield-enum-basic.rs
+++ b/tests/expectations/tests/bitfield-enum-basic.rs
@@ -102,7 +102,7 @@ impl ::std::ops::BitAndAssign for _bindgen_ty_1 {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct _bindgen_ty_1(pub ::std::os::raw::c_uint);
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Dummy {
pub _address: u8,
}
@@ -150,8 +150,3 @@ fn bindgen_test_layout_Dummy() {
concat!("Alignment of ", stringify!(Dummy))
);
}
-impl Clone for Dummy {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/bitfield-large.rs b/tests/expectations/tests/bitfield-large.rs
index facc7338..c3209ea5 100644
--- a/tests/expectations/tests/bitfield-large.rs
+++ b/tests/expectations/tests/bitfield-large.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct HasBigBitfield {
pub _bitfield_1: [u8; 16usize],
}
@@ -17,13 +17,8 @@ fn bindgen_test_layout_HasBigBitfield() {
concat!("Size of: ", stringify!(HasBigBitfield))
);
}
-impl Clone for HasBigBitfield {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct HasTwoBigBitfields {
pub _bitfield_1: [u8; 16usize],
}
@@ -35,8 +30,3 @@ fn bindgen_test_layout_HasTwoBigBitfields() {
concat!("Size of: ", stringify!(HasTwoBigBitfields))
);
}
-impl Clone for HasTwoBigBitfields {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/bitfield-method-same-name.rs b/tests/expectations/tests/bitfield-method-same-name.rs
index 9829e4b9..d202893f 100644
--- a/tests/expectations/tests/bitfield-method-same-name.rs
+++ b/tests/expectations/tests/bitfield-method-same-name.rs
@@ -5,7 +5,7 @@
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _bitfield_1: u8,
}
@@ -34,11 +34,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3Foo8set_typeEc"]
pub fn Foo_set_type(this: *mut Foo, c: ::std::os::raw::c_char);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Foo {
#[inline]
pub fn type__bindgen_bitfield(&self) -> ::std::os::raw::c_char {
diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs
index 559f5a38..aa718a74 100644
--- a/tests/expectations/tests/bitfield_align.rs
+++ b/tests/expectations/tests/bitfield_align.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub x: ::std::os::raw::c_uchar,
pub _bitfield_1: [u8; 2usize],
@@ -35,11 +35,6 @@ fn bindgen_test_layout_A() {
concat!("Alignment of field: ", stringify!(A), "::", stringify!(y))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
impl A {
#[inline]
pub fn b1(&self) -> ::std::os::raw::c_uint {
@@ -427,7 +422,7 @@ impl A {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct B {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
@@ -445,11 +440,6 @@ fn bindgen_test_layout_B() {
concat!("Alignment of ", stringify!(B))
);
}
-impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
-}
impl B {
#[inline]
pub fn foo(&self) -> ::std::os::raw::c_uint {
@@ -530,7 +520,7 @@ impl B {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct C {
pub x: ::std::os::raw::c_uchar,
pub _bitfield_1: u8,
@@ -559,11 +549,6 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(baz))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl C {
#[inline]
pub fn b1(&self) -> ::std::os::raw::c_uint {
@@ -644,7 +629,7 @@ impl C {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Date1 {
pub _bitfield_1: [u8; 3usize],
pub __bindgen_padding_0: u8,
@@ -663,11 +648,6 @@ fn bindgen_test_layout_Date1() {
concat!("Alignment of ", stringify!(Date1))
);
}
-impl Clone for Date1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Date1 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
@@ -827,7 +807,7 @@ impl Date1 {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Date2 {
pub _bitfield_1: [u8; 4usize],
pub __bindgen_align: [u16; 0usize],
@@ -845,11 +825,6 @@ fn bindgen_test_layout_Date2() {
concat!("Alignment of ", stringify!(Date2))
);
}
-impl Clone for Date2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Date2 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
@@ -1047,7 +1022,7 @@ impl Date2 {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Date3 {
pub _bitfield_1: [u8; 3usize],
pub byte: ::std::os::raw::c_uchar,
@@ -1076,11 +1051,6 @@ fn bindgen_test_layout_Date3() {
)
);
}
-impl Clone for Date3 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Date3 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
diff --git a/tests/expectations/tests/bitfield_align_2.rs b/tests/expectations/tests/bitfield_align_2.rs
index d6df314c..b10e126f 100644
--- a/tests/expectations/tests/bitfield_align_2.rs
+++ b/tests/expectations/tests/bitfield_align_2.rs
@@ -13,7 +13,7 @@ pub enum MyEnum {
FOUR = 3,
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct TaggedPtr {
pub _bitfield_1: u64,
pub __bindgen_align: [u64; 0usize],
@@ -31,11 +31,6 @@ fn bindgen_test_layout_TaggedPtr() {
concat!("Alignment of ", stringify!(TaggedPtr))
);
}
-impl Clone for TaggedPtr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for TaggedPtr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/bitfield_large_overflow.rs b/tests/expectations/tests/bitfield_large_overflow.rs
index ee8a4449..e5b254cf 100644
--- a/tests/expectations/tests/bitfield_large_overflow.rs
+++ b/tests/expectations/tests/bitfield_large_overflow.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct _bindgen_ty_1 {
pub _bindgen_opaque_blob: [u64; 10usize],
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout__bindgen_ty_1() {
concat!("Alignment of ", stringify!(_bindgen_ty_1))
);
}
-impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}a"]
pub static mut a: _bindgen_ty_1;
diff --git a/tests/expectations/tests/bitfield_method_mangling.rs b/tests/expectations/tests/bitfield_method_mangling.rs
index a56e57f0..32e61e67 100644
--- a/tests/expectations/tests/bitfield_method_mangling.rs
+++ b/tests/expectations/tests/bitfield_method_mangling.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct mach_msg_type_descriptor_t {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
@@ -23,11 +23,6 @@ fn bindgen_test_layout_mach_msg_type_descriptor_t() {
concat!("Alignment of ", stringify!(mach_msg_type_descriptor_t))
);
}
-impl Clone for mach_msg_type_descriptor_t {
- fn clone(&self) -> Self {
- *self
- }
-}
impl mach_msg_type_descriptor_t {
#[inline]
pub fn pad3(&self) -> ::std::os::raw::c_uint {
diff --git a/tests/expectations/tests/c-empty-layout.rs b/tests/expectations/tests/c-empty-layout.rs
index 65420810..a14022f5 100644
--- a/tests/expectations/tests/c-empty-layout.rs
+++ b/tests/expectations/tests/c-empty-layout.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {}
#[test]
fn bindgen_test_layout_Foo() {
@@ -20,8 +20,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/canonical_path_without_namespacing.rs b/tests/expectations/tests/canonical_path_without_namespacing.rs
index cf14bf20..02955e44 100644
--- a/tests/expectations/tests/canonical_path_without_namespacing.rs
+++ b/tests/expectations/tests/canonical_path_without_namespacing.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of ", stringify!(Bar))
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}_Z3bazPN3foo3BarE"]
pub fn baz(arg1: *mut Bar);
diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs
index daad07b4..9f7834ae 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Test {
pub ch: ::std::os::raw::c_char,
pub u: ::std::os::raw::c_uchar,
@@ -156,8 +156,3 @@ fn bindgen_test_layout_Test() {
)
);
}
-impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index eb09d753..784a42d3 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -42,7 +42,7 @@ impl<T> ::std::clone::Clone for __IncompleteArrayField<T> {
}
impl<T> ::std::marker::Copy for __IncompleteArrayField<T> {}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct C {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
@@ -75,11 +75,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -334,7 +329,7 @@ impl Default for IncompleteArrayNonCopiable {
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union Union {
pub d: f32,
pub i: ::std::os::raw::c_int,
@@ -373,18 +368,13 @@ fn bindgen_test_layout_Union() {
)
);
}
-impl Clone for Union {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Union {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct WithUnion {
pub data: Union,
}
@@ -411,18 +401,13 @@ fn bindgen_test_layout_WithUnion() {
)
);
}
-impl Clone for WithUnion {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithUnion {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct RealAbstractionWithTonsOfMethods {
pub _address: u8,
}
@@ -461,11 +446,6 @@ extern "C" {
#[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"]
pub fn RealAbstractionWithTonsOfMethods_sta();
}
-impl Clone for RealAbstractionWithTonsOfMethods {
- fn clone(&self) -> Self {
- *self
- }
-}
impl RealAbstractionWithTonsOfMethods {
#[inline]
pub unsafe fn bar(&self) {
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
index 32b01f86..e9d02479 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A {
pub member_a: ::std::os::raw::c_int,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_B {
pub member_b: ::std::os::raw::c_int,
}
@@ -37,11 +37,6 @@ fn bindgen_test_layout_A_B() {
)
);
}
-impl Clone for A_B {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_D<T> {
@@ -76,13 +71,8 @@ fn bindgen_test_layout_A() {
)
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_C {
pub baz: ::std::os::raw::c_int,
}
@@ -109,11 +99,6 @@ fn bindgen_test_layout_A_C() {
)
);
}
-impl Clone for A_C {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}var"]
pub static mut var: A_B;
@@ -142,7 +127,7 @@ extern "C" {
pub static mut baz: A_D<::std::os::raw::c_int>;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct D {
pub member: A_B,
}
@@ -169,11 +154,6 @@ fn bindgen_test_layout_D() {
)
);
}
-impl Clone for D {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated<T> {
diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs
index c41f0b04..01ae9474 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever {
pub _address: u8,
}
@@ -22,13 +22,8 @@ fn bindgen_test_layout_whatever() {
concat!("Alignment of ", stringify!(whatever))
);
}
-impl Clone for whatever {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever_child {
pub _address: u8,
}
@@ -45,13 +40,8 @@ fn bindgen_test_layout_whatever_child() {
concat!("Alignment of ", stringify!(whatever_child))
);
}
-impl Clone for whatever_child {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever_child_with_member {
pub m_member: ::std::os::raw::c_int,
}
@@ -78,8 +68,3 @@ fn bindgen_test_layout_whatever_child_with_member() {
)
);
}
-impl Clone for whatever_child_with_member {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs
index e03938a0..c28366c1 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct MyClass {
pub _address: u8,
}
@@ -30,11 +30,6 @@ fn bindgen_test_layout_MyClass() {
concat!("Alignment of ", stringify!(MyClass))
);
}
-impl Clone for MyClass {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}_ZL26example_check_no_collision"]
pub static mut example_check_no_collision: *const ::std::os::raw::c_int;
diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs
index 945236de..c0945c43 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A {
pub _address: u8,
}
@@ -25,8 +25,3 @@ fn bindgen_test_layout_A() {
concat!("Alignment of ", stringify!(A))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
index af73ae3b..95b2a7fd 100644
--- a/tests/expectations/tests/class_use_as.rs
+++ b/tests/expectations/tests/class_use_as.rs
@@ -7,7 +7,7 @@
/// <div rustbindgen="true" replaces="whatever"></div>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever {
pub replacement: ::std::os::raw::c_int,
}
@@ -34,13 +34,8 @@ fn bindgen_test_layout_whatever() {
)
);
}
-impl Clone for whatever {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct container {
pub c: whatever,
}
@@ -67,8 +62,3 @@ fn bindgen_test_layout_container() {
)
);
}
-impl Clone for container {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index f471a757..4848bc17 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -5,14 +5,14 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -50,13 +50,8 @@ fn bindgen_test_layout_A_Segment() {
)
);
}
-impl Clone for A_Segment {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union A__bindgen_ty_1 {
pub f: ::std::os::raw::c_int,
_bindgen_union_align: u32,
@@ -84,18 +79,13 @@ fn bindgen_test_layout_A__bindgen_ty_1() {
)
);
}
-impl Clone for A__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for A__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union A__bindgen_ty_2 {
pub d: ::std::os::raw::c_int,
_bindgen_union_align: u32,
@@ -123,11 +113,6 @@ fn bindgen_test_layout_A__bindgen_ty_2() {
)
);
}
-impl Clone for A__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for A__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -161,23 +146,18 @@ fn bindgen_test_layout_A() {
)
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for A {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct B {
pub d: ::std::os::raw::c_uint,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct B_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -215,11 +195,6 @@ fn bindgen_test_layout_B_Segment() {
)
);
}
-impl Clone for B_Segment {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_B() {
assert_eq!(
@@ -238,11 +213,6 @@ fn bindgen_test_layout_B() {
concat!("Alignment of field: ", stringify!(B), "::", stringify!(d))
);
}
-impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum StepSyntax {
@@ -252,20 +222,20 @@ pub enum StepSyntax {
FunctionalWithEndKeyword = 3,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct C {
pub d: ::std::os::raw::c_uint,
pub __bindgen_anon_1: C__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union C__bindgen_ty_1 {
pub mFunc: C__bindgen_ty_1__bindgen_ty_1,
pub __bindgen_anon_1: C__bindgen_ty_1__bindgen_ty_2,
_bindgen_union_align: [u32; 4usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct C__bindgen_ty_1__bindgen_ty_1 {
pub mX1: f32,
pub mY1: f32,
@@ -325,13 +295,8 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct C__bindgen_ty_1__bindgen_ty_2 {
pub mStepSyntax: StepSyntax,
pub mSteps: ::std::os::raw::c_uint,
@@ -369,11 +334,6 @@ fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() {
)
);
}
-impl Clone for C__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -402,18 +362,13 @@ fn bindgen_test_layout_C__bindgen_ty_1() {
)
);
}
-impl Clone for C__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct C_Segment {
pub begin: ::std::os::raw::c_int,
pub end: ::std::os::raw::c_int,
@@ -451,11 +406,6 @@ fn bindgen_test_layout_C_Segment() {
)
);
}
-impl Clone for C_Segment {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_C() {
assert_eq!(
@@ -474,11 +424,6 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(d))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs
index 90648fcc..459d580c 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct C {
pub c: C_MyInt,
pub ptr: *mut C_MyInt,
@@ -75,11 +75,6 @@ extern "C" {
#[link_name = "\u{1}_ZN1C13anotherMethodEi"]
pub fn C_anotherMethod(this: *mut C, c: AnotherInt);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -104,7 +99,7 @@ impl C {
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct D {
pub _base: C,
pub ptr: *mut C_MyInt,
@@ -127,11 +122,6 @@ fn bindgen_test_layout_D() {
concat!("Alignment of field: ", stringify!(D), "::", stringify!(ptr))
);
}
-impl Clone for D {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for D {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs
index 3563da26..4fe2b5eb 100644
--- a/tests/expectations/tests/comment-indent.rs
+++ b/tests/expectations/tests/comment-indent.rs
@@ -12,7 +12,7 @@ pub mod root {
///
/// This class is really really interesting, look!
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -20,7 +20,7 @@ pub mod root {
///
/// This class is not so interesting, but worth a bit of docs too!
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Foo_Bar {
pub _address: u8,
}
@@ -37,11 +37,6 @@ pub mod root {
concat!("Alignment of ", stringify!(Foo_Bar))
);
}
- impl Clone for Foo_Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
@@ -55,18 +50,13 @@ pub mod root {
concat!("Alignment of ", stringify!(Foo))
);
}
- impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
- }
pub mod test {
#[allow(unused_imports)]
use self::super::super::root;
/// I'm in a namespace, and thus I may be on a rust module, most of the time.
/// My documentation is pretty extensive, I guess.
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Baz {
/// This member is plain awesome, just amazing.
///
@@ -100,16 +90,11 @@ pub mod root {
)
);
}
- impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
- }
/// I'm in an inline namespace, and as such I shouldn't get generated inside
/// a rust module, except when the relevant option is specified. Also, this
/// comment shouldn't be misaligned.
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct InInlineNS {
pub _address: u8,
}
@@ -126,14 +111,9 @@ pub mod root {
concat!("Alignment of ", stringify!(InInlineNS))
);
}
- impl Clone for InInlineNS {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bazz {
pub _address: u8,
}
@@ -150,10 +130,5 @@ pub mod root {
concat!("Alignment of ", stringify!(Bazz))
);
}
- impl Clone for Bazz {
- fn clone(&self) -> Self {
- *self
- }
- }
}
}
diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs
index 67721d06..02c8714c 100644
--- a/tests/expectations/tests/complex.rs
+++ b/tests/expectations/tests/complex.rs
@@ -11,7 +11,7 @@ pub struct __BindgenComplex<T> {
pub im: T,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct TestDouble {
pub mMember: __BindgenComplex<f64>,
}
@@ -38,13 +38,8 @@ fn bindgen_test_layout_TestDouble() {
)
);
}
-impl Clone for TestDouble {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TestDoublePtr {
pub mMember: *mut __BindgenComplex<f64>,
}
@@ -71,18 +66,13 @@ fn bindgen_test_layout_TestDoublePtr() {
)
);
}
-impl Clone for TestDoublePtr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for TestDoublePtr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct TestFloat {
pub mMember: __BindgenComplex<f32>,
}
@@ -109,13 +99,8 @@ fn bindgen_test_layout_TestFloat() {
)
);
}
-impl Clone for TestFloat {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TestFloatPtr {
pub mMember: *mut __BindgenComplex<f32>,
}
@@ -142,11 +127,6 @@ fn bindgen_test_layout_TestFloatPtr() {
)
);
}
-impl Clone for TestFloatPtr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for TestFloatPtr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/const_enum_unnamed.rs b/tests/expectations/tests/const_enum_unnamed.rs
index 2749321f..539c8916 100644
--- a/tests/expectations/tests/const_enum_unnamed.rs
+++ b/tests/expectations/tests/const_enum_unnamed.rs
@@ -13,7 +13,7 @@ pub enum _bindgen_ty_1 {
FOO_BAZ = 1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -36,8 +36,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/constify-all-enums.rs b/tests/expectations/tests/constify-all-enums.rs
index af13e079..3b37daf3 100644
--- a/tests/expectations/tests/constify-all-enums.rs
+++ b/tests/expectations/tests/constify-all-enums.rs
@@ -9,7 +9,7 @@ pub const foo_SHOULD_BE: foo = 1;
pub const foo_A_CONSTANT: foo = 2;
pub type foo = ::std::os::raw::c_uint;
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct bar {
pub this_should_work: foo,
}
@@ -36,11 +36,6 @@ fn bindgen_test_layout_bar() {
)
);
}
-impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-basic.rs b/tests/expectations/tests/constify-module-enums-basic.rs
index bfe33c6b..6c56e2ec 100644
--- a/tests/expectations/tests/constify-module-enums-basic.rs
+++ b/tests/expectations/tests/constify-module-enums-basic.rs
@@ -13,7 +13,7 @@ pub mod foo {
pub use self::foo::Type as foo_alias1;
pub use self::foo_alias1 as foo_alias2;
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct bar {
pub this_should_work: foo::Type,
}
@@ -40,11 +40,6 @@ fn bindgen_test_layout_bar() {
)
);
}
-impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-namespace.rs b/tests/expectations/tests/constify-module-enums-namespace.rs
index 0a44963f..b09f837d 100644
--- a/tests/expectations/tests/constify-module-enums-namespace.rs
+++ b/tests/expectations/tests/constify-module-enums-namespace.rs
@@ -25,7 +25,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::super::root;
#[repr(C)]
- #[derive(Debug, Copy)]
+ #[derive(Debug, Copy, Clone)]
pub struct bar {
pub this_should_work: root::ns1::ns2::foo::Type,
}
@@ -52,11 +52,6 @@ pub mod root {
)
);
}
- impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-shadow-name.rs b/tests/expectations/tests/constify-module-enums-shadow-name.rs
index 58debcc6..1f2b4b2f 100644
--- a/tests/expectations/tests/constify-module-enums-shadow-name.rs
+++ b/tests/expectations/tests/constify-module-enums-shadow-name.rs
@@ -12,7 +12,7 @@ pub mod foo {
pub const Type__: Type = 3;
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct bar {
pub member: foo::Type,
}
@@ -39,11 +39,6 @@ fn bindgen_test_layout_bar() {
)
);
}
-impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs
index 75c952d7..0387ddd0 100644
--- a/tests/expectations/tests/constify-module-enums-simple-alias.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs
@@ -14,7 +14,7 @@ pub use self::Foo::Type as Foo_alias1;
pub use self::Foo_alias1 as Foo_alias2;
pub use self::Foo_alias2 as Foo_alias3;
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar {
pub baz1: Foo::Type,
pub baz2: Foo_alias1,
@@ -118,11 +118,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
index 32c173ef..7fb4606f 100644
--- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
@@ -10,7 +10,7 @@ pub mod one_Foo {
pub const Variant2: Type = 1;
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar {
pub baz1: one_Foo::Type,
pub baz2: *mut one_Foo::Type,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs
index 2d516fe4..cc1f3d4c 100644
--- a/tests/expectations/tests/constify-module-enums-types.rs
+++ b/tests/expectations/tests/constify-module-enums-types.rs
@@ -37,7 +37,7 @@ pub use self::anon_enum::Type as anon_enum_alias1;
pub use self::anon_enum_alias1 as anon_enum_alias2;
pub use self::anon_enum_alias2 as anon_enum_alias3;
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct bar {
pub member1: foo::Type,
pub member2: foo_alias1,
@@ -163,18 +163,13 @@ fn bindgen_test_layout_bar() {
)
);
}
-impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Baz {
pub member1: ns2_Foo::Type,
}
@@ -201,11 +196,6 @@ fn bindgen_test_layout_Baz() {
)
);
}
-impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Baz {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -217,7 +207,7 @@ pub mod one_Foo {
pub const Variant2: Type = 1;
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar {
pub baz: *mut one_Foo::Type,
}
@@ -244,11 +234,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/constructor-tp.rs b/tests/expectations/tests/constructor-tp.rs
index 081abf89..73360248 100644
--- a/tests/expectations/tests/constructor-tp.rs
+++ b/tests/expectations/tests/constructor-tp.rs
@@ -10,7 +10,7 @@ pub struct Foo {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
@@ -31,11 +31,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3BarC1Ev"]
pub fn Bar_Bar(this: *mut Bar);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Bar {
#[inline]
pub unsafe fn new() -> Self {
diff --git a/tests/expectations/tests/constructors.rs b/tests/expectations/tests/constructors.rs
index 8d0c8c2d..b20e3f44 100644
--- a/tests/expectations/tests/constructors.rs
+++ b/tests/expectations/tests/constructors.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct TestOverload {
pub _address: u8,
}
@@ -30,11 +30,6 @@ extern "C" {
#[link_name = "\u{1}_ZN12TestOverloadC1Ed"]
pub fn TestOverload_TestOverload1(this: *mut TestOverload, arg1: f64);
}
-impl Clone for TestOverload {
- fn clone(&self) -> Self {
- *self
- }
-}
impl TestOverload {
#[inline]
pub unsafe fn new(arg1: ::std::os::raw::c_int) -> Self {
@@ -50,7 +45,7 @@ impl TestOverload {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct TestPublicNoArgs {
pub _address: u8,
}
@@ -71,11 +66,6 @@ extern "C" {
#[link_name = "\u{1}_ZN16TestPublicNoArgsC1Ev"]
pub fn TestPublicNoArgs_TestPublicNoArgs(this: *mut TestPublicNoArgs);
}
-impl Clone for TestPublicNoArgs {
- fn clone(&self) -> Self {
- *self
- }
-}
impl TestPublicNoArgs {
#[inline]
pub unsafe fn new() -> Self {
diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
index 325682d1..b471386a 100644
--- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs
+++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
@@ -7,7 +7,7 @@
pub type mbedtls_mpi_uint = ::std::os::raw::c_uint;
/// \brief MPI structure
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct mbedtls_mpi {
/// < integer sign
pub s: ::std::os::raw::c_int,
@@ -59,11 +59,6 @@ fn bindgen_test_layout_mbedtls_mpi() {
)
);
}
-impl Clone for mbedtls_mpi {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for mbedtls_mpi {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs
index 8d6f3b92..87554a2c 100644
--- a/tests/expectations/tests/convert-floats.rs
+++ b/tests/expectations/tests/convert-floats.rs
@@ -11,7 +11,7 @@ pub struct __BindgenComplex<T> {
pub im: T,
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct foo {
pub bar: ::std::os::raw::c_float,
pub baz: ::std::os::raw::c_float,
@@ -93,11 +93,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/cpp-empty-layout.rs b/tests/expectations/tests/cpp-empty-layout.rs
index f84a7005..36cae722 100644
--- a/tests/expectations/tests/cpp-empty-layout.rs
+++ b/tests/expectations/tests/cpp-empty-layout.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/crtp.rs b/tests/expectations/tests/crtp.rs
index eb560b3b..c56cceb2 100644
--- a/tests/expectations/tests/crtp.rs
+++ b/tests/expectations/tests/crtp.rs
@@ -10,7 +10,7 @@ pub struct Base {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Derived {
pub _address: u8,
}
@@ -27,11 +27,6 @@ fn bindgen_test_layout_Derived() {
concat!("Alignment of ", stringify!(Derived))
);
}
-impl Clone for Derived {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Default)]
pub struct BaseWithDestructor {
diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs
index 143a6ce4..62050886 100644
--- a/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs
@@ -9,7 +9,7 @@
/// and --with-derive-partialeq --impl-partialeq --impl-debug is provided,
/// this struct should manually implement `Debug` and `PartialEq`.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct Foo {
pub large: [::std::os::raw::c_int; 33usize],
pub _bitfield_1: [u8; 2usize],
@@ -50,11 +50,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3Foo8set_typeEc"]
pub fn Foo_set_type(this: *mut Foo, c: ::std::os::raw::c_char);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs
new file mode 100644
index 00000000..356d93e3
--- /dev/null
+++ b/tests/expectations/tests/derive-clone.rs
@@ -0,0 +1,41 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+
+/// This struct should derive `Clone`.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ShouldDeriveClone {
+ pub large: [::std::os::raw::c_int; 33usize],
+}
+#[test]
+fn bindgen_test_layout_ShouldDeriveClone() {
+ assert_eq!(
+ ::std::mem::size_of::<ShouldDeriveClone>(),
+ 132usize,
+ concat!("Size of: ", stringify!(ShouldDeriveClone))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ShouldDeriveClone>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(ShouldDeriveClone))
+ );
+ assert_eq!(
+ unsafe { &(*(0 as *const ShouldDeriveClone)).large as *const _ as usize },
+ 0usize,
+ concat!(
+ "Alignment of field: ",
+ stringify!(ShouldDeriveClone),
+ "::",
+ stringify!(large)
+ )
+ );
+}
+impl Default for ShouldDeriveClone {
+ fn default() -> Self {
+ unsafe { ::std::mem::zeroed() }
+ }
+}
diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs
new file mode 100644
index 00000000..2ead68ee
--- /dev/null
+++ b/tests/expectations/tests/derive-clone_1_0.rs
@@ -0,0 +1,47 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+
+/// Since builtin `Clone` impls were introduced in Rust 1.21 this struct
+/// should impl `Clone` "manually".
+#[repr(C)]
+#[derive(Copy)]
+pub struct ShouldImplClone {
+ pub large: [::std::os::raw::c_int; 33usize],
+}
+#[test]
+fn bindgen_test_layout_ShouldImplClone() {
+ assert_eq!(
+ ::std::mem::size_of::<ShouldImplClone>(),
+ 132usize,
+ concat!("Size of: ", stringify!(ShouldImplClone))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ShouldImplClone>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(ShouldImplClone))
+ );
+ assert_eq!(
+ unsafe { &(*(0 as *const ShouldImplClone)).large as *const _ as usize },
+ 0usize,
+ concat!(
+ "Alignment of field: ",
+ stringify!(ShouldImplClone),
+ "::",
+ stringify!(large)
+ )
+ );
+}
+impl Clone for ShouldImplClone {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl Default for ShouldImplClone {
+ fn default() -> Self {
+ unsafe { ::std::mem::zeroed() }
+ }
+}
diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs
index 53fcf716..d664a4ba 100644
--- a/tests/expectations/tests/derive-debug-bitfield.rs
+++ b/tests/expectations/tests/derive-debug-bitfield.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct C {
pub _bitfield_1: u8,
pub large_array: [::std::os::raw::c_int; 50usize],
@@ -33,11 +33,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs
index 5c929909..01ffe206 100644
--- a/tests/expectations/tests/derive-debug-function-pointer.rs
+++ b/tests/expectations/tests/derive-debug-function-pointer.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct Nice {
pub pointer: Nice_Function,
pub large_array: [::std::os::raw::c_int; 34usize],
@@ -44,11 +44,6 @@ fn bindgen_test_layout_Nice() {
)
);
}
-impl Clone for Nice {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Nice {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs
index 096a67d5..382d9063 100644
--- a/tests/expectations/tests/derive-fn-ptr.rs
+++ b/tests/expectations/tests/derive-fn-ptr.rs
@@ -25,7 +25,7 @@ pub type my_fun_t = ::std::option::Option<
),
>;
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct Foo {
pub callback: my_fun_t,
}
@@ -52,11 +52,6 @@ fn bindgen_test_layout_Foo() {
)
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -79,7 +74,7 @@ pub type my_fun2_t = ::std::option::Option<
),
>;
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Bar {
pub callback: my_fun2_t,
}
@@ -106,11 +101,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
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 6436b69a..b4f93f73 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
@@ -7,12 +7,12 @@
/// A struct containing a struct containing a float that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialOrd, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialOrd, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
pub struct foo__bindgen_ty_1 {
pub a: f32,
pub b: f32,
@@ -50,11 +50,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -78,8 +73,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
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 dd9acc6a..d736c114 100644
--- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
@@ -7,7 +7,7 @@
/// A struct containing an array of floats that cannot derive Hash/Eq/Ord but can derive PartialEq/PartialOrd
#[repr(C)]
-#[derive(Debug, Default, Copy, PartialOrd, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
pub struct foo {
pub bar: [f32; 3usize],
}
@@ -34,8 +34,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
index b2ae7ab2..7ff50fcf 100644
--- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
@@ -7,7 +7,7 @@
/// Pointers can derive Hash/PartialOrd/Ord/PartialEq/Eq
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct ConstPtrMutObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -34,18 +34,13 @@ fn bindgen_test_layout_ConstPtrMutObj() {
)
);
}
-impl Clone for ConstPtrMutObj {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ConstPtrMutObj {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct MutPtrMutObj {
pub bar: *mut ::std::os::raw::c_int,
}
@@ -72,18 +67,13 @@ fn bindgen_test_layout_MutPtrMutObj() {
)
);
}
-impl Clone for MutPtrMutObj {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for MutPtrMutObj {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct MutPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -110,18 +100,13 @@ fn bindgen_test_layout_MutPtrConstObj() {
)
);
}
-impl Clone for MutPtrConstObj {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for MutPtrConstObj {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct ConstPtrConstObj {
pub bar: *const ::std::os::raw::c_int,
}
@@ -148,11 +133,6 @@ fn bindgen_test_layout_ConstPtrConstObj() {
)
);
}
-impl Clone for ConstPtrConstObj {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ConstPtrConstObj {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs
index 6473beba..4fd935aa 100644
--- a/tests/expectations/tests/derive-hash-template-inst-float.rs
+++ b/tests/expectations/tests/derive-hash-template-inst-float.rs
@@ -19,7 +19,7 @@ impl<T> Default for foo<T> {
}
/// Can derive Hash/PartialOrd/Ord/PartialEq/Eq when instantiated with int
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct IntStr {
pub a: foo<::std::os::raw::c_int>,
}
@@ -46,11 +46,6 @@ fn bindgen_test_layout_IntStr() {
)
);
}
-impl Clone for IntStr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for IntStr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -58,7 +53,7 @@ impl Default for IntStr {
}
/// Cannot derive Hash/Eq/Ord when instantiated with float but can derive PartialEq/PartialOrd
#[repr(C)]
-#[derive(Debug, Copy, PartialOrd, PartialEq)]
+#[derive(Debug, Copy, Clone, PartialOrd, PartialEq)]
pub struct FloatStr {
pub a: foo<f32>,
}
@@ -85,11 +80,6 @@ fn bindgen_test_layout_FloatStr() {
)
);
}
-impl Clone for FloatStr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for FloatStr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-anonfield.rs b/tests/expectations/tests/derive-partialeq-anonfield.rs
index 6e3446d5..73972d70 100644
--- a/tests/expectations/tests/derive-partialeq-anonfield.rs
+++ b/tests/expectations/tests/derive-partialeq-anonfield.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_mbuf {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_1 {
_bindgen_union_align: [u8; 0usize],
}
@@ -27,11 +27,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_1))
);
}
-impl Clone for rte_mbuf__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -45,11 +40,6 @@ fn bindgen_test_layout_rte_mbuf() {
concat!("Size of: ", stringify!(rte_mbuf))
);
}
-impl Clone for rte_mbuf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs
index 12356655..cb86ebe6 100644
--- a/tests/expectations/tests/derive-partialeq-base.rs
+++ b/tests/expectations/tests/derive-partialeq-base.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct Base {
pub large: [::std::os::raw::c_int; 33usize],
}
@@ -32,11 +32,6 @@ fn bindgen_test_layout_Base() {
)
);
}
-impl Clone for Base {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Base {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -48,7 +43,7 @@ impl ::std::cmp::PartialEq for Base {
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct ShouldDerivePartialEq {
pub _base: Base,
}
@@ -65,11 +60,6 @@ fn bindgen_test_layout_ShouldDerivePartialEq() {
concat!("Alignment of ", stringify!(ShouldDerivePartialEq))
);
}
-impl Clone for ShouldDerivePartialEq {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ShouldDerivePartialEq {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs
index bc7e750e..b9e2db29 100644
--- a/tests/expectations/tests/derive-partialeq-bitfield.rs
+++ b/tests/expectations/tests/derive-partialeq-bitfield.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct C {
pub _bitfield_1: u8,
pub large_array: [::std::os::raw::c_int; 50usize],
@@ -33,11 +33,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-core.rs b/tests/expectations/tests/derive-partialeq-core.rs
index 1660f178..7b925fba 100644
--- a/tests/expectations/tests/derive-partialeq-core.rs
+++ b/tests/expectations/tests/derive-partialeq-core.rs
@@ -6,7 +6,7 @@
extern crate core;
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct C {
pub large_array: [::std::os::raw::c_int; 420usize],
}
@@ -33,11 +33,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs
index b1d3f04c..52a4bf71 100644
--- a/tests/expectations/tests/derive-partialeq-pointer.rs
+++ b/tests/expectations/tests/derive-partialeq-pointer.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Bar {
pub b: *mut a,
}
@@ -27,23 +27,18 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of field: ", stringify!(Bar), "::", stringify!(b))
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct c {
pub __bindgen_anon_1: c__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union c__bindgen_ty_1 {
_bindgen_union_align: u8,
pub _address: u8,
@@ -61,11 +56,6 @@ fn bindgen_test_layout_c__bindgen_ty_1() {
concat!("Alignment of ", stringify!(c__bindgen_ty_1))
);
}
-impl Clone for c__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for c__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -84,18 +74,13 @@ fn bindgen_test_layout_c() {
concat!("Alignment of ", stringify!(c))
);
}
-impl Clone for c {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for c {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct a {
pub d: c,
}
@@ -117,11 +102,6 @@ fn bindgen_test_layout_a() {
concat!("Alignment of field: ", stringify!(a), "::", stringify!(d))
);
}
-impl Clone for a {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for a {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs
index 975dee36..c2642062 100644
--- a/tests/expectations/tests/derive-partialeq-union.rs
+++ b/tests/expectations/tests/derive-partialeq-union.rs
@@ -7,7 +7,7 @@
/// Deriving PartialEq for rust unions is not supported.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union ShouldNotDerivePartialEq {
pub a: ::std::os::raw::c_char,
pub b: ::std::os::raw::c_int,
@@ -46,11 +46,6 @@ fn bindgen_test_layout_ShouldNotDerivePartialEq() {
)
);
}
-impl Clone for ShouldNotDerivePartialEq {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ShouldNotDerivePartialEq {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs
index 002e4475..2da07ded 100644
--- a/tests/expectations/tests/doggo-or-null.rs
+++ b/tests/expectations/tests/doggo-or-null.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Doggo {
pub x: ::std::os::raw::c_int,
}
@@ -32,13 +32,8 @@ fn bindgen_test_layout_Doggo() {
)
);
}
-impl Clone for Doggo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq)]
pub struct Null {
pub _address: u8,
}
@@ -55,11 +50,6 @@ fn bindgen_test_layout_Null() {
concat!("Alignment of ", stringify!(Null))
);
}
-impl Clone for Null {
- fn clone(&self) -> Self {
- *self
- }
-}
/// This type is an opaque union. Unions can't derive anything interesting like
/// Debug or Default, even if their layout can, because it would require knowing
/// which variant is in use. Opaque unions still end up as a `union` in the Rust
@@ -67,7 +57,7 @@ impl Clone for Null {
/// probably emit an opaque struct for opaque unions... but until then, we have
/// this test to make sure that opaque unions don't derive and still compile.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union DoggoOrNull {
pub _bindgen_opaque_blob: u32,
}
@@ -84,11 +74,6 @@ fn bindgen_test_layout_DoggoOrNull() {
concat!("Alignment of ", stringify!(DoggoOrNull))
);
}
-impl Clone for DoggoOrNull {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for DoggoOrNull {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs
index d907a19c..9732849c 100644
--- a/tests/expectations/tests/duplicated-namespaces-definitions.rs
+++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs
@@ -12,7 +12,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub foo: ::std::os::raw::c_int,
pub baz: bool,
@@ -50,17 +50,12 @@ pub mod root {
)
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
}
pub mod bar {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Copy)]
+ #[derive(Debug, Copy, Clone)]
pub struct Foo {
pub ptr: *mut root::foo::Bar,
}
@@ -87,11 +82,6 @@ pub mod root {
)
);
}
- impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for Foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs
index d6b41610..ffdcedd5 100644
--- a/tests/expectations/tests/enum_and_vtable_mangling.rs
+++ b/tests/expectations/tests/enum_and_vtable_mangling.rs
@@ -15,7 +15,7 @@ pub enum _bindgen_ty_1 {
#[repr(C)]
pub struct C__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct C {
pub vtable_: *const C__bindgen_vtable,
pub i: ::std::os::raw::c_int,
@@ -38,11 +38,6 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(i))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs
index c5eeb88e..8ad45f10 100644
--- a/tests/expectations/tests/forward-declaration-autoptr.rs
+++ b/tests/expectations/tests/forward-declaration-autoptr.rs
@@ -21,7 +21,7 @@ impl<T> Default for RefPtr<T> {
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar {
pub m_member: RefPtr<Foo>,
}
@@ -48,11 +48,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs
index a4eaa17c..ceab52d7 100644
--- a/tests/expectations/tests/forward_declared_complex_types.rs
+++ b/tests/expectations/tests/forward_declared_complex_types.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo_empty {
pub _address: u8,
}
@@ -22,18 +22,13 @@ fn bindgen_test_layout_Foo_empty() {
concat!("Alignment of ", stringify!(Foo_empty))
);
}
-impl Clone for Foo_empty {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Foo {
_unused: [u8; 0],
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Bar {
pub f: *mut Foo,
}
@@ -55,11 +50,6 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of field: ", stringify!(Bar), "::", stringify!(f))
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs
index 4450e65d..001d6df0 100644
--- a/tests/expectations/tests/forward_declared_struct.rs
+++ b/tests/expectations/tests/forward_declared_struct.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct a {
pub b: ::std::os::raw::c_int,
}
@@ -27,13 +27,8 @@ fn bindgen_test_layout_a() {
concat!("Alignment of field: ", stringify!(a), "::", stringify!(b))
);
}
-impl Clone for a {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct c {
pub d: ::std::os::raw::c_int,
}
@@ -55,8 +50,3 @@ fn bindgen_test_layout_c() {
concat!("Alignment of field: ", stringify!(c), "::", stringify!(d))
);
}
-impl Clone for c {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs
index 55c75ff1..5a2c00c7 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo {
pub bar: ::std::option::Option<
unsafe extern "C" fn(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) -> baz,
@@ -36,11 +36,6 @@ fn bindgen_test_layout_Foo() {
)
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/gen-constructors-neg.rs b/tests/expectations/tests/gen-constructors-neg.rs
index f84a7005..36cae722 100644
--- a/tests/expectations/tests/gen-constructors-neg.rs
+++ b/tests/expectations/tests/gen-constructors-neg.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/gen-constructors.rs b/tests/expectations/tests/gen-constructors.rs
index 07fded03..cb2024a1 100644
--- a/tests/expectations/tests/gen-constructors.rs
+++ b/tests/expectations/tests/gen-constructors.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -26,11 +26,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3FooC1Ei"]
pub fn Foo_Foo(this: *mut Foo, a: ::std::os::raw::c_int);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Foo {
#[inline]
pub unsafe fn new(a: ::std::os::raw::c_int) -> Self {
diff --git a/tests/expectations/tests/generate-inline.rs b/tests/expectations/tests/generate-inline.rs
index f4dafb45..48d8f4f8 100644
--- a/tests/expectations/tests/generate-inline.rs
+++ b/tests/expectations/tests/generate-inline.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -26,11 +26,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3Foo3barEv"]
pub fn Foo_bar() -> ::std::os::raw::c_int;
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Foo {
#[inline]
pub unsafe fn bar() -> ::std::os::raw::c_int {
diff --git a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
index 365114ba..cf8b283c 100644
--- a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
+++ b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs
@@ -21,7 +21,7 @@ impl<T> Default for BaseWithVtable<T> {
}
/// This should not have an explicit vtable.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct DerivedWithNoVirtualMethods {
pub _base: BaseWithVtable<*mut ::std::os::raw::c_char>,
}
@@ -38,11 +38,6 @@ fn bindgen_test_layout_DerivedWithNoVirtualMethods() {
concat!("Alignment of ", stringify!(DerivedWithNoVirtualMethods))
);
}
-impl Clone for DerivedWithNoVirtualMethods {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for DerivedWithNoVirtualMethods {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -50,7 +45,7 @@ impl Default for DerivedWithNoVirtualMethods {
}
/// This should not have an explicit vtable.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct DerivedWithVirtualMethods {
pub _base: BaseWithVtable<*mut ::std::os::raw::c_char>,
}
@@ -67,11 +62,6 @@ fn bindgen_test_layout_DerivedWithVirtualMethods() {
concat!("Alignment of ", stringify!(DerivedWithVirtualMethods))
);
}
-impl Clone for DerivedWithVirtualMethods {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for DerivedWithVirtualMethods {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -93,7 +83,7 @@ impl<U> Default for BaseWithoutVtable<U> {
pub struct DerivedWithVtable__bindgen_vtable(::std::os::raw::c_void);
/// This should have an explicit vtable.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct DerivedWithVtable {
pub vtable_: *const DerivedWithVtable__bindgen_vtable,
pub _base: BaseWithoutVtable<*mut ::std::os::raw::c_char>,
@@ -111,11 +101,6 @@ fn bindgen_test_layout_DerivedWithVtable() {
concat!("Alignment of ", stringify!(DerivedWithVtable))
);
}
-impl Clone for DerivedWithVtable {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for DerivedWithVtable {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -123,7 +108,7 @@ impl Default for DerivedWithVtable {
}
/// This should not have any vtable.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct DerivedWithoutVtable {
pub _base: BaseWithoutVtable<*mut ::std::os::raw::c_char>,
}
@@ -140,11 +125,6 @@ fn bindgen_test_layout_DerivedWithoutVtable() {
concat!("Alignment of ", stringify!(DerivedWithoutVtable))
);
}
-impl Clone for DerivedWithoutVtable {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for DerivedWithoutVtable {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/inherit_typedef.rs b/tests/expectations/tests/inherit_typedef.rs
index 1c07e1df..49e842d7 100644
--- a/tests/expectations/tests/inherit_typedef.rs
+++ b/tests/expectations/tests/inherit_typedef.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -22,14 +22,9 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
pub type TypedefedFoo = Foo;
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
@@ -46,8 +41,3 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of ", stringify!(Bar))
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs
index b31bbe04..ade3ce3b 100644
--- a/tests/expectations/tests/inline_namespace.rs
+++ b/tests/expectations/tests/inline_namespace.rs
@@ -14,7 +14,7 @@ pub mod root {
pub type Ty = ::std::os::raw::c_int;
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub baz: root::foo::Ty,
}
@@ -41,9 +41,4 @@ pub mod root {
)
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs
index 39e15611..7895a19f 100644
--- a/tests/expectations/tests/inline_namespace_conservative.rs
+++ b/tests/expectations/tests/inline_namespace_conservative.rs
@@ -19,7 +19,7 @@ pub mod root {
pub type Ty = ::std::os::raw::c_longlong;
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub baz: root::foo::bar::Ty,
}
@@ -46,9 +46,4 @@ pub mod root {
)
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs
index 0a49c3f2..3ea87edb 100644
--- a/tests/expectations/tests/inner_const.rs
+++ b/tests/expectations/tests/inner_const.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub bar: ::std::os::raw::c_int,
}
@@ -40,8 +40,3 @@ fn bindgen_test_layout_Foo() {
)
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs
index e5822659..bf39e065 100644
--- a/tests/expectations/tests/inner_template_self.rs
+++ b/tests/expectations/tests/inner_template_self.rs
@@ -16,7 +16,7 @@ impl Default for LinkedList {
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct InstantiateIt {
pub m_list: LinkedList,
}
@@ -43,11 +43,6 @@ fn bindgen_test_layout_InstantiateIt() {
)
);
}
-impl Clone for InstantiateIt {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for InstantiateIt {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/issue-1034.rs b/tests/expectations/tests/issue-1034.rs
index 9073d928..b0c4b529 100644
--- a/tests/expectations/tests/issue-1034.rs
+++ b/tests/expectations/tests/issue-1034.rs
@@ -5,7 +5,7 @@
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct S2 {
pub _bitfield_1: u16,
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout_S2() {
concat!("Alignment of ", stringify!(S2))
);
}
-impl Clone for S2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl S2 {
#[inline]
pub fn new_bitfield_1() -> u16 {
diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs
index c2516bda..84a33cb9 100644
--- a/tests/expectations/tests/issue-372.rs
+++ b/tests/expectations/tests/issue-372.rs
@@ -9,7 +9,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
- #[derive(Debug, Copy)]
+ #[derive(Debug, Copy, Clone)]
pub struct i {
pub j: *mut root::i,
pub k: *mut root::i,
@@ -43,18 +43,13 @@ pub mod root {
concat!("Alignment of field: ", stringify!(i), "::", stringify!(l))
);
}
- impl Clone for i {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for i {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
- #[derive(Debug, Copy)]
+ #[derive(Debug, Copy, Clone)]
pub struct d {
pub m: root::i,
}
@@ -76,11 +71,6 @@ pub mod root {
concat!("Alignment of field: ", stringify!(d), "::", stringify!(m))
);
}
- impl Clone for d {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for d {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/issue-410.rs b/tests/expectations/tests/issue-410.rs
index 938cd597..928701ef 100644
--- a/tests/expectations/tests/issue-410.rs
+++ b/tests/expectations/tests/issue-410.rs
@@ -12,7 +12,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Value {
pub _address: u8,
}
@@ -33,11 +33,6 @@ pub mod root {
#[link_name = "\u{1}_ZN2JS5Value1aE10JSWhyMagic"]
pub fn Value_a(this: *mut root::JS::Value, arg1: root::JSWhyMagic);
}
- impl Clone for Value {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Value {
#[inline]
pub unsafe fn a(&mut self, arg1: root::JSWhyMagic) {
diff --git a/tests/expectations/tests/issue-447.rs b/tests/expectations/tests/issue-447.rs
index 323da81e..11a99ad1 100644
--- a/tests/expectations/tests/issue-447.rs
+++ b/tests/expectations/tests/issue-447.rs
@@ -15,7 +15,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct GuardObjectNotifier {
pub _address: u8,
}
@@ -32,15 +32,10 @@ pub mod root {
concat!("Alignment of ", stringify!(GuardObjectNotifier))
);
}
- impl Clone for GuardObjectNotifier {
- fn clone(&self) -> Self {
- *self
- }
- }
}
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct JSAutoCompartment {
pub _address: u8,
}
@@ -64,11 +59,6 @@ pub mod root {
arg1: root::mozilla::detail::GuardObjectNotifier,
);
}
- impl Clone for JSAutoCompartment {
- fn clone(&self) -> Self {
- *self
- }
- }
impl JSAutoCompartment {
#[inline]
pub unsafe fn new(arg1: root::mozilla::detail::GuardObjectNotifier) -> Self {
diff --git a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
index d3814fba..b2ddf713 100644
--- a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
+++ b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs
@@ -24,7 +24,7 @@ impl Default for JS_Base {
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct JS_AutoIdVector {
pub _base: JS_Base,
}
@@ -41,11 +41,6 @@ fn bindgen_test_layout_JS_AutoIdVector() {
concat!("Alignment of ", stringify!(JS_AutoIdVector))
);
}
-impl Clone for JS_AutoIdVector {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for JS_AutoIdVector {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs
index fba41d1a..ba2ef976 100644
--- a/tests/expectations/tests/issue-573-layout-test-failures.rs
+++ b/tests/expectations/tests/issue-573-layout-test-failures.rs
@@ -10,7 +10,7 @@ pub struct Outer {
pub i: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct AutoIdVector {
pub ar: Outer,
}
@@ -37,11 +37,6 @@ fn bindgen_test_layout_AutoIdVector() {
)
);
}
-impl Clone for AutoIdVector {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn __bindgen_test_layout_Outer_open0_int_close0_instantiation() {
assert_eq!(
diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
index e0554090..69a59d5a 100644
--- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
+++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
@@ -10,7 +10,7 @@ pub struct a {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct _bindgen_ty_1 {
pub ar: a,
}
@@ -37,11 +37,6 @@ fn bindgen_test_layout__bindgen_ty_1() {
)
);
}
-impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}AutoIdVector"]
pub static mut AutoIdVector: _bindgen_ty_1;
diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
index 433c0bad..b6640998 100644
--- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
+++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
@@ -6,7 +6,7 @@
pub type RefPtr<T> = T;
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub _address: u8,
}
@@ -24,11 +24,6 @@ fn bindgen_test_layout_A() {
concat!("Alignment of ", stringify!(A))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
pub struct e<c> {
pub d: RefPtr<c>,
diff --git a/tests/expectations/tests/issue-639-typedef-anon-field.rs b/tests/expectations/tests/issue-639-typedef-anon-field.rs
index 2a48641f..91f76531 100644
--- a/tests/expectations/tests/issue-639-typedef-anon-field.rs
+++ b/tests/expectations/tests/issue-639-typedef-anon-field.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub bar: Foo_Bar,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo_Bar {
pub abc: ::std::os::raw::c_int,
}
@@ -37,11 +37,6 @@ fn bindgen_test_layout_Foo_Bar() {
)
);
}
-impl Clone for Foo_Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
@@ -65,18 +60,13 @@ fn bindgen_test_layout_Foo() {
)
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Baz {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Baz_Bar {
pub abc: ::std::os::raw::c_int,
}
@@ -103,11 +93,6 @@ fn bindgen_test_layout_Baz_Bar() {
)
);
}
-impl Clone for Baz_Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_Baz() {
assert_eq!(
@@ -121,8 +106,3 @@ fn bindgen_test_layout_Baz() {
concat!("Alignment of ", stringify!(Baz))
);
}
-impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/issue-643-inner-struct.rs b/tests/expectations/tests/issue-643-inner-struct.rs
index f0375cc8..ee5416e0 100644
--- a/tests/expectations/tests/issue-643-inner-struct.rs
+++ b/tests/expectations/tests/issue-643-inner-struct.rs
@@ -50,7 +50,7 @@ pub struct rte_ring {
pub ring: __IncompleteArrayField<*mut ::std::os::raw::c_void>,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct rte_ring_prod {
pub watermark: ::std::os::raw::c_uint,
}
@@ -77,13 +77,8 @@ fn bindgen_test_layout_rte_ring_prod() {
)
);
}
-impl Clone for rte_ring_prod {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct rte_ring_cons {
pub sc_dequeue: ::std::os::raw::c_uint,
}
@@ -110,11 +105,6 @@ fn bindgen_test_layout_rte_ring_cons() {
)
);
}
-impl Clone for rte_ring_cons {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_ring() {
assert_eq!(
@@ -134,12 +124,7 @@ impl Default for rte_ring {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct rte_memzone {
pub _address: u8,
}
-impl Clone for rte_memzone {
- fn clone(&self) -> Self {
- *self
- }
-}
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 11c318a2..a3d594e0 100644
--- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
+++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
@@ -10,7 +10,7 @@
/// up with the reight alignment, we're waiting on `#[repr(align="N")]` to land
/// in rustc).
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct NoDebug {
pub c: ::std::os::raw::c_char,
pub __bindgen_padding_0: [u8; 63usize],
@@ -33,11 +33,6 @@ fn bindgen_test_layout_NoDebug() {
)
);
}
-impl Clone for NoDebug {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for NoDebug {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -53,7 +48,7 @@ impl ::std::cmp::PartialEq for NoDebug {
/// 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)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct ShouldDeriveDebugButDoesNot {
pub c: [::std::os::raw::c_char; 32usize],
pub d: ::std::os::raw::c_char,
@@ -87,11 +82,6 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() {
)
);
}
-impl Clone for ShouldDeriveDebugButDoesNot {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ShouldDeriveDebugButDoesNot {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs
index ee71cc55..fc9ebc11 100644
--- a/tests/expectations/tests/issue-674-1.rs
+++ b/tests/expectations/tests/issue-674-1.rs
@@ -19,7 +19,7 @@ pub mod root {
pub type Maybe_ValueType<T> = T;
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct CapturingContentInfo {
pub a: u8,
}
@@ -46,9 +46,4 @@ pub mod root {
)
);
}
- impl Clone for CapturingContentInfo {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs
index 29990978..07c9cc4a 100644
--- a/tests/expectations/tests/issue-674-2.rs
+++ b/tests/expectations/tests/issue-674-2.rs
@@ -19,7 +19,7 @@ pub mod root {
pub type Rooted_ElementType<T> = T;
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct c {
pub b: u8,
}
@@ -41,13 +41,8 @@ pub mod root {
concat!("Alignment of field: ", stringify!(c), "::", stringify!(b))
);
}
- impl Clone for c {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct B {
pub a: root::c,
}
@@ -69,11 +64,6 @@ pub mod root {
concat!("Alignment of field: ", stringify!(B), "::", stringify!(a))
);
}
- impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct StaticRefPtr {
diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs
index f98720aa..1750cc0b 100644
--- a/tests/expectations/tests/issue-674-3.rs
+++ b/tests/expectations/tests/issue-674-3.rs
@@ -15,7 +15,7 @@ pub mod root {
}
pub type nsRefPtrHashtable_UserDataType<PtrType> = *mut PtrType;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct a {
pub b: u8,
}
@@ -37,13 +37,8 @@ pub mod root {
concat!("Alignment of field: ", stringify!(a), "::", stringify!(b))
);
}
- impl Clone for a {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct nsCSSValue {
pub c: root::a,
}
@@ -70,9 +65,4 @@ pub mod root {
)
);
}
- impl Clone for nsCSSValue {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/issue-691-template-parameter-virtual.rs b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
index aef7ed4a..4878c1fa 100644
--- a/tests/expectations/tests/issue-691-template-parameter-virtual.rs
+++ b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
@@ -7,7 +7,7 @@
#[repr(C)]
pub struct VirtualMethods__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct VirtualMethods {
pub vtable_: *const VirtualMethods__bindgen_vtable,
}
@@ -24,11 +24,6 @@ fn bindgen_test_layout_VirtualMethods() {
concat!("Alignment of ", stringify!(VirtualMethods))
);
}
-impl Clone for VirtualMethods {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for VirtualMethods {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -40,7 +35,7 @@ pub struct Set {
pub bar: ::std::os::raw::c_int,
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct ServoElementSnapshotTable {
pub _base: Set,
}
@@ -57,11 +52,6 @@ fn bindgen_test_layout_ServoElementSnapshotTable() {
concat!("Alignment of ", stringify!(ServoElementSnapshotTable))
);
}
-impl Clone for ServoElementSnapshotTable {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ServoElementSnapshotTable {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
index 30d59ab7..96963ba5 100644
--- a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
+++ b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _bitfield_1: [u64; 4usize],
pub __bindgen_align: [u64; 0usize],
@@ -23,8 +23,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
index 896a9a6c..3dde6e73 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct B {
pub _bindgen_opaque_blob: u8,
}
@@ -27,17 +27,12 @@ fn bindgen_test_layout_B() {
concat!("Alignment of ", stringify!(B))
);
}
-impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
#[link_name = "\u{1}_ZN1B1aE"]
pub static mut B_a: A;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct C {
pub b: B,
}
@@ -59,8 +54,3 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(b))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
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 63ec6982..0807873b 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Pupper {
pub _address: u8,
}
@@ -22,13 +22,8 @@ fn bindgen_test_layout_Pupper() {
concat!("Alignment of ", stringify!(Pupper))
);
}
-impl Clone for Pupper {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Doggo {
pub _address: u8,
}
@@ -45,13 +40,8 @@ fn bindgen_test_layout_Doggo() {
concat!("Alignment of ", stringify!(Doggo))
);
}
-impl Clone for Doggo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct SuchWow {
pub _address: u8,
}
@@ -68,13 +58,8 @@ fn bindgen_test_layout_SuchWow() {
concat!("Alignment of ", stringify!(SuchWow))
);
}
-impl Clone for SuchWow {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Opaque {
pub _bindgen_opaque_blob: u8,
}
@@ -99,11 +84,6 @@ extern "C" {
#[link_name = "\u{1}_ZN6OpaqueC1E6Pupper"]
pub fn Opaque_Opaque(this: *mut Opaque, pup: Pupper);
}
-impl Clone for Opaque {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Opaque {
#[inline]
pub unsafe fn eleven_out_of_ten(&mut self) -> SuchWow {
@@ -121,7 +101,7 @@ extern "C" {
pub static mut Opaque_MAJESTIC_AF: Doggo;
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Whitelisted {
pub some_member: Opaque,
}
@@ -148,8 +128,3 @@ fn bindgen_test_layout_Whitelisted() {
)
);
}
-impl Clone for Whitelisted {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs b/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs
index f84a7005..36cae722 100644
--- a/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs
+++ b/tests/expectations/tests/issue-826-generating-methods-when-asked-not-to.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/issue-834.rs b/tests/expectations/tests/issue-834.rs
index 35f0c13f..a8014fb9 100644
--- a/tests/expectations/tests/issue-834.rs
+++ b/tests/expectations/tests/issue-834.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct U {
pub _address: u8,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_U() {
concat!("Alignment of ", stringify!(U))
);
}
-impl Clone for U {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs
index 6d2b0c5e..61cbfc3a 100644
--- a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs
+++ b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs
@@ -12,7 +12,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Type {
pub _address: u8,
}
@@ -33,11 +33,6 @@ pub mod root {
concat!("Alignment of ", stringify!(Type))
);
}
- impl Clone for Type {
- fn clone(&self) -> Self {
- *self
- }
- }
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum a {}
diff --git a/tests/expectations/tests/issue_311.rs b/tests/expectations/tests/issue_311.rs
index a464442e..b8575378 100644
--- a/tests/expectations/tests/issue_311.rs
+++ b/tests/expectations/tests/issue_311.rs
@@ -9,12 +9,12 @@ pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct jsval_layout {
pub __bindgen_anon_1: root::jsval_layout__bindgen_ty_1,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct jsval_layout__bindgen_ty_1 {
pub _address: u8,
}
@@ -31,11 +31,6 @@ pub mod root {
concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_1))
);
}
- impl Clone for jsval_layout__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_jsval_layout() {
assert_eq!(
@@ -49,9 +44,4 @@ pub mod root {
concat!("Alignment of ", stringify!(jsval_layout))
);
}
- impl Clone for jsval_layout {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index c8e01a0c..a422ffc0 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -72,7 +72,7 @@ pub enum JSWhyMagic {
JS_WHY_MAGIC_COUNT = 18,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union jsval_layout {
pub asBits: u64,
pub debugView: jsval_layout__bindgen_ty_1,
@@ -84,7 +84,7 @@ pub union jsval_layout {
_bindgen_union_align: u64,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct jsval_layout__bindgen_ty_1 {
pub _bitfield_1: u64,
pub __bindgen_align: [u64; 0usize],
@@ -102,11 +102,6 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_1))
);
}
-impl Clone for jsval_layout__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for jsval_layout__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -192,12 +187,12 @@ impl jsval_layout__bindgen_ty_1 {
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct jsval_layout__bindgen_ty_2 {
pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union jsval_layout__bindgen_ty_2__bindgen_ty_1 {
pub i32: i32,
pub u32: u32,
@@ -259,11 +254,6 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() {
)
);
}
-impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -292,11 +282,6 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
)
);
}
-impl Clone for jsval_layout__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for jsval_layout__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -385,18 +370,13 @@ fn bindgen_test_layout_jsval_layout() {
)
);
}
-impl Clone for jsval_layout {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for jsval_layout {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct Value {
pub data: jsval_layout,
}
@@ -423,11 +403,6 @@ fn bindgen_test_layout_Value() {
)
);
}
-impl Clone for Value {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Value {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs
index 9d883e37..859416d7 100644
--- a/tests/expectations/tests/layout_align.rs
+++ b/tests/expectations/tests/layout_align.rs
@@ -75,7 +75,7 @@ impl Default for rte_kni_fifo {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct rte_eth_link {
/// < ETH_SPEED_NUM_
pub link_speed: u32,
@@ -106,11 +106,6 @@ fn bindgen_test_layout_rte_eth_link() {
)
);
}
-impl Clone for rte_eth_link {
- fn clone(&self) -> Self {
- *self
- }
-}
impl rte_eth_link {
#[inline]
pub fn link_duplex(&self) -> u16 {
diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs
index 4f9145b6..d49a870b 100644
--- a/tests/expectations/tests/layout_arp.rs
+++ b/tests/expectations/tests/layout_arp.rs
@@ -22,7 +22,7 @@ pub const ARP_OP_INVREPLY: ::std::os::raw::c_uint = 9;
/// administrator and does not contain OUIs.
/// See http://standards.ieee.org/regauth/groupmac/tutorial.html
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct ether_addr {
/// < Addr bytes in tx order
pub addr_bytes: [u8; 6usize],
@@ -50,14 +50,9 @@ fn bindgen_test_layout_ether_addr() {
)
);
}
-impl Clone for ether_addr {
- fn clone(&self) -> Self {
- *self
- }
-}
/// ARP header IPv4 payload.
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct arp_ipv4 {
/// < sender hardware address
pub arp_sha: ether_addr,
@@ -121,14 +116,9 @@ fn bindgen_test_layout_arp_ipv4() {
)
);
}
-impl Clone for arp_ipv4 {
- fn clone(&self) -> Self {
- *self
- }
-}
/// ARP header.
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct arp_hdr {
pub arp_hrd: u16,
pub arp_pro: u16,
@@ -210,8 +200,3 @@ fn bindgen_test_layout_arp_hdr() {
)
);
}
-impl Clone for arp_hdr {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index c1a15187..7dcd507a 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -49,7 +49,7 @@ pub type rte_mempool_get_count = ::std::option::Option<
>;
/// Structure defining mempool operations structure
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_mempool_ops {
/// < Name of mempool ops struct.
pub name: [::std::os::raw::c_char; 32usize],
@@ -133,11 +133,6 @@ fn bindgen_test_layout_rte_mempool_ops() {
)
);
}
-impl Clone for rte_mempool_ops {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mempool_ops {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -152,7 +147,7 @@ impl ::std::cmp::PartialEq for rte_mempool_ops {
}
/// The rte_spinlock_t type.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_spinlock_t {
/// < lock status 0 = unlocked, 1 = locked
pub locked: ::std::os::raw::c_int,
@@ -180,11 +175,6 @@ fn bindgen_test_layout_rte_spinlock_t() {
)
);
}
-impl Clone for rte_spinlock_t {
- fn clone(&self) -> Self {
- *self
- }
-}
/// Structure storing the table of registered ops structs, each of which contain
/// the function pointers for the mempool ops functions.
/// Each process has its own storage for this ops struct array so that
@@ -193,7 +183,7 @@ impl Clone for rte_spinlock_t {
/// any function pointers stored directly in the mempool struct would not be.
/// This results in us simply having "ops_index" in the mempool struct.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_mempool_ops_table {
/// < Spinlock for add/delete.
pub sl: rte_spinlock_t,
@@ -241,11 +231,6 @@ fn bindgen_test_layout_rte_mempool_ops_table() {
)
);
}
-impl Clone for rte_mempool_ops_table {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mempool_ops_table {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -253,7 +238,7 @@ impl Default for rte_mempool_ops_table {
}
/// Structure to hold malloc heap
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct malloc_heap {
pub lock: rte_spinlock_t,
pub free_head: [malloc_heap__bindgen_ty_1; 13usize],
@@ -261,7 +246,7 @@ pub struct malloc_heap {
pub total_size: usize,
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct malloc_heap__bindgen_ty_1 {
pub lh_first: *mut malloc_elem,
}
@@ -288,11 +273,6 @@ fn bindgen_test_layout_malloc_heap__bindgen_ty_1() {
)
);
}
-impl Clone for malloc_heap__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for malloc_heap__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -346,11 +326,6 @@ fn bindgen_test_layout_malloc_heap() {
)
);
}
-impl Clone for malloc_heap {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for malloc_heap {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -363,12 +338,7 @@ impl ::std::cmp::PartialEq for malloc_heap {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct malloc_elem {
pub _address: u8,
}
-impl Clone for malloc_elem {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs
index 53c6d8c3..6c8ec850 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ip_frag {
/// < offset into the packet
pub ofs: u16,
@@ -72,11 +72,6 @@ fn bindgen_test_layout_ip_frag() {
)
);
}
-impl Clone for ip_frag {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -84,7 +79,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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ip_frag_key {
/// < src address, first 8 bytes used for IPv4
pub src_dst: [u64; 4usize],
@@ -136,15 +131,10 @@ fn bindgen_test_layout_ip_frag_key() {
)
);
}
-impl Clone for ip_frag_key {
- fn clone(&self) -> Self {
- *self
- }
-}
/// @internal Fragmented packet to reassemble.
/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct ip_frag_pkt {
/// < LRU list
pub lru: ip_frag_pkt__bindgen_ty_1,
@@ -163,7 +153,7 @@ pub struct ip_frag_pkt {
pub __bindgen_padding_0: [u64; 6usize],
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, 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,
@@ -201,11 +191,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() {
)
);
}
-impl Clone for ip_frag_pkt__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag_pkt__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -289,11 +274,6 @@ fn bindgen_test_layout_ip_frag_pkt() {
)
);
}
-impl Clone for ip_frag_pkt {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag_pkt {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -308,12 +288,7 @@ impl ::std::cmp::PartialEq for ip_frag_pkt {
}
/// < fragment mbuf
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf {
pub _address: u8,
}
-impl Clone for rte_mbuf {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs
index be841432..ca4147f0 100644
--- a/tests/expectations/tests/layout_cmdline_token.rs
+++ b/tests/expectations/tests/layout_cmdline_token.rs
@@ -8,7 +8,7 @@
/// Stores a pointer to the ops struct, and the offset: the place to
/// write the parsed result in the destination structure.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct cmdline_token_hdr {
pub ops: *mut cmdline_token_ops,
pub offset: ::std::os::raw::c_uint,
@@ -46,11 +46,6 @@ fn bindgen_test_layout_cmdline_token_hdr() {
)
);
}
-impl Clone for cmdline_token_hdr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for cmdline_token_hdr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -75,7 +70,7 @@ pub type cmdline_parse_token_hdr_t = cmdline_token_hdr;
/// get_help() fills the dstbuf with the help for the token. It returns
/// -1 on error and 0 on success.
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct cmdline_token_ops {
/// parse(token ptr, buf, res pts, buf len)
pub parse: ::std::option::Option<
@@ -162,11 +157,6 @@ fn bindgen_test_layout_cmdline_token_ops() {
)
);
}
-impl Clone for cmdline_token_ops {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for cmdline_token_ops {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -185,7 +175,7 @@ pub enum cmdline_numtype {
INT64 = 7,
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct cmdline_token_num_data {
pub type_: cmdline_numtype,
}
@@ -212,18 +202,13 @@ fn bindgen_test_layout_cmdline_token_num_data() {
)
);
}
-impl Clone for cmdline_token_num_data {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for cmdline_token_num_data {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct cmdline_token_num {
pub hdr: cmdline_token_hdr,
pub num_data: cmdline_token_num_data,
@@ -261,11 +246,6 @@ fn bindgen_test_layout_cmdline_token_num() {
)
);
}
-impl Clone for cmdline_token_num {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for cmdline_token_num {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index 5e17ec2a..d5f1f1a5 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, Eq)]
+#[derive(Debug, Copy, Clone, 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,
@@ -105,11 +105,6 @@ fn bindgen_test_layout_rte_eth_rxmode() {
)
);
}
-impl Clone for rte_eth_rxmode {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_rxmode {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -475,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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_txmode {
/// < TX multi-queues mode.
pub mq_mode: rte_eth_tx_mq_mode,
@@ -516,11 +511,6 @@ fn bindgen_test_layout_rte_eth_txmode() {
)
);
}
-impl Clone for rte_eth_txmode {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_txmode {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -662,7 +652,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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_rss_conf {
/// < If not NULL, 40-byte hash key.
pub rss_key: *mut u8,
@@ -714,11 +704,6 @@ fn bindgen_test_layout_rte_eth_rss_conf() {
)
);
}
-impl Clone for rte_eth_rss_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_rss_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -752,7 +737,7 @@ pub enum rte_eth_nb_pools {
/// A default pool may be used, if desired, to route all traffic which
/// does not match the vlan filter rules.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_eth_vmdq_dcb_conf {
/// < With DCB, 16 or 32 pools
pub nb_queue_pools: rte_eth_nb_pools,
@@ -767,7 +752,7 @@ pub struct rte_eth_vmdq_dcb_conf {
pub dcb_tc: [u8; 8usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -812,11 +797,6 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() {
)
);
}
-impl Clone for rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() {
assert_eq!(
@@ -890,18 +870,13 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() {
)
);
}
-impl Clone for rte_eth_vmdq_dcb_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_vmdq_dcb_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_dcb_rx_conf {
/// < Possible DCB TCs, 4 or 8 TCs
pub nb_tcs: rte_eth_nb_tcs,
@@ -941,18 +916,13 @@ fn bindgen_test_layout_rte_eth_dcb_rx_conf() {
)
);
}
-impl Clone for rte_eth_dcb_rx_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_dcb_rx_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, 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,
@@ -992,18 +962,13 @@ fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() {
)
);
}
-impl Clone for rte_eth_vmdq_dcb_tx_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_vmdq_dcb_tx_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_dcb_tx_conf {
/// < Possible DCB TCs, 4 or 8 TCs.
pub nb_tcs: rte_eth_nb_tcs,
@@ -1043,18 +1008,13 @@ fn bindgen_test_layout_rte_eth_dcb_tx_conf() {
)
);
}
-impl Clone for rte_eth_dcb_tx_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_dcb_tx_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_vmdq_tx_conf {
/// < VMDq mode, 64 pools.
pub nb_queue_pools: rte_eth_nb_pools,
@@ -1082,18 +1042,13 @@ fn bindgen_test_layout_rte_eth_vmdq_tx_conf() {
)
);
}
-impl Clone for rte_eth_vmdq_tx_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_vmdq_tx_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_eth_vmdq_rx_conf {
/// < VMDq only mode, 8 or 64 pools
pub nb_queue_pools: rte_eth_nb_pools,
@@ -1111,7 +1066,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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 {
/// < The vlan id of the received frame
pub vlan_id: u16,
@@ -1156,11 +1111,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() {
)
);
}
-impl Clone for rte_eth_vmdq_rx_conf__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_eth_vmdq_rx_conf() {
assert_eq!(
@@ -1244,11 +1194,6 @@ fn bindgen_test_layout_rte_eth_vmdq_rx_conf() {
)
);
}
-impl Clone for rte_eth_vmdq_rx_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_vmdq_rx_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -1283,7 +1228,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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_ipv4_flow {
/// < IPv4 source address in big endian.
pub src_ip: u32,
@@ -1359,14 +1304,9 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() {
)
);
}
-impl Clone for rte_eth_ipv4_flow {
- fn clone(&self) -> Self {
- *self
- }
-}
/// A structure used to define the input for IPV6 flow
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_ipv6_flow {
/// < IPv6 source address in big endian.
pub src_ip: [u32; 4usize],
@@ -1442,15 +1382,10 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() {
)
);
}
-impl Clone for rte_eth_ipv6_flow {
- fn clone(&self) -> Self {
- *self
- }
-}
/// 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_fdir_masks {
/// < Bit mask for vlan_tci in big endian
pub vlan_tci_mask: u16,
@@ -1564,11 +1499,6 @@ fn bindgen_test_layout_rte_eth_fdir_masks() {
)
);
}
-impl Clone for rte_eth_fdir_masks {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(u32)]
/// Payload type
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -1583,7 +1513,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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_flex_payload_cfg {
/// < Payload type
pub type_: rte_eth_payload_type,
@@ -1622,11 +1552,6 @@ fn bindgen_test_layout_rte_eth_flex_payload_cfg() {
)
);
}
-impl Clone for rte_eth_flex_payload_cfg {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_flex_payload_cfg {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -1635,7 +1560,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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_fdir_flex_mask {
pub flow_type: u16,
pub mask: [u8; 16usize],
@@ -1673,15 +1598,10 @@ fn bindgen_test_layout_rte_eth_fdir_flex_mask() {
)
);
}
-impl Clone for rte_eth_fdir_flex_mask {
- fn clone(&self) -> Self {
- *self
- }
-}
/// A structure used to define all flexible payload related setting
/// include flex payload and flex mask
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_eth_fdir_flex_conf {
/// < The number of following payload cfg
pub nb_payloads: u16,
@@ -1743,11 +1663,6 @@ fn bindgen_test_layout_rte_eth_fdir_flex_conf() {
)
);
}
-impl Clone for rte_eth_fdir_flex_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_fdir_flex_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -1758,7 +1673,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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_fdir_conf {
/// < Flow Director mode.
pub mode: rte_fdir_mode,
@@ -1844,11 +1759,6 @@ fn bindgen_test_layout_rte_fdir_conf() {
)
);
}
-impl Clone for rte_fdir_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_fdir_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -1856,7 +1766,7 @@ impl Default for rte_fdir_conf {
}
/// A structure used to enable/disable specific device interrupts.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_intr_conf {
/// enable/disable lsc interrupt. 0 (default) - disable, 1 enable
pub lsc: u16,
@@ -1896,16 +1806,11 @@ fn bindgen_test_layout_rte_intr_conf() {
)
);
}
-impl Clone for rte_intr_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
/// A structure used to configure an Ethernet port.
/// Depending upon the RX multi-queue mode, extra advanced
/// configuration settings may be needed.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_eth_conf {
/// < bitmap of ETH_LINK_SPEED_XXX of speeds to be
/// used. ETH_LINK_SPEED_FIXED disables link
@@ -1938,7 +1843,7 @@ pub struct rte_eth_conf {
pub intr_conf: rte_intr_conf,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_eth_conf__bindgen_ty_1 {
/// < Port RSS configuration
pub rss_conf: rte_eth_rss_conf,
@@ -1999,18 +1904,13 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() {
)
);
}
-impl Clone for rte_eth_conf__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_conf__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_eth_conf__bindgen_ty_2 {
pub vmdq_dcb_tx_conf: rte_eth_vmdq_dcb_tx_conf,
pub dcb_tx_conf: rte_eth_dcb_tx_conf,
@@ -2062,11 +1962,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() {
)
);
}
-impl Clone for rte_eth_conf__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_conf__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -2175,11 +2070,6 @@ fn bindgen_test_layout_rte_eth_conf() {
)
);
}
-impl Clone for rte_eth_conf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_eth_conf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs
index facc85b2..e848c52e 100644
--- a/tests/expectations/tests/layout_kni_mbuf.rs
+++ b/tests/expectations/tests/layout_kni_mbuf.rs
@@ -7,7 +7,7 @@
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;
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct rte_kni_mbuf {
pub buf_addr: *mut ::std::os::raw::c_void,
pub buf_physaddr: u64,
@@ -179,11 +179,6 @@ fn bindgen_test_layout_rte_kni_mbuf() {
)
);
}
-impl Clone for rte_kni_mbuf {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_kni_mbuf {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs
index 7c8ab865..24034d92 100644
--- a/tests/expectations/tests/layout_large_align_field.rs
+++ b/tests/expectations/tests/layout_large_align_field.rs
@@ -57,7 +57,7 @@ pub enum _bindgen_ty_1 {
}
/// @internal fragmented mbuf
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct ip_frag {
/// < offset into the packet
pub ofs: u16,
@@ -109,11 +109,6 @@ fn bindgen_test_layout_ip_frag() {
)
);
}
-impl Clone for ip_frag {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -121,7 +116,7 @@ impl Default for ip_frag {
}
/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram.
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct ip_frag_key {
/// < src address, first 8 bytes used for IPv4
pub src_dst: [u64; 4usize],
@@ -173,15 +168,10 @@ fn bindgen_test_layout_ip_frag_key() {
)
);
}
-impl Clone for ip_frag_key {
- fn clone(&self) -> Self {
- *self
- }
-}
/// @internal Fragmented packet to reassemble.
/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct ip_frag_pkt {
/// < LRU list
pub lru: ip_frag_pkt__bindgen_ty_1,
@@ -200,7 +190,7 @@ pub struct ip_frag_pkt {
pub __bindgen_padding_0: [u64; 6usize],
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct ip_frag_pkt__bindgen_ty_1 {
pub tqe_next: *mut ip_frag_pkt,
pub tqe_prev: *mut *mut ip_frag_pkt,
@@ -238,11 +228,6 @@ fn bindgen_test_layout_ip_frag_pkt__bindgen_ty_1() {
)
);
}
-impl Clone for ip_frag_pkt__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag_pkt__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -326,18 +311,13 @@ fn bindgen_test_layout_ip_frag_pkt() {
)
);
}
-impl Clone for ip_frag_pkt {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag_pkt {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct ip_pkt_list {
pub tqh_first: *mut ip_frag_pkt,
pub tqh_last: *mut *mut ip_frag_pkt,
@@ -375,11 +355,6 @@ fn bindgen_test_layout_ip_pkt_list() {
)
);
}
-impl Clone for ip_pkt_list {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_pkt_list {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -387,7 +362,7 @@ impl Default for ip_pkt_list {
}
/// fragmentation table statistics
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct ip_frag_tbl_stat {
/// < total # of find/insert attempts.
pub find_num: u64,
@@ -471,11 +446,6 @@ fn bindgen_test_layout_ip_frag_tbl_stat() {
)
);
}
-impl Clone for ip_frag_tbl_stat {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ip_frag_tbl_stat {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -633,12 +603,7 @@ impl Default for rte_ip_frag_tbl {
}
/// < fragment mbuf
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct rte_mbuf {
pub _address: u8,
}
-impl Clone for rte_mbuf {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index 90a367c6..1db17172 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_atomic16_t {
/// < An internal counter value.
pub cnt: i16,
@@ -40,11 +40,6 @@ fn bindgen_test_layout_rte_atomic16_t() {
)
);
}
-impl Clone for rte_atomic16_t {
- fn clone(&self) -> Self {
- *self
- }
-}
/// The generic rte_mbuf, containing a packet mbuf.
#[repr(C)]
pub struct rte_mbuf {
@@ -99,7 +94,7 @@ pub struct rte_mbuf {
/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
/// config option.
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_1 {
/// < Atomically accessed refcnt
pub refcnt_atomic: rte_atomic16_t,
@@ -140,18 +135,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_2 {
/// < L2/L3/L4 and tunnel information.
pub packet_type: u32,
@@ -159,7 +149,7 @@ pub union rte_mbuf__bindgen_ty_2 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_1: [u8; 4usize],
pub __bindgen_align: [u32; 0usize],
@@ -183,11 +173,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2__bindgen_ty_1() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
#[inline]
pub fn l2_type(&self) -> u32 {
@@ -483,18 +468,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_3 {
/// < RSS hash result if RSS enabled
pub rss: u32,
@@ -507,20 +487,20 @@ pub union rte_mbuf__bindgen_ty_3 {
_bindgen_union_align: [u32; 2usize],
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
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(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1,
pub lo: u32,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, 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,11 +550,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindg
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(
@@ -607,11 +582,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -646,18 +616,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
pub lo: u32,
pub hi: u32,
@@ -701,11 +666,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() {
assert_eq!(
@@ -759,18 +719,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_3 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_3 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_4 {
/// < Can be used for external metadata
pub userdata: *mut ::std::os::raw::c_void,
@@ -811,18 +766,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_4 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_4 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_5 {
/// < combined for easy fetch
pub tx_offload: u64,
@@ -830,7 +780,7 @@ pub union rte_mbuf__bindgen_ty_5 {
_bindgen_union_align: u64,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
pub _bitfield_1: [u16; 4usize],
pub __bindgen_align: [u64; 0usize],
@@ -854,11 +804,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5__bindgen_ty_1() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
#[inline]
pub fn l2_len(&self) -> u64 {
@@ -1116,11 +1061,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() {
)
);
}
-impl Clone for rte_mbuf__bindgen_ty_5 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for rte_mbuf__bindgen_ty_5 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -1351,12 +1291,7 @@ impl Default for rte_mbuf {
}
/// < Pool from which mbuf was allocated.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mempool {
pub _address: u8,
}
-impl Clone for rte_mempool {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/libclang-3.8/auto.rs b/tests/expectations/tests/libclang-3.8/auto.rs
index b86a5c9e..8db72d0f 100644
--- a/tests/expectations/tests/libclang-3.8/auto.rs
+++ b/tests/expectations/tests/libclang-3.8/auto.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -26,11 +26,6 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
diff --git a/tests/expectations/tests/libclang-3.8/call-conv-field.rs b/tests/expectations/tests/libclang-3.8/call-conv-field.rs
index 6bbffa1a..b7d51283 100644
--- a/tests/expectations/tests/libclang-3.8/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-3.8/call-conv-field.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct JNINativeInterface_ {
pub GetVersion: ::std::option::Option<
unsafe extern "stdcall" fn(env: *mut ::std::os::raw::c_void)
@@ -46,11 +46,6 @@ fn bindgen_test_layout_JNINativeInterface_() {
)
);
}
-impl Clone for JNINativeInterface_ {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for JNINativeInterface_ {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/libclang-3.8/const_bool.rs b/tests/expectations/tests/libclang-3.8/const_bool.rs
index 1f5fcf63..35636842 100644
--- a/tests/expectations/tests/libclang-3.8/const_bool.rs
+++ b/tests/expectations/tests/libclang-3.8/const_bool.rs
@@ -9,7 +9,7 @@ extern "C" {
pub static mut k: bool;
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub _address: u8,
}
@@ -30,11 +30,6 @@ fn bindgen_test_layout_A() {
concat!("Alignment of ", stringify!(A))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
pub type foo = bool;
extern "C" {
#[link_name = "\u{1}_ZL2k2"]
diff --git a/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs
index 960b5522..797d5f45 100644
--- a/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs
+++ b/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs
@@ -15,7 +15,7 @@ pub struct Derived {
pub b: bool,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Usage {
pub _address: u8,
}
@@ -40,11 +40,6 @@ extern "C" {
#[link_name = "\u{1}_ZN5UsageC1Ev"]
pub fn Usage_Usage(this: *mut Usage);
}
-impl Clone for Usage {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Usage {
#[inline]
pub unsafe fn new() -> Self {
diff --git a/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs
index 590f491a..7b13bb7c 100644
--- a/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-3.8/type_alias_template_specialized.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Rooted {
pub ptr: ::std::os::raw::c_int,
}
@@ -32,10 +32,5 @@ fn bindgen_test_layout_Rooted() {
)
);
}
-impl Clone for Rooted {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen replaces="MaybeWrapped"></div>
pub type MaybeWrapped<a> = a;
diff --git a/tests/expectations/tests/libclang-3.9/auto.rs b/tests/expectations/tests/libclang-3.9/auto.rs
index 50acff2e..2d7dfa3a 100644
--- a/tests/expectations/tests/libclang-3.9/auto.rs
+++ b/tests/expectations/tests/libclang-3.9/auto.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -23,11 +23,6 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
diff --git a/tests/expectations/tests/libclang-3.9/call-conv-field.rs b/tests/expectations/tests/libclang-3.9/call-conv-field.rs
index 8896946e..a3c6fe62 100644
--- a/tests/expectations/tests/libclang-3.9/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-3.9/call-conv-field.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct JNINativeInterface_ {
pub GetVersion: ::std::option::Option<
unsafe extern "stdcall" fn(env: *mut ::std::os::raw::c_void)
@@ -46,11 +46,6 @@ fn bindgen_test_layout_JNINativeInterface_() {
)
);
}
-impl Clone for JNINativeInterface_ {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for JNINativeInterface_ {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/libclang-3.9/const_bool.rs b/tests/expectations/tests/libclang-3.9/const_bool.rs
index 7106e0ab..14f51394 100644
--- a/tests/expectations/tests/libclang-3.9/const_bool.rs
+++ b/tests/expectations/tests/libclang-3.9/const_bool.rs
@@ -6,7 +6,7 @@
pub const k: bool = true;
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub _address: u8,
}
@@ -24,10 +24,5 @@ fn bindgen_test_layout_A() {
concat!("Alignment of ", stringify!(A))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
pub type foo = bool;
pub const k2: foo = true;
diff --git a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs
index 416711ad..97d2eabe 100644
--- a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs
+++ b/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs
@@ -15,7 +15,7 @@ pub struct Derived {
pub b: bool,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Usage {
pub _address: u8,
}
@@ -36,8 +36,3 @@ fn bindgen_test_layout_Usage() {
concat!("Alignment of ", stringify!(Usage))
);
}
-impl Clone for Usage {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs
index 590f491a..7b13bb7c 100644
--- a/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-3.9/type_alias_template_specialized.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Rooted {
pub ptr: ::std::os::raw::c_int,
}
@@ -32,10 +32,5 @@ fn bindgen_test_layout_Rooted() {
)
);
}
-impl Clone for Rooted {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen replaces="MaybeWrapped"></div>
pub type MaybeWrapped<a> = a;
diff --git a/tests/expectations/tests/libclang-4/auto.rs b/tests/expectations/tests/libclang-4/auto.rs
index 1575d051..2d7dfa3a 100644
--- a/tests/expectations/tests/libclang-4/auto.rs
+++ b/tests/expectations/tests/libclang-4/auto.rs
@@ -5,20 +5,23 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
pub const Foo_kFoo: bool = true;
#[test]
fn bindgen_test_layout_Foo() {
- assert_eq!(::std::mem::size_of::<Foo>() , 1usize , concat ! (
- "Size of: " , stringify ! ( Foo ) ));
- assert_eq! (::std::mem::align_of::<Foo>() , 1usize , concat ! (
- "Alignment of " , stringify ! ( Foo ) ));
-}
-impl Clone for Foo {
- fn clone(&self) -> Self { *self }
+ assert_eq!(
+ ::std::mem::size_of::<Foo>(),
+ 1usize,
+ concat!("Size of: ", stringify!(Foo))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<Foo>(),
+ 1usize,
+ concat!("Alignment of ", stringify!(Foo))
+ );
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
diff --git a/tests/expectations/tests/libclang-4/call-conv-field.rs b/tests/expectations/tests/libclang-4/call-conv-field.rs
index 648560cf..a3c6fe62 100644
--- a/tests/expectations/tests/libclang-4/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-4/call-conv-field.rs
@@ -5,36 +5,51 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct JNINativeInterface_ {
- pub GetVersion: ::std::option::Option<unsafe extern "stdcall" fn(env:
- *mut ::std::os::raw::c_void)
- -> ::std::os::raw::c_int>,
+ pub GetVersion: ::std::option::Option<
+ unsafe extern "stdcall" fn(env: *mut ::std::os::raw::c_void)
+ -> ::std::os::raw::c_int,
+ >,
pub __hack: ::std::os::raw::c_ulonglong,
}
#[test]
fn bindgen_test_layout_JNINativeInterface_() {
- assert_eq!(::std::mem::size_of::<JNINativeInterface_>() , 16usize , concat
- ! ( "Size of: " , stringify ! ( JNINativeInterface_ ) ));
- assert_eq! (::std::mem::align_of::<JNINativeInterface_>() , 8usize ,
- concat ! (
- "Alignment of " , stringify ! ( JNINativeInterface_ ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const JNINativeInterface_ ) ) . GetVersion as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( JNINativeInterface_ ) ,
- "::" , stringify ! ( GetVersion ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const JNINativeInterface_ ) ) . __hack as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( JNINativeInterface_ ) ,
- "::" , stringify ! ( __hack ) ));
-}
-impl Clone for JNINativeInterface_ {
- fn clone(&self) -> Self { *self }
+ assert_eq!(
+ ::std::mem::size_of::<JNINativeInterface_>(),
+ 16usize,
+ concat!("Size of: ", stringify!(JNINativeInterface_))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<JNINativeInterface_>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(JNINativeInterface_))
+ );
+ assert_eq!(
+ unsafe { &(*(0 as *const JNINativeInterface_)).GetVersion as *const _ as usize },
+ 0usize,
+ concat!(
+ "Alignment of field: ",
+ stringify!(JNINativeInterface_),
+ "::",
+ stringify!(GetVersion)
+ )
+ );
+ assert_eq!(
+ unsafe { &(*(0 as *const JNINativeInterface_)).__hack as *const _ as usize },
+ 8usize,
+ concat!(
+ "Alignment of field: ",
+ stringify!(JNINativeInterface_),
+ "::",
+ stringify!(__hack)
+ )
+ );
}
impl Default for JNINativeInterface_ {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+ fn default() -> Self {
+ unsafe { ::std::mem::zeroed() }
+ }
}
extern "stdcall" {
#[link_name = "\u{1}_bar@0"]
diff --git a/tests/expectations/tests/libclang-4/const_bool.rs b/tests/expectations/tests/libclang-4/const_bool.rs
index fd0273aa..14f51394 100644
--- a/tests/expectations/tests/libclang-4/const_bool.rs
+++ b/tests/expectations/tests/libclang-4/const_bool.rs
@@ -6,20 +6,23 @@
pub const k: bool = true;
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub _address: u8,
}
pub const A_k: bool = false;
#[test]
fn bindgen_test_layout_A() {
- assert_eq!(::std::mem::size_of::<A>() , 1usize , concat ! (
- "Size of: " , stringify ! ( A ) ));
- assert_eq! (::std::mem::align_of::<A>() , 1usize , concat ! (
- "Alignment of " , stringify ! ( A ) ));
-}
-impl Clone for A {
- fn clone(&self) -> Self { *self }
+ assert_eq!(
+ ::std::mem::size_of::<A>(),
+ 1usize,
+ concat!("Size of: ", stringify!(A))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<A>(),
+ 1usize,
+ concat!("Alignment of ", stringify!(A))
+ );
}
pub type foo = bool;
pub const k2: foo = true;
diff --git a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs
index 1cb28c14..97d2eabe 100644
--- a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs
+++ b/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs
@@ -15,7 +15,7 @@ pub struct Derived {
pub b: bool,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Usage {
pub _address: u8,
}
@@ -25,11 +25,14 @@ extern "C" {
}
#[test]
fn bindgen_test_layout_Usage() {
- assert_eq!(::std::mem::size_of::<Usage>() , 1usize , concat ! (
- "Size of: " , stringify ! ( Usage ) ));
- assert_eq! (::std::mem::align_of::<Usage>() , 1usize , concat ! (
- "Alignment of " , stringify ! ( Usage ) ));
-}
-impl Clone for Usage {
- fn clone(&self) -> Self { *self }
+ assert_eq!(
+ ::std::mem::size_of::<Usage>(),
+ 1usize,
+ concat!("Size of: ", stringify!(Usage))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<Usage>(),
+ 1usize,
+ concat!("Alignment of ", stringify!(Usage))
+ );
}
diff --git a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs
index b8d4fbec..e0b8616d 100644
--- a/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-4/type_alias_template_specialized.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Rooted {
pub ptr: MaybeWrapped<::std::os::raw::c_int>,
}
@@ -32,11 +32,6 @@ fn bindgen_test_layout_Rooted() {
)
);
}
-impl Clone for Rooted {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Rooted {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -51,8 +46,15 @@ fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() {
4usize,
concat!(
"Size of template specialization: ",
- stringify ! ( MaybeWrapped < :: std :: os :: raw :: c_int > )
+ stringify!(MaybeWrapped<::std::os::raw::c_int>)
+ )
+ );
+ assert_eq!(
+ ::std::mem::align_of::<MaybeWrapped<::std::os::raw::c_int>>(),
+ 4usize,
+ concat!(
+ "Alignment of template specialization: ",
+ stringify!(MaybeWrapped<::std::os::raw::c_int>)
)
);
- assert_eq ! ( :: std :: mem :: align_of :: < MaybeWrapped < :: std :: os :: raw :: c_int > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( MaybeWrapped < :: std :: os :: raw :: c_int > ) ) );
}
diff --git a/tests/expectations/tests/mangling-linux32.rs b/tests/expectations/tests/mangling-linux32.rs
index e237eeef..7fe8f33a 100644
--- a/tests/expectations/tests/mangling-linux32.rs
+++ b/tests/expectations/tests/mangling-linux32.rs
@@ -8,7 +8,7 @@ extern "C" {
pub fn foo();
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -29,8 +29,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/mangling-linux64.rs b/tests/expectations/tests/mangling-linux64.rs
index e237eeef..7fe8f33a 100644
--- a/tests/expectations/tests/mangling-linux64.rs
+++ b/tests/expectations/tests/mangling-linux64.rs
@@ -8,7 +8,7 @@ extern "C" {
pub fn foo();
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -29,8 +29,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/mangling-macos.rs b/tests/expectations/tests/mangling-macos.rs
index 39a020ad..7835dd92 100644
--- a/tests/expectations/tests/mangling-macos.rs
+++ b/tests/expectations/tests/mangling-macos.rs
@@ -9,7 +9,7 @@ extern "C" {
pub fn foo();
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -30,8 +30,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/mangling-win32.rs b/tests/expectations/tests/mangling-win32.rs
index e21228a1..2d2d7fcd 100644
--- a/tests/expectations/tests/mangling-win32.rs
+++ b/tests/expectations/tests/mangling-win32.rs
@@ -9,7 +9,7 @@ extern "C" {
pub fn foo();
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -30,8 +30,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/mangling-win64.rs b/tests/expectations/tests/mangling-win64.rs
index 747ccbf5..0d9c49fa 100644
--- a/tests/expectations/tests/mangling-win64.rs
+++ b/tests/expectations/tests/mangling-win64.rs
@@ -8,7 +8,7 @@ extern "C" {
pub fn foo();
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -29,8 +29,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/method-mangling.rs b/tests/expectations/tests/method-mangling.rs
index eada760b..f2eb6f98 100644
--- a/tests/expectations/tests/method-mangling.rs
+++ b/tests/expectations/tests/method-mangling.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -26,11 +26,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3Foo4typeEv"]
pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int;
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Foo {
#[inline]
pub unsafe fn type_(&mut self) -> ::std::os::raw::c_int {
diff --git a/tests/expectations/tests/module-whitelisted.rs b/tests/expectations/tests/module-whitelisted.rs
index 0e1d5641..3f2d304e 100644
--- a/tests/expectations/tests/module-whitelisted.rs
+++ b/tests/expectations/tests/module-whitelisted.rs
@@ -9,7 +9,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Test {
pub _address: u8,
}
@@ -26,9 +26,4 @@ pub mod root {
concat!("Alignment of ", stringify!(Test))
);
}
- impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs
index 848c656f..dfa37824 100644
--- a/tests/expectations/tests/msvc-no-usr.rs
+++ b/tests/expectations/tests/msvc-no-usr.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub foo: usize,
}
@@ -27,8 +27,3 @@ fn bindgen_test_layout_A() {
concat!("Alignment of field: ", stringify!(A), "::", stringify!(foo))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs
index 2af91b4c..86147bdd 100644
--- a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs
+++ b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -22,13 +22,8 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of ", stringify!(Foo))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
@@ -45,13 +40,8 @@ fn bindgen_test_layout_Bar() {
concat!("Alignment of ", stringify!(Bar))
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Baz {
pub _address: u8,
}
@@ -68,8 +58,3 @@ fn bindgen_test_layout_Baz() {
concat!("Alignment of ", stringify!(Baz))
);
}
-impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs
index f7f580b2..7e841f7b 100644
--- a/tests/expectations/tests/mutable.rs
+++ b/tests/expectations/tests/mutable.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct C {
pub m_member: ::std::os::raw::c_int,
pub m_other: ::std::os::raw::c_int,
@@ -43,11 +43,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Default)]
pub struct NonCopiable {
diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs
index e6077152..13a9df0e 100644
--- a/tests/expectations/tests/namespace.rs
+++ b/tests/expectations/tests/namespace.rs
@@ -29,7 +29,7 @@ pub mod root {
pub fn foo();
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub b: root::whatever::whatever_int_t,
}
@@ -57,11 +57,6 @@ pub mod root {
this: *mut root::_bindgen_mod_id_13::A,
) -> ::std::os::raw::c_int;
}
- impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
- }
impl A {
#[inline]
pub unsafe fn lets_hope_this_works(&mut self) -> ::std::os::raw::c_int {
diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs
index a8c7775c..336723bb 100644
--- a/tests/expectations/tests/nested.rs
+++ b/tests/expectations/tests/nested.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Calc {
pub w: ::std::os::raw::c_int,
}
@@ -32,24 +32,19 @@ fn bindgen_test_layout_Calc() {
)
);
}
-impl Clone for Calc {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Test {
pub _address: u8,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Test_Size {
pub mWidth: Test_Size_Dimension,
pub mHeight: Test_Size_Dimension,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Test_Size_Dimension {
pub _base: Calc,
}
@@ -66,11 +61,6 @@ fn bindgen_test_layout_Test_Size_Dimension() {
concat!("Alignment of ", stringify!(Test_Size_Dimension))
);
}
-impl Clone for Test_Size_Dimension {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_Test_Size() {
assert_eq!(
@@ -104,11 +94,6 @@ fn bindgen_test_layout_Test_Size() {
)
);
}
-impl Clone for Test_Size {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_Test() {
assert_eq!(
@@ -122,8 +107,3 @@ fn bindgen_test_layout_Test() {
concat!("Alignment of ", stringify!(Test))
);
}
-impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs
index 0da5289e..40826106 100644
--- a/tests/expectations/tests/nested_vtable.rs
+++ b/tests/expectations/tests/nested_vtable.rs
@@ -7,7 +7,7 @@
#[repr(C)]
pub struct nsISupports__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct nsISupports {
pub vtable_: *const nsISupports__bindgen_vtable,
}
@@ -24,11 +24,6 @@ fn bindgen_test_layout_nsISupports() {
concat!("Alignment of ", stringify!(nsISupports))
);
}
-impl Clone for nsISupports {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for nsISupports {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -39,7 +34,7 @@ extern "C" {
pub fn nsISupports_QueryInterface(this: *mut ::std::os::raw::c_void) -> *mut nsISupports;
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct nsIRunnable {
pub _base: nsISupports,
}
@@ -56,18 +51,13 @@ fn bindgen_test_layout_nsIRunnable() {
concat!("Alignment of ", stringify!(nsIRunnable))
);
}
-impl Clone for nsIRunnable {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for nsIRunnable {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Runnable {
pub _base: nsIRunnable,
}
@@ -84,11 +74,6 @@ fn bindgen_test_layout_Runnable() {
concat!("Alignment of ", stringify!(Runnable))
);
}
-impl Clone for Runnable {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Runnable {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs
index d291a537..0a494ba2 100644
--- a/tests/expectations/tests/nested_within_namespace.rs
+++ b/tests/expectations/tests/nested_within_namespace.rs
@@ -12,12 +12,12 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub foo: ::std::os::raw::c_int,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar_Baz {
pub foo: ::std::os::raw::c_int,
}
@@ -44,11 +44,6 @@ pub mod root {
)
);
}
- impl Clone for Bar_Baz {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_Bar() {
assert_eq!(
@@ -72,13 +67,8 @@ pub mod root {
)
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Baz {
pub baz: ::std::os::raw::c_int,
}
@@ -105,10 +95,5 @@ pub mod root {
)
);
}
- impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
- }
}
}
diff --git a/tests/expectations/tests/no-comments.rs b/tests/expectations/tests/no-comments.rs
index b097acd6..0260e548 100644
--- a/tests/expectations/tests/no-comments.rs
+++ b/tests/expectations/tests/no-comments.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub s: ::std::os::raw::c_int,
}
@@ -27,8 +27,3 @@ fn bindgen_test_layout_Foo() {
concat!("Alignment of field: ", stringify!(Foo), "::", stringify!(s))
);
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/no-partialeq-opaque.rs b/tests/expectations/tests/no-partialeq-opaque.rs
index 8fd5451f..1a794162 100644
--- a/tests/expectations/tests/no-partialeq-opaque.rs
+++ b/tests/expectations/tests/no-partialeq-opaque.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct NoPartialEq {
pub _bindgen_opaque_blob: u32,
}
@@ -22,8 +22,3 @@ fn bindgen_test_layout_NoPartialEq() {
concat!("Alignment of ", stringify!(NoPartialEq))
);
}
-impl Clone for NoPartialEq {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/no-partialeq-whitelisted.rs b/tests/expectations/tests/no-partialeq-whitelisted.rs
index f07864ce..fb1437f1 100644
--- a/tests/expectations/tests/no-partialeq-whitelisted.rs
+++ b/tests/expectations/tests/no-partialeq-whitelisted.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct NoPartialEq {
pub i: ::std::os::raw::c_int,
}
@@ -32,8 +32,3 @@ fn bindgen_test_layout_NoPartialEq() {
)
);
}
-impl Clone for NoPartialEq {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs
index 252b51ff..2708b21c 100644
--- a/tests/expectations/tests/no-std.rs
+++ b/tests/expectations/tests/no-std.rs
@@ -9,7 +9,7 @@ mod libc {
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct foo {
pub a: libc::c_int,
pub b: libc::c_int,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
diff --git a/tests/expectations/tests/non-type-params.rs b/tests/expectations/tests/non-type-params.rs
index 4a6626a0..c20876dc 100644
--- a/tests/expectations/tests/non-type-params.rs
+++ b/tests/expectations/tests/non-type-params.rs
@@ -7,7 +7,7 @@
pub type Array16 = u8;
pub type ArrayInt4 = [u32; 4usize];
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct UsesArray {
pub array_char_16: [u8; 16usize],
pub array_bool_8: [u8; 8usize],
@@ -56,8 +56,3 @@ fn bindgen_test_layout_UsesArray() {
)
);
}
-impl Clone for UsesArray {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs
index 446e6384..52cad57d 100644
--- a/tests/expectations/tests/objc_interface_type.rs
+++ b/tests/expectations/tests/objc_interface_type.rs
@@ -11,7 +11,7 @@ pub type id = *mut objc::runtime::Object;
pub trait Foo {}
impl Foo for id {}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct FooStruct {
pub foo: *mut id,
}
@@ -38,11 +38,6 @@ fn bindgen_test_layout_FooStruct() {
)
);
}
-impl Clone for FooStruct {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for FooStruct {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs
index 4bc21afb..5ac15b38 100644
--- a/tests/expectations/tests/only_bitfields.rs
+++ b/tests/expectations/tests/only_bitfields.rs
@@ -5,7 +5,7 @@
#[repr(C, packed)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct C {
pub _bitfield_1: u8,
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout_C() {
concat!("Alignment of ", stringify!(C))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl C {
#[inline]
pub fn a(&self) -> bool {
diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs
index 20b44d7e..6cac967e 100644
--- a/tests/expectations/tests/opaque-template-inst-member-2.rs
+++ b/tests/expectations/tests/opaque-template-inst-member-2.rs
@@ -12,7 +12,7 @@
pub struct OpaqueTemplate {}
/// Should derive Debug/Hash/PartialEq.
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ContainsOpaqueTemplate {
pub mBlah: u32,
pub mBaz: ::std::os::raw::c_int,
@@ -50,14 +50,9 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() {
)
);
}
-impl Clone for ContainsOpaqueTemplate {
- fn clone(&self) -> Self {
- *self
- }
-}
/// Should also derive Debug/Hash/PartialEq.
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct InheritsOpaqueTemplate {
pub _base: u8,
pub wow: *mut ::std::os::raw::c_char,
@@ -85,11 +80,6 @@ fn bindgen_test_layout_InheritsOpaqueTemplate() {
)
);
}
-impl Clone for InheritsOpaqueTemplate {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for InheritsOpaqueTemplate {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
index e541e648..45d8a7d8 100644
--- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
+++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
@@ -23,7 +23,7 @@ pub mod root {
}
}
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+ #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo {
pub c: ::std::os::raw::c_char,
}
@@ -45,13 +45,8 @@ pub mod root {
concat!("Alignment of field: ", stringify!(Foo), "::", stringify!(c))
);
}
- impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+ #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Bar {
pub i: ::std::os::raw::c_int,
}
@@ -73,13 +68,8 @@ pub mod root {
concat!("Alignment of field: ", stringify!(Bar), "::", stringify!(i))
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Copy, Hash, PartialEq, Eq)]
+ #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ContainsInstantiation {
pub not_opaque: root::zoidberg::Template<root::zoidberg::Foo>,
}
@@ -106,18 +96,13 @@ pub mod root {
)
);
}
- impl Clone for ContainsInstantiation {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for ContainsInstantiation {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+ #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ContainsOpaqueInstantiation {
pub opaque: u32,
}
@@ -146,11 +131,6 @@ pub mod root {
)
);
}
- impl Clone for ContainsOpaqueInstantiation {
- fn clone(&self) -> Self {
- *self
- }
- }
}
#[test]
fn __bindgen_test_layout_Template_open0_Foo_close0_instantiation() {
diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs
index 779c32a6..02788d76 100644
--- a/tests/expectations/tests/opaque-template-instantiation.rs
+++ b/tests/expectations/tests/opaque-template-instantiation.rs
@@ -16,7 +16,7 @@ impl<T> Default for Template<T> {
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ContainsInstantiation {
pub not_opaque: Template<::std::os::raw::c_char>,
}
@@ -43,18 +43,13 @@ fn bindgen_test_layout_ContainsInstantiation() {
)
);
}
-impl Clone for ContainsInstantiation {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for ContainsInstantiation {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ContainsOpaqueInstantiation {
pub opaque: u32,
}
@@ -81,11 +76,6 @@ fn bindgen_test_layout_ContainsOpaqueInstantiation() {
)
);
}
-impl Clone for ContainsOpaqueInstantiation {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn __bindgen_test_layout_Template_open0_char_close0_instantiation() {
assert_eq!(
diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs
index 62f63c42..87d91f3c 100644
--- a/tests/expectations/tests/opaque-tracing.rs
+++ b/tests/expectations/tests/opaque-tracing.rs
@@ -9,7 +9,7 @@ extern "C" {
pub fn foo(c: *mut Container);
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Container {
pub _bindgen_opaque_blob: [u32; 2usize],
}
@@ -26,8 +26,3 @@ fn bindgen_test_layout_Container() {
concat!("Alignment of ", stringify!(Container))
);
}
-impl Clone for Container {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
index 49cfc5fc..92d28e4d 100644
--- a/tests/expectations/tests/opaque_in_struct.rs
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -7,7 +7,7 @@
/// <div rustbindgen opaque>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct opaque {
pub _bindgen_opaque_blob: u32,
}
@@ -24,13 +24,8 @@ fn bindgen_test_layout_opaque() {
concat!("Alignment of ", stringify!(opaque))
);
}
-impl Clone for opaque {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct container {
pub contained: opaque,
}
@@ -57,8 +52,3 @@ fn bindgen_test_layout_container() {
)
);
}
-impl Clone for container {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
index 6eb7b672..cc8e247f 100644
--- a/tests/expectations/tests/opaque_pointer.rs
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -7,7 +7,7 @@
/// <div rustbindgen opaque></div>
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OtherOpaque {
pub _bindgen_opaque_blob: u32,
}
@@ -24,17 +24,12 @@ fn bindgen_test_layout_OtherOpaque() {
concat!("Alignment of ", stringify!(OtherOpaque))
);
}
-impl Clone for OtherOpaque {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen opaque></div>
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Opaque {}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq)]
pub struct WithOpaquePtr {
pub whatever: *mut u8,
pub other: u32,
@@ -83,11 +78,6 @@ fn bindgen_test_layout_WithOpaquePtr() {
)
);
}
-impl Clone for WithOpaquePtr {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithOpaquePtr {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs
index 73f6377d..400373f8 100644
--- a/tests/expectations/tests/private.rs
+++ b/tests/expectations/tests/private.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct HasPrivate {
pub mNotPrivate: ::std::os::raw::c_int,
/// <div rustbindgen private></div>
@@ -44,14 +44,9 @@ fn bindgen_test_layout_HasPrivate() {
)
);
}
-impl Clone for HasPrivate {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen private></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct VeryPrivate {
mIsPrivate: ::std::os::raw::c_int,
mIsAlsoPrivate: ::std::os::raw::c_int,
@@ -89,14 +84,9 @@ fn bindgen_test_layout_VeryPrivate() {
)
);
}
-impl Clone for VeryPrivate {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen private></div>
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct ContradictPrivate {
/// <div rustbindgen private="false"></div>
pub mNotPrivate: ::std::os::raw::c_int,
@@ -135,8 +125,3 @@ fn bindgen_test_layout_ContradictPrivate() {
)
);
}
-impl Clone for ContradictPrivate {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs
index fd57dd57..14675a67 100644
--- a/tests/expectations/tests/ref_argument_array.rs
+++ b/tests/expectations/tests/ref_argument_array.rs
@@ -8,7 +8,7 @@ pub const NSID_LENGTH: ::std::os::raw::c_uint = 10;
#[repr(C)]
pub struct nsID__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct nsID {
pub vtable_: *const nsID__bindgen_vtable,
}
@@ -25,11 +25,6 @@ fn bindgen_test_layout_nsID() {
concat!("Alignment of ", stringify!(nsID))
);
}
-impl Clone for nsID {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for nsID {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs
index 0402c95c..57a11871 100644
--- a/tests/expectations/tests/reparented_replacement.rs
+++ b/tests/expectations/tests/reparented_replacement.rs
@@ -13,7 +13,7 @@ pub mod root {
use self::super::super::root;
/// <div rustbindgen replaces="foo::Bar"></div>
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub bazz: ::std::os::raw::c_int,
}
@@ -40,11 +40,6 @@ pub mod root {
)
);
}
- impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
- }
}
pub type ReferencesBar = root::foo::Bar;
}
diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs
index 49185e32..5f85dc32 100644
--- a/tests/expectations/tests/replace_use.rs
+++ b/tests/expectations/tests/replace_use.rs
@@ -12,7 +12,7 @@ pub struct nsTArray {
pub y: ::std::os::raw::c_uint,
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Test {
pub a: nsTArray,
}
@@ -39,11 +39,6 @@ fn bindgen_test_layout_Test() {
)
);
}
-impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn __bindgen_test_layout_nsTArray_open0_long_close0_instantiation() {
assert_eq!(
diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
index 3575a581..b89568ec 100644
--- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
+++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
@@ -10,7 +10,7 @@ pub struct JS_Zone {
_unused: [u8; 0],
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct JS_shadow_Zone {
pub x: ::std::os::raw::c_int,
pub y: ::std::os::raw::c_int,
@@ -48,8 +48,3 @@ fn bindgen_test_layout_JS_shadow_Zone() {
)
);
}
-impl Clone for JS_shadow_Zone {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs
index 61d35e25..96ad8129 100644
--- a/tests/expectations/tests/sentry-defined-multiple-times.rs
+++ b/tests/expectations/tests/sentry-defined-multiple-times.rs
@@ -22,7 +22,7 @@ pub mod root {
pub i_am_wrapper_sentry: ::std::os::raw::c_int,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct sentry {
pub i_am_plain_sentry: bool,
}
@@ -49,13 +49,8 @@ pub mod root {
)
);
}
- impl Clone for sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct NotTemplateWrapper {
pub _address: u8,
}
@@ -72,13 +67,8 @@ pub mod root {
concat!("Alignment of ", stringify!(NotTemplateWrapper))
);
}
- impl Clone for NotTemplateWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct NotTemplateWrapper_sentry {
pub i_am_not_template_wrapper_sentry: ::std::os::raw::c_char,
}
@@ -108,18 +98,13 @@ pub mod root {
)
);
}
- impl Clone for NotTemplateWrapper_sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct InlineNotTemplateWrapper {
pub _address: u8,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct InlineNotTemplateWrapper_sentry {
pub i_am_inline_not_template_wrapper_sentry: bool,
}
@@ -150,11 +135,6 @@ pub mod root {
)
);
}
- impl Clone for InlineNotTemplateWrapper_sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_InlineNotTemplateWrapper() {
assert_eq!(
@@ -168,11 +148,6 @@ pub mod root {
concat!("Alignment of ", stringify!(InlineNotTemplateWrapper))
);
}
- impl Clone for InlineNotTemplateWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct InlineTemplateWrapper {
@@ -184,12 +159,12 @@ pub mod root {
pub i_am_inline_template_wrapper_sentry: ::std::os::raw::c_int,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleWrapper {
pub _address: u8,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleWrapper_InnerDoubleWrapper {
pub _address: u8,
}
@@ -212,11 +187,6 @@ pub mod root {
)
);
}
- impl Clone for OuterDoubleWrapper_InnerDoubleWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_OuterDoubleWrapper() {
assert_eq!(
@@ -230,13 +200,8 @@ pub mod root {
concat!("Alignment of ", stringify!(OuterDoubleWrapper))
);
}
- impl Clone for OuterDoubleWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleWrapper_InnerDoubleWrapper_sentry {
pub i_am_double_wrapper_sentry: ::std::os::raw::c_int,
}
@@ -272,23 +237,18 @@ pub mod root {
)
);
}
- impl Clone for OuterDoubleWrapper_InnerDoubleWrapper_sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleInlineWrapper {
pub _address: u8,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleInlineWrapper_InnerDoubleInlineWrapper {
pub _address: u8,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry {
pub i_am_double_wrapper_inline_sentry: ::std::os::raw::c_int,
}
@@ -324,11 +284,6 @@ pub mod root {
)
);
}
- impl Clone for OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper() {
assert_eq!(
@@ -348,11 +303,6 @@ pub mod root {
)
);
}
- impl Clone for OuterDoubleInlineWrapper_InnerDoubleInlineWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
#[test]
fn bindgen_test_layout_OuterDoubleInlineWrapper() {
assert_eq!(
@@ -366,11 +316,6 @@ pub mod root {
concat!("Alignment of ", stringify!(OuterDoubleInlineWrapper))
);
}
- impl Clone for OuterDoubleInlineWrapper {
- fn clone(&self) -> Self {
- *self
- }
- }
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
@@ -383,7 +328,7 @@ pub mod root {
pub i_am_outside_namespace_wrapper_sentry: ::std::os::raw::c_int,
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct sentry {
pub i_am_outside_namespace_sentry: ::std::os::raw::c_int,
}
@@ -410,9 +355,4 @@ pub mod root {
)
);
}
- impl Clone for sentry {
- fn clone(&self) -> Self {
- *self
- }
- }
}
diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs
index 16a72e25..9fa6c3ad 100644
--- a/tests/expectations/tests/size_t_template.rs
+++ b/tests/expectations/tests/size_t_template.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct C {
pub arr: [u32; 3usize],
}
@@ -27,8 +27,3 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(arr))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
index 12e13dc8..f20b9b3a 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct a {
pub val_a: *mut b,
}
@@ -32,18 +32,13 @@ fn bindgen_test_layout_a() {
)
);
}
-impl Clone for a {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for a {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct b {
pub val_b: ::std::os::raw::c_int,
}
@@ -70,8 +65,3 @@ fn bindgen_test_layout_b() {
)
);
}
-impl Clone for b {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs
index f1e195fd..1079bb3f 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct typedef_named_struct {
pub has_name: bool,
}
@@ -32,13 +32,8 @@ fn bindgen_test_layout_typedef_named_struct() {
)
);
}
-impl Clone for typedef_named_struct {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct _bindgen_ty_1 {
pub no_name: *mut ::std::os::raw::c_void,
}
@@ -65,11 +60,6 @@ fn bindgen_test_layout__bindgen_ty_1() {
)
);
}
-impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for _bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs
index e0dfe41d..b40c1733 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, Eq)]
+ #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct typedef_struct {
pub foo: ::std::os::raw::c_int,
}
@@ -39,11 +39,6 @@ pub mod root {
)
);
}
- impl Clone for typedef_struct {
- fn clone(&self) -> Self {
- *self
- }
- }
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum typedef_enum {
@@ -54,7 +49,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+ #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct _bindgen_ty_1 {
pub foo: ::std::os::raw::c_int,
}
@@ -81,11 +76,6 @@ pub mod root {
)
);
}
- impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
- }
pub type typedef_struct = root::_bindgen_mod_id_12::_bindgen_ty_1;
pub const _bindgen_mod_id_12_BAR: root::_bindgen_mod_id_12::_bindgen_ty_2 =
_bindgen_ty_2::BAR;
diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs
index d386c79b..b8726df0 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -76,8 +71,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs
index 2826c36e..8616ba5d 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -49,13 +49,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_2 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -93,11 +88,6 @@ fn bindgen_test_layout_foo__bindgen_ty_2() {
)
);
}
-impl Clone for foo__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -131,8 +121,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
index bf3ad049..733721be 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo {
pub bar: *mut foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -76,11 +71,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
index 665ec308..716461ea 100644
--- a/tests/expectations/tests/struct_with_anon_union.rs
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_ushort,
@@ -49,11 +49,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -82,11 +77,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
index ba596f33..839023ec 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -66,8 +61,3 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of ", stringify!(foo))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
index 37ba81c3..3cb92db7 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_ushort,
@@ -49,11 +49,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -72,11 +67,6 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of ", stringify!(foo))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs
index fffb9380..9c7b3007 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct bitfield {
pub _bitfield_1: u8,
pub e: ::std::os::raw::c_int,
@@ -34,11 +34,6 @@ fn bindgen_test_layout_bitfield() {
)
);
}
-impl Clone for bitfield {
- fn clone(&self) -> Self {
- *self
- }
-}
impl bitfield {
#[inline]
pub fn a(&self) -> ::std::os::raw::c_ushort {
diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs
index f681e21e..4a068de5 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct LittleArray {
pub a: [::std::os::raw::c_int; 32usize],
}
@@ -32,13 +32,8 @@ fn bindgen_test_layout_LittleArray() {
)
);
}
-impl Clone for LittleArray {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct BigArray {
pub a: [::std::os::raw::c_int; 33usize],
}
@@ -65,18 +60,13 @@ fn bindgen_test_layout_BigArray() {
)
);
}
-impl Clone for BigArray {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for BigArray {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct WithLittleArray {
pub a: LittleArray,
}
@@ -103,13 +93,8 @@ fn bindgen_test_layout_WithLittleArray() {
)
);
}
-impl Clone for WithLittleArray {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct WithBigArray {
pub a: BigArray,
}
@@ -136,11 +121,6 @@ fn bindgen_test_layout_WithBigArray() {
)
);
}
-impl Clone for WithBigArray {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithBigArray {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_large_array.rs b/tests/expectations/tests/struct_with_large_array.rs
index 73b29fd9..decc5934 100644
--- a/tests/expectations/tests/struct_with_large_array.rs
+++ b/tests/expectations/tests/struct_with_large_array.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct S {
pub large_array: [::std::os::raw::c_char; 33usize],
}
@@ -32,11 +32,6 @@ fn bindgen_test_layout_S() {
)
);
}
-impl Clone for S {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for S {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
index d25fc4bc..08fbc52c 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -5,13 +5,13 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub struct foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub b: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
@@ -19,7 +19,7 @@ pub union foo__bindgen_ty_1 {
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, 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,
@@ -57,13 +57,8 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, 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,
@@ -123,11 +118,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
)
);
}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(
@@ -151,11 +141,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -179,11 +164,6 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of field: ", stringify!(foo), "::", stringify!(a))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs
index acdcd9b3..b942ebd1 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct a {
pub b: ::std::os::raw::c_char,
pub c: ::std::os::raw::c_short,
@@ -33,8 +33,3 @@ fn bindgen_test_layout_a() {
concat!("Alignment of field: ", stringify!(a), "::", stringify!(c))
);
}
-impl Clone for a {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs
index 22676961..15494387 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, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub x: ::std::os::raw::c_uint,
pub y: ::std::os::raw::c_uint,
@@ -48,11 +48,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -76,8 +71,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index 46eb0a33..c00fb17f 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -38,7 +38,7 @@ pub struct mozilla_Foo {
_unused: [u8; 0],
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct C {
pub mB: B<::std::os::raw::c_uint>,
pub mBConstPtr: B<*const ::std::os::raw::c_int>,
@@ -214,11 +214,6 @@ fn bindgen_test_layout_C() {
)
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -261,7 +256,7 @@ impl<T> Default for Rooted<T> {
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct RootedContainer {
pub root: Rooted<*mut ::std::os::raw::c_void>,
}
@@ -288,11 +283,6 @@ fn bindgen_test_layout_RootedContainer() {
)
);
}
-impl Clone for RootedContainer {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for RootedContainer {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -348,7 +338,7 @@ impl Default for PODButContainsDtor {
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Opaque {}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct POD {
pub opaque_member: u32,
}
@@ -375,11 +365,6 @@ fn bindgen_test_layout_POD() {
)
);
}
-impl Clone for POD {
- fn clone(&self) -> Self {
- *self
- }
-}
/// <div rustbindgen replaces="NestedReplaced"></div>
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -428,7 +413,7 @@ impl<T> Default for Incomplete<T> {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Untemplated {
pub _address: u8,
}
@@ -445,11 +430,6 @@ fn bindgen_test_layout_Untemplated() {
concat!("Alignment of ", stringify!(Untemplated))
);
}
-impl Clone for Untemplated {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated {
diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
index c53d5de3..b6ab186a 100644
--- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
+++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
@@ -12,7 +12,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, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Test {
pub ch: ::std::os::raw::c_char,
pub u: ::std::os::raw::c_uchar,
@@ -160,8 +160,3 @@ fn bindgen_test_layout_Test() {
)
);
}
-impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/type-referenced-by-whitelisted-function.rs b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs
index 3334eff5..73902a42 100644
--- a/tests/expectations/tests/type-referenced-by-whitelisted-function.rs
+++ b/tests/expectations/tests/type-referenced-by-whitelisted-function.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct dl_phdr_info {
pub x: ::std::os::raw::c_int,
}
@@ -32,11 +32,6 @@ fn bindgen_test_layout_dl_phdr_info() {
)
);
}
-impl Clone for dl_phdr_info {
- fn clone(&self) -> Self {
- *self
- }
-}
extern "C" {
pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int;
}
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index f8ed525b..7376aa76 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct mozilla_FragmentOrURL {
pub mIsLocalRef: bool,
}
@@ -32,13 +32,8 @@ fn bindgen_test_layout_mozilla_FragmentOrURL() {
)
);
}
-impl Clone for mozilla_FragmentOrURL {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct mozilla_Position {
pub _address: u8,
}
@@ -55,11 +50,6 @@ fn bindgen_test_layout_mozilla_Position() {
concat!("Alignment of ", stringify!(mozilla_Position))
);
}
-impl Clone for mozilla_Position {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
pub struct mozilla_StyleShapeSource {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
@@ -81,7 +71,7 @@ impl Default for mozilla_StyleShapeSource {
}
}
#[repr(C)]
-#[derive(Debug, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Bar {
pub mFoo: *mut nsFoo,
}
@@ -108,11 +98,6 @@ fn bindgen_test_layout_Bar() {
)
);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs
index d1b0ccc2..d9c61f7b 100644
--- a/tests/expectations/tests/underscore.rs
+++ b/tests/expectations/tests/underscore.rs
@@ -6,7 +6,7 @@
pub const __: ::std::os::raw::c_int = 10;
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct ptr_t {
pub __: [::std::os::raw::c_uchar; 8usize],
}
@@ -33,8 +33,3 @@ fn bindgen_test_layout_ptr_t() {
)
);
}
-impl Clone for ptr_t {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index a29b5038..9776626c 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -9,7 +9,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
- #[derive(Copy)]
+ #[derive(Copy, Clone)]
pub union bar {
pub baz: ::std::os::raw::c_int,
_bindgen_union_align: u32,
@@ -37,11 +37,6 @@ pub mod root {
)
);
}
- impl Clone for bar {
- fn clone(&self) -> Self {
- *self
- }
- }
impl Default for bar {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_bitfield.rs b/tests/expectations/tests/union_bitfield.rs
index ad41435d..ee82188c 100644
--- a/tests/expectations/tests/union_bitfield.rs
+++ b/tests/expectations/tests/union_bitfield.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union U4 {
pub _bitfield_1: u8,
_bindgen_union_align: u32,
@@ -23,11 +23,6 @@ fn bindgen_test_layout_U4() {
concat!("Alignment of ", stringify!(U4))
);
}
-impl Clone for U4 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for U4 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -76,7 +71,7 @@ impl U4 {
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union B {
pub _bitfield_1: u32,
_bindgen_union_align: u32,
@@ -94,11 +89,6 @@ fn bindgen_test_layout_B() {
concat!("Alignment of ", stringify!(B))
);
}
-impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for B {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 988b7ae8..0c723b2a 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union nsStyleUnion {
pub mInt: ::std::os::raw::c_int,
pub mFloat: f32,
@@ -55,11 +55,6 @@ fn bindgen_test_layout_nsStyleUnion() {
)
);
}
-impl Clone for nsStyleUnion {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for nsStyleUnion {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index 320ce820..87bcf6f3 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -5,13 +5,13 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo {
pub bar: foo__bindgen_ty_1,
_bindgen_union_align: [u32; 2usize],
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
@@ -49,11 +49,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(
@@ -77,11 +72,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index d759055b..ef5c1670 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -5,14 +5,14 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_int,
pub __bindgen_anon_1: foo__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
pub __bindgen_align: [u32; 0usize],
@@ -30,11 +30,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl foo__bindgen_ty_1 {
#[inline]
pub fn b(&self) -> ::std::os::raw::c_int {
@@ -132,11 +127,6 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of field: ", stringify!(foo), "::", stringify!(a))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index cb78c900..92f85595 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -5,13 +5,13 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo {
pub bar: foo__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_ushort,
@@ -50,11 +50,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -83,11 +78,6 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 8dd829e2..1f5e493f 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -5,14 +5,14 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union pixel {
pub rgba: ::std::os::raw::c_uint,
pub __bindgen_anon_1: pixel__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
+#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
@@ -72,11 +72,6 @@ fn bindgen_test_layout_pixel__bindgen_ty_1() {
)
);
}
-impl Clone for pixel__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
#[test]
fn bindgen_test_layout_pixel() {
assert_eq!(
@@ -100,11 +95,6 @@ fn bindgen_test_layout_pixel() {
)
);
}
-impl Clone for pixel {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for pixel {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index dea8b39e..ba0cf84e 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -5,14 +5,14 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub b: ::std::os::raw::c_ushort,
pub c: ::std::os::raw::c_uchar,
@@ -51,11 +51,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -79,11 +74,6 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of field: ", stringify!(foo), "::", stringify!(a))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index d5d19a9b..e0767ba2 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union WithBigArray {
pub a: ::std::os::raw::c_int,
pub b: [::std::os::raw::c_int; 33usize],
@@ -44,18 +44,13 @@ fn bindgen_test_layout_WithBigArray() {
)
);
}
-impl Clone for WithBigArray {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithBigArray {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union WithBigArray2 {
pub a: ::std::os::raw::c_int,
pub b: [::std::os::raw::c_char; 33usize],
@@ -94,18 +89,13 @@ fn bindgen_test_layout_WithBigArray2() {
)
);
}
-impl Clone for WithBigArray2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithBigArray2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union WithBigMember {
pub a: ::std::os::raw::c_int,
pub b: WithBigArray,
@@ -144,11 +134,6 @@ fn bindgen_test_layout_WithBigMember() {
)
);
}
-impl Clone for WithBigMember {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for WithBigMember {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index 9b27335d..1969a33c 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -5,20 +5,20 @@
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
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(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1__bindgen_ty_1 {
pub b1: ::std::os::raw::c_ushort,
pub b2: ::std::os::raw::c_ushort,
@@ -57,18 +57,13 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
)
);
}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1__bindgen_ty_2 {
pub c1: ::std::os::raw::c_ushort,
pub c2: ::std::os::raw::c_ushort,
@@ -107,11 +102,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
)
);
}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1__bindgen_ty_2 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -130,11 +120,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
);
}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo__bindgen_ty_1 {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -158,11 +143,6 @@ fn bindgen_test_layout_foo() {
concat!("Alignment of field: ", stringify!(foo), "::", stringify!(a))
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs
index 5f7c1c30..b5d83c2e 100644
--- a/tests/expectations/tests/unknown_attr.rs
+++ b/tests/expectations/tests/unknown_attr.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __bindgen_padding_0: u64,
@@ -40,8 +40,3 @@ fn bindgen_test_layout_max_align_t() {
)
);
}
-impl Clone for max_align_t {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index 093c4a83..ebbfb935 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, Eq)]
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
@@ -45,18 +45,13 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for foo {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Copy, Clone)]
pub union _bindgen_ty_1 {
pub bar: ::std::os::raw::c_int,
pub baz: ::std::os::raw::c_long,
@@ -95,11 +90,6 @@ fn bindgen_test_layout__bindgen_ty_1() {
)
);
}
-impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for _bindgen_ty_1 {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs
index 5042f3f7..d99526c7 100644
--- a/tests/expectations/tests/var-tracing.rs
+++ b/tests/expectations/tests/var-tracing.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub m_baz: ::std::os::raw::c_int,
}
@@ -36,11 +36,6 @@ extern "C" {
#[link_name = "\u{1}_ZN3BarC1Ei"]
pub fn Bar_Bar(this: *mut Bar, baz: ::std::os::raw::c_int);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Bar {
#[inline]
pub unsafe fn new(baz: ::std::os::raw::c_int) -> Self {
@@ -50,7 +45,7 @@ impl Bar {
}
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Baz {
pub _address: u8,
}
@@ -71,8 +66,3 @@ fn bindgen_test_layout_Baz() {
concat!("Alignment of ", stringify!(Baz))
);
}
-impl Clone for Baz {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/variadic-method.rs b/tests/expectations/tests/variadic-method.rs
index 6b3f70b3..94dd73be 100644
--- a/tests/expectations/tests/variadic-method.rs
+++ b/tests/expectations/tests/variadic-method.rs
@@ -9,7 +9,7 @@ extern "C" {
pub fn foo(fmt: *const ::std::os::raw::c_char, ...);
}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
@@ -30,8 +30,3 @@ extern "C" {
#[link_name = "\u{1}_ZN3Bar3fooEPKcz"]
pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...);
}
-impl Clone for Bar {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs
index 87096aa9..c75e9829 100644
--- a/tests/expectations/tests/vector.rs
+++ b/tests/expectations/tests/vector.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct foo {
pub mMember: [::std::os::raw::c_longlong; 1usize],
}
@@ -32,8 +32,3 @@ fn bindgen_test_layout_foo() {
)
);
}
-impl Clone for foo {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs
index 40e5859f..c4f7abfa 100644
--- a/tests/expectations/tests/virtual_inheritance.rs
+++ b/tests/expectations/tests/virtual_inheritance.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub foo: ::std::os::raw::c_int,
}
@@ -27,15 +27,10 @@ fn bindgen_test_layout_A() {
concat!("Alignment of field: ", stringify!(A), "::", stringify!(foo))
);
}
-impl Clone for A {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
pub struct B__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct B {
pub vtable_: *const B__bindgen_vtable,
pub bar: ::std::os::raw::c_int,
@@ -58,11 +53,6 @@ fn bindgen_test_layout_B() {
concat!("Alignment of field: ", stringify!(B), "::", stringify!(bar))
);
}
-impl Clone for B {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for B {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -71,7 +61,7 @@ impl Default for B {
#[repr(C)]
pub struct C__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct C {
pub vtable_: *const C__bindgen_vtable,
pub baz: ::std::os::raw::c_int,
@@ -94,18 +84,13 @@ fn bindgen_test_layout_C() {
concat!("Alignment of field: ", stringify!(C), "::", stringify!(baz))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct D {
pub _base: C,
pub _base_1: B,
@@ -124,11 +109,6 @@ fn bindgen_test_layout_D() {
concat!("Alignment of ", stringify!(D))
);
}
-impl Clone for D {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for D {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs
index 949fb386..376bae8a 100644
--- a/tests/expectations/tests/virtual_overloaded.rs
+++ b/tests/expectations/tests/virtual_overloaded.rs
@@ -7,7 +7,7 @@
#[repr(C)]
pub struct C__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct C {
pub vtable_: *const C__bindgen_vtable,
}
@@ -24,11 +24,6 @@ fn bindgen_test_layout_C() {
concat!("Alignment of ", stringify!(C))
);
}
-impl Clone for C {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for C {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs
index 0f35890c..f0720f27 100644
--- a/tests/expectations/tests/vtable_recursive_sig.rs
+++ b/tests/expectations/tests/vtable_recursive_sig.rs
@@ -7,7 +7,7 @@
#[repr(C)]
pub struct Base__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Base {
pub vtable_: *const Base__bindgen_vtable,
}
@@ -24,11 +24,6 @@ fn bindgen_test_layout_Base() {
concat!("Alignment of ", stringify!(Base))
);
}
-impl Clone for Base {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Base {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
@@ -39,7 +34,7 @@ extern "C" {
pub fn Base_AsDerived(this: *mut ::std::os::raw::c_void) -> *mut Derived;
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Derived {
pub _base: Base,
}
@@ -56,11 +51,6 @@ fn bindgen_test_layout_Derived() {
concat!("Alignment of ", stringify!(Derived))
);
}
-impl Clone for Derived {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Derived {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs
index 7a0b18c9..ac73b709 100644
--- a/tests/expectations/tests/weird_bitfields.rs
+++ b/tests/expectations/tests/weird_bitfields.rs
@@ -12,7 +12,7 @@ pub enum nsStyleSVGOpacitySource {
eStyleSVGOpacitySource_ContextStrokeOpacity = 2,
}
#[repr(C)]
-#[derive(Debug, Copy)]
+#[derive(Debug, Copy, Clone)]
pub struct Weird {
pub mStrokeDasharrayLength: ::std::os::raw::c_uint,
pub _bitfield_1: [u16; 2usize],
@@ -163,11 +163,6 @@ fn bindgen_test_layout_Weird() {
)
);
}
-impl Clone for Weird {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Default for Weird {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
diff --git a/tests/expectations/tests/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs
index 49dc9960..d0e4c689 100644
--- a/tests/expectations/tests/what_is_going_on.rs
+++ b/tests/expectations/tests/what_is_going_on.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct UnknownUnits {
pub _address: u8,
}
@@ -22,11 +22,6 @@ fn bindgen_test_layout_UnknownUnits() {
concat!("Alignment of ", stringify!(UnknownUnits))
);
}
-impl Clone for UnknownUnits {
- fn clone(&self) -> Self {
- *self
- }
-}
pub type Float = f32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
diff --git a/tests/expectations/tests/whitelist-namespaces-basic.rs b/tests/expectations/tests/whitelist-namespaces-basic.rs
index 316ed44d..74c782f7 100644
--- a/tests/expectations/tests/whitelist-namespaces-basic.rs
+++ b/tests/expectations/tests/whitelist-namespaces-basic.rs
@@ -15,7 +15,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Helper {
pub _address: u8,
}
@@ -32,11 +32,6 @@ pub mod root {
concat!("Alignment of ", stringify!(Helper))
);
}
- impl Clone for Helper {
- fn clone(&self) -> Self {
- *self
- }
- }
}
}
}
diff --git a/tests/expectations/tests/whitelist-namespaces.rs b/tests/expectations/tests/whitelist-namespaces.rs
index 01dce09a..f1c86bde 100644
--- a/tests/expectations/tests/whitelist-namespaces.rs
+++ b/tests/expectations/tests/whitelist-namespaces.rs
@@ -15,7 +15,7 @@ pub mod root {
#[allow(unused_imports)]
use self::super::super::super::root;
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Helper {
pub _address: u8,
}
@@ -32,14 +32,9 @@ pub mod root {
concat!("Alignment of ", stringify!(Helper))
);
}
- impl Clone for Helper {
- fn clone(&self) -> Self {
- *self
- }
- }
}
#[repr(C)]
- #[derive(Debug, Default, Copy)]
+ #[derive(Debug, Default, Copy, Clone)]
pub struct Test {
pub helper: root::outer::inner::Helper,
}
@@ -66,10 +61,5 @@ pub mod root {
)
);
}
- impl Clone for Test {
- fn clone(&self) -> Self {
- *self
- }
- }
}
}
diff --git a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs
index a7bbab74..32604b12 100644
--- a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs
+++ b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs
@@ -5,7 +5,7 @@
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct NoPartialEq {
pub _address: u8,
}
@@ -22,13 +22,8 @@ fn bindgen_test_layout_NoPartialEq() {
concat!("Alignment of ", stringify!(NoPartialEq))
);
}
-impl Clone for NoPartialEq {
- fn clone(&self) -> Self {
- *self
- }
-}
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct WhitelistMe {
pub a: NoPartialEq,
}
@@ -55,8 +50,3 @@ fn bindgen_test_layout_WhitelistMe() {
)
);
}
-impl Clone for WhitelistMe {
- fn clone(&self) -> Self {
- *self
- }
-}
diff --git a/tests/expectations/tests/win32-thiscall_nightly.rs b/tests/expectations/tests/win32-thiscall_nightly.rs
index 0fd1c00d..3b0140dc 100644
--- a/tests/expectations/tests/win32-thiscall_nightly.rs
+++ b/tests/expectations/tests/win32-thiscall_nightly.rs
@@ -6,7 +6,7 @@
#![feature(abi_thiscall)]
#[repr(C)]
-#[derive(Debug, Default, Copy)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
@@ -31,11 +31,6 @@ extern "thiscall" {
#[link_name = "\u{1}?test2@Foo@@QAEHH@Z"]
pub fn Foo_test2(this: *mut Foo, var: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
-impl Clone for Foo {
- fn clone(&self) -> Self {
- *self
- }
-}
impl Foo {
#[inline]
pub unsafe fn test(&mut self) {
diff --git a/tests/headers/derive-clone.h b/tests/headers/derive-clone.h
new file mode 100644
index 00000000..a84d35cd
--- /dev/null
+++ b/tests/headers/derive-clone.h
@@ -0,0 +1,5 @@
+
+/// This struct should derive `Clone`.
+struct ShouldDeriveClone {
+ int large[33];
+};
diff --git a/tests/headers/derive-clone_1_0.h b/tests/headers/derive-clone_1_0.h
new file mode 100644
index 00000000..34ef40ae
--- /dev/null
+++ b/tests/headers/derive-clone_1_0.h
@@ -0,0 +1,7 @@
+// bindgen-flags: --rust-target 1.0
+
+/// Since builtin `Clone` impls were introduced in Rust 1.21 this struct
+/// should impl `Clone` "manually".
+struct ShouldImplClone {
+ int large[33];
+};