From 5d53b00821804225b2b9e22dcb0801c295efc4a2 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Mon, 28 Sep 2026 22:16:59 +0100 Subject: [PATCH 1/4] Add VaArg and FnPtrArg traits --- cpp2rust/converter/converter.cpp | 2 +- cpp2rust/converter/converter_lib.cpp | 9 +++ cpp2rust/converter/converter_lib.h | 2 + .../converter/models/converter_refcount.cpp | 7 ++- libcc2rs-macros/src/fn_ptr_arg.rs | 23 ++++++++ libcc2rs-macros/src/lib.rs | 12 ++++ libcc2rs-macros/src/va_arg.rs | 27 +++++++++ libcc2rs/src/fn_ptr_arg.rs | 25 ++++++-- libcc2rs/src/format.rs | 2 +- libcc2rs/src/lib.rs | 3 +- libcc2rs/src/va_args.rs | 13 +++++ libcc2rs/src/void.rs | 2 +- .../out/refcount/cross_tu_tag_collision.rs | 2 +- .../out/refcount/friend_operator.rs | 2 +- .../out/refcount/opaque_forward_decl.rs | 4 +- .../out/unsafe/opaque_forward_decl.rs | 2 +- .../refcount/out_of_line_methods_cross_tu.rs | 4 +- .../template_method_late_instantiation.rs | 2 +- tests/ub/out/refcount/ctor_ref_member.rs | 2 +- tests/ub/out/refcount/ub6.rs | 2 +- tests/unit/fn_ptr_typedef_cast.c | 22 +++++++ tests/unit/out/refcount/10_struct.rs | 10 ++-- tests/unit/out/refcount/addr_of_global.rs | 4 +- tests/unit/out/refcount/anonymous-struct.rs | 18 +++--- tests/unit/out/refcount/anonymous-struct_c.rs | 18 +++--- tests/unit/out/refcount/anonymous_enum.rs | 4 +- tests/unit/out/refcount/anonymous_enum_c.rs | 4 +- tests/unit/out/refcount/array_const_init.rs | 2 +- .../out/refcount/array_of_noncopy_struct.rs | 2 +- tests/unit/out/refcount/array_reference.rs | 2 +- tests/unit/out/refcount/as_const.rs | 2 +- tests/unit/out/refcount/bounded_struct_ptr.rs | 2 +- tests/unit/out/refcount/bst.rs | 2 +- tests/unit/out/refcount/c_struct.rs | 10 ++-- tests/unit/out/refcount/class.rs | 6 +- .../refcount/class_template_lazy_member.rs | 6 +- tests/unit/out/refcount/class_templates.rs | 20 +++---- tests/unit/out/refcount/clone_vs_move.rs | 6 +- tests/unit/out/refcount/complex_function.rs | 8 +-- .../out/refcount/compound_assign_paren.rs | 2 +- tests/unit/out/refcount/concepts.rs | 2 +- tests/unit/out/refcount/constexpr_function.rs | 4 +- tests/unit/out/refcount/constructor.rs | 4 +- tests/unit/out/refcount/copy_assign.rs | 8 +-- tests/unit/out/refcount/copy_ctor.rs | 8 +-- .../unit/out/refcount/copy_move_defaulted.rs | 10 ++-- tests/unit/out/refcount/default.rs | 2 +- .../refcount/default_function_arguments.rs | 2 +- tests/unit/out/refcount/default_in_statics.rs | 6 +- tests/unit/out/refcount/destructor.rs | 22 +++---- tests/unit/out/refcount/doubly_linked_list.rs | 2 +- .../out/refcount/enum_default_in_static.rs | 2 +- tests/unit/out/refcount/enum_int_interop.rs | 2 +- tests/unit/out/refcount/enum_int_interop_c.rs | 2 +- tests/unit/out/refcount/exprs.rs | 4 +- tests/unit/out/refcount/fft.rs | 2 +- tests/unit/out/refcount/fn_ptr_cast.rs | 2 +- tests/unit/out/refcount/fn_ptr_stable_sort.rs | 2 +- tests/unit/out/refcount/fn_ptr_struct.rs | 4 +- .../unit/out/refcount/fn_ptr_typedef_cast.rs | 58 +++++++++++++++++++ tests/unit/out/refcount/fn_ptr_vtable.rs | 2 +- .../refcount/foreach_disjoint_field_borrow.rs | 2 +- tests/unit/out/refcount/forward_basic.rs | 4 +- tests/unit/out/refcount/forward_decltype.rs | 2 +- tests/unit/out/refcount/forward_explicit.rs | 2 +- tests/unit/out/refcount/forward_pack.rs | 4 +- tests/unit/out/refcount/friend.rs | 8 +-- .../unit/out/refcount/function_overloading.rs | 2 +- .../out/refcount/global_init_side_effect.rs | 2 +- .../out/refcount/global_non_const_init.rs | 6 +- tests/unit/out/refcount/global_pointers.rs | 2 +- .../refcount/global_without_initializer.rs | 2 +- .../out/refcount/goto_aggregate_default.rs | 2 +- tests/unit/out/refcount/goto_cleanup.rs | 2 +- tests/unit/out/refcount/huffman.rs | 2 +- .../refcount/immutable-deref-on-func-call.rs | 2 +- tests/unit/out/refcount/implicit_autoref.rs | 2 +- .../refcount/in_class_field_initializer.rs | 6 +- tests/unit/out/refcount/init.rs | 2 +- tests/unit/out/refcount/kruskal.rs | 2 +- .../refcount/libc_struct_without_default.rs | 4 +- tests/unit/out/refcount/linked_list.rs | 2 +- .../refcount/local_anon_struct_collision.rs | 4 +- .../out/refcount/local_record_template.rs | 8 +-- .../unit/out/refcount/memcpy_struct_bytes.rs | 2 +- .../unit/out/refcount/memcpy_struct_struct.rs | 2 +- tests/unit/out/refcount/move_ctor.rs | 4 +- tests/unit/out/refcount/move_this.rs | 2 +- tests/unit/out/refcount/nested_structs.rs | 12 ++-- tests/unit/out/refcount/new.rs | 2 +- tests/unit/out/refcount/new_bst.rs | 2 +- tests/unit/out/refcount/new_struct.rs | 4 +- tests/unit/out/refcount/offsetof.rs | 4 +- .../unit/out/refcount/opaque_forward_decl.rs | 4 +- tests/unit/out/refcount/opaque_record_copy.rs | 4 +- .../unit/out/refcount/opaque_then_defined.rs | 4 +- .../out/refcount/operator_arithmetic_free.rs | 2 +- .../refcount/operator_arithmetic_member.rs | 2 +- .../out/refcount/operator_bitwise_free.rs | 2 +- .../out/refcount/operator_bitwise_member.rs | 2 +- .../refcount/operator_comparison_defaulted.rs | 16 ++--- .../out/refcount/operator_comparison_free.rs | 4 +- .../refcount/operator_comparison_member.rs | 2 +- .../out/refcount/operator_comparison_mixed.rs | 2 +- .../operator_compound_assignment_free.rs | 2 +- .../operator_compound_assignment_member.rs | 2 +- tests/unit/out/refcount/operator_friend.rs | 14 ++--- tests/unit/out/refcount/operator_less_than.rs | 2 +- .../out/refcount/operator_logical_free.rs | 2 +- .../out/refcount/operator_logical_member.rs | 2 +- .../refcount/operator_member_pointer_free.rs | 4 +- .../operator_member_pointer_member.rs | 6 +- .../unit/out/refcount/operator_other_free.rs | 2 +- .../out/refcount/operator_other_member.rs | 4 +- tests/unit/out/refcount/operator_overloads.rs | 2 +- .../unit/out/refcount/operator_qualifiers.rs | 2 +- tests/unit/out/refcount/operator_three_way.rs | 2 +- tests/unit/out/refcount/operator_traits.rs | 10 ++-- tests/unit/out/refcount/overload_mangling.rs | 4 +- tests/unit/out/refcount/pod.rs | 2 +- tests/unit/out/refcount/pointer_array.rs | 2 +- tests/unit/out/refcount/pointers.rs | 2 +- tests/unit/out/refcount/polymorphism.rs | 4 +- tests/unit/out/refcount/ptr_cast_init.rs | 4 +- tests/unit/out/refcount/push_emplace_back.rs | 8 +-- tests/unit/out/refcount/random.rs | 4 +- tests/unit/out/refcount/reference_wrapper.rs | 2 +- tests/unit/out/refcount/refs_as_args.rs | 2 +- .../out/refcount/reinterpret_cast_struct.rs | 2 +- .../reinterpret_cast_struct_to_struct.rs | 4 +- tests/unit/out/refcount/reserved_keywords.rs | 2 +- tests/unit/out/refcount/rule_of_five.rs | 2 +- tests/unit/out/refcount/rule_of_three.rs | 2 +- tests/unit/out/refcount/rvalue_struct.rs | 2 +- .../scalar_builtin_construct_destruct.rs | 2 +- .../unit/out/refcount/static_var_in_class.rs | 4 +- tests/unit/out/refcount/strdup.rs | 2 +- .../out/refcount/string_literal_ptr_init.rs | 2 +- tests/unit/out/refcount/struct_ctor.rs | 2 +- .../unit/out/refcount/struct_default_ctor.rs | 4 +- tests/unit/out/refcount/struct_ptr.rs | 2 +- .../refcount/tag_vs_identifier_collision.rs | 10 ++-- .../unit/out/refcount/template_default_arg.rs | 8 +-- tests/unit/out/refcount/this.rs | 4 +- .../unit/out/refcount/typedef-anon-struct.rs | 4 +- .../out/refcount/unary_expr_or_type_trait.rs | 2 +- .../out/refcount/union_addrof_external.rs | 4 +- .../unit/out/refcount/union_cross_arm_cast.rs | 6 +- .../out/refcount/union_field_alignment.rs | 2 +- .../out/refcount/union_flex_array_member.rs | 2 +- .../unit/out/refcount/union_memset_memcpy.rs | 6 +- tests/unit/out/refcount/union_nested.rs | 6 +- .../out/refcount/union_pointer_pun_address.rs | 4 +- .../out/refcount/union_struct_dual_use.rs | 4 +- .../out/refcount/union_tagged_many_arms.rs | 2 +- .../unit/out/refcount/union_tagged_simple.rs | 2 +- .../out/refcount/union_tagged_struct_arms.rs | 8 +-- .../refcount/union_void_ptr_sized_deref.rs | 2 +- tests/unit/out/refcount/unique_ptr.rs | 2 +- tests/unit/out/refcount/unique_ptr_nested.rs | 2 +- tests/unit/out/refcount/unique_ptr_struct.rs | 2 +- tests/unit/out/refcount/va_arg_mixed_types.rs | 44 ++++++++++++++ .../out/refcount/va_arg_non_primitive_ptrs.rs | 2 +- tests/unit/out/refcount/va_arg_struct_ctx.rs | 2 +- tests/unit/out/refcount/va_arg_void_ptr.rs | 2 +- .../out/refcount/vector_with_allocator.rs | 4 +- tests/unit/out/refcount/void_cast.rs | 4 +- tests/unit/out/unsafe/fn_ptr_typedef_cast.rs | 29 ++++++++++ tests/unit/out/unsafe/opaque_forward_decl.rs | 2 +- tests/unit/out/unsafe/va_arg_mixed_types.rs | 15 +++++ tests/unit/va_arg_mixed_types.c | 10 ++++ 171 files changed, 602 insertions(+), 315 deletions(-) create mode 100644 libcc2rs-macros/src/fn_ptr_arg.rs create mode 100644 libcc2rs-macros/src/va_arg.rs diff --git a/cpp2rust/converter/converter.cpp b/cpp2rust/converter/converter.cpp index d5c6ed73bb..7a14a746ec 100644 --- a/cpp2rust/converter/converter.cpp +++ b/cpp2rust/converter/converter.cpp @@ -92,7 +92,7 @@ void Converter::EmitGlobalInits(Model model, std::string &out) { void Converter::EmitOpaqueRecords(std::string &out) { record_decls_.ForEachUndefined([&](const std::string &name) { - out += "#[derive(Clone, Copy, Default, ByteRepr)]"; + out += "#[derive(Clone, Copy, Default, ByteRepr, VaArg, FnPtrArg)]"; out += "pub struct "; out += name; out += ";\n"; diff --git a/cpp2rust/converter/converter_lib.cpp b/cpp2rust/converter/converter_lib.cpp index 4c01a1556e..aff12e84b0 100644 --- a/cpp2rust/converter/converter_lib.cpp +++ b/cpp2rust/converter/converter_lib.cpp @@ -474,6 +474,15 @@ bool RecordHasOnlyReferenceFields(const clang::RecordDecl *decl) { return true; } +bool RecordImplementsClone(const clang::RecordDecl *decl) { + if (decl->isUnion() || + (HasDefaultedCopyConstructor(decl) && RecordHasOnlyReferenceFields(decl))) { + return true; + } + return !clang::isa(decl) || + HasCallableCopyConstructor(decl); +} + bool HasDefaultedCopyAssignment(const clang::RecordDecl *decl) { auto *cxx = clang::dyn_cast(decl); if (!cxx) { diff --git a/cpp2rust/converter/converter_lib.h b/cpp2rust/converter/converter_lib.h index 6e0a8cc98f..3597f8f8d1 100644 --- a/cpp2rust/converter/converter_lib.h +++ b/cpp2rust/converter/converter_lib.h @@ -107,6 +107,8 @@ bool HasDefaultedCopyConstructor(const clang::RecordDecl *decl); bool RecordHasOnlyReferenceFields(const clang::RecordDecl *decl); +bool RecordImplementsClone(const clang::RecordDecl *decl); + bool RecordDerivesByteRepr(const clang::RecordDecl *decl); bool HasDefaultedCopyAssignment(const clang::RecordDecl *decl); diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index 6ce2ca6055..bec36d063c 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -501,7 +501,7 @@ void ConverterRefCount::AddCloneTrait(const clang::RecordDecl *decl) { return; } - if (!HasCallableCopyConstructor(cxx)) { + if (!RecordImplementsClone(decl)) { return; } @@ -2160,6 +2160,11 @@ ConverterRefCount::GetStructAttributes(const clang::RecordDecl *decl) { attrs.emplace_back("ByteRepr"); } + if (RecordImplementsClone(decl)) { + attrs.emplace_back("VaArg"); + attrs.emplace_back("FnPtrArg"); + } + if (RecordDerivesDefault(decl)) { attrs.emplace_back("Default"); } diff --git a/libcc2rs-macros/src/fn_ptr_arg.rs b/libcc2rs-macros/src/fn_ptr_arg.rs new file mode 100644 index 0000000000..42dc19f22f --- /dev/null +++ b/libcc2rs-macros/src/fn_ptr_arg.rs @@ -0,0 +1,23 @@ +// Copyright (c) 2022-present INESC-ID. +// Distributed under the MIT license that can be found in the LICENSE file. + +use proc_macro::TokenStream; +use syn::{DeriveInput, parse_macro_input}; + +pub fn expand(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + let name = &input.ident; + let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); + quote::quote! { + impl #impl_generics ::libcc2rs::FnPtrArg for #name #ty_generics #where_clause { + #[inline] + fn to_repr(&self) -> ::libcc2rs::ArgRepr<'_> { + ::libcc2rs::ArgRepr::Record(self) + } + fn from_repr(r: &::libcc2rs::ArgRepr) -> Self { + ::libcc2rs::record_from_repr(r) + } + } + } + .into() +} diff --git a/libcc2rs-macros/src/lib.rs b/libcc2rs-macros/src/lib.rs index 43a222af00..6d94595da3 100644 --- a/libcc2rs-macros/src/lib.rs +++ b/libcc2rs-macros/src/lib.rs @@ -4,9 +4,11 @@ use proc_macro::TokenStream; mod byte_repr; +mod fn_ptr_arg; mod goto; mod state_machine; mod switch; +mod va_arg; // switch!(match { // [if ] => { /* body; may contain break or continue */ }, @@ -91,3 +93,13 @@ pub fn goto(_input: TokenStream) -> TokenStream { pub fn derive_byte_repr(input: TokenStream) -> TokenStream { byte_repr::expand(input) } + +#[proc_macro_derive(VaArg)] +pub fn derive_va_arg(input: TokenStream) -> TokenStream { + va_arg::expand(input) +} + +#[proc_macro_derive(FnPtrArg)] +pub fn derive_fn_ptr_arg(input: TokenStream) -> TokenStream { + fn_ptr_arg::expand(input) +} diff --git a/libcc2rs-macros/src/va_arg.rs b/libcc2rs-macros/src/va_arg.rs new file mode 100644 index 0000000000..75fbb63cc9 --- /dev/null +++ b/libcc2rs-macros/src/va_arg.rs @@ -0,0 +1,27 @@ +// Copyright (c) 2022-present INESC-ID. +// Distributed under the MIT license that can be found in the LICENSE file. + +use proc_macro::TokenStream; +use syn::{DeriveInput, parse_macro_input}; + +pub fn expand(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + let name = &input.ident; + let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); + quote::quote! { + impl #impl_generics ::core::convert::From<#name #ty_generics> for ::libcc2rs::VaArg + #where_clause + { + fn from(v: #name #ty_generics) -> Self { + ::libcc2rs::VaArg::Record(::std::rc::Rc::new(v)) + } + } + + impl #impl_generics ::libcc2rs::VaArgGet for #name #ty_generics #where_clause { + fn get(v: &::libcc2rs::VaArg) -> Self { + ::libcc2rs::va_record_get(v) + } + } + } + .into() +} diff --git a/libcc2rs/src/fn_ptr_arg.rs b/libcc2rs/src/fn_ptr_arg.rs index 5a44e8753d..260552db09 100644 --- a/libcc2rs/src/fn_ptr_arg.rs +++ b/libcc2rs/src/fn_ptr_arg.rs @@ -4,18 +4,21 @@ // Support for FnPtr::cast synthesizing a call-through adapter automatically, // for any function pointer types T -> U. +use std::any::Any; + use crate::rc::Ptr; use crate::reinterpret::ByteRepr; use crate::void::{AnyPtr, ErasedPtr}; // A type-erased view of one argument or return value, used only transiently // (within a single adapted call) and never allocated. -pub(crate) enum ArgRepr<'a> { +pub enum ArgRepr<'a> { Bytes([u8; 16], usize), Ptr(&'a dyn ErasedPtr), + Record(&'a dyn Any), } -pub(crate) trait FnPtrArg: 'static { +pub trait FnPtrArg: 'static { fn to_repr(&self) -> ArgRepr<'_>; // Panics if `r` describes a value that isn't a meaningful `Self` (wrong // kind, or same kind but incompatible size). @@ -105,7 +108,9 @@ impl FnPtrArg for Ptr { Some(exact) => exact.clone(), None => e.as_bytes().reinterpret_cast(), }, - ArgRepr::Bytes(..) => panic!("ub: calling through incompatible fn pointer type"), + ArgRepr::Bytes(..) | ArgRepr::Record(_) => { + panic!("ub: calling through incompatible fn pointer type") + } } } } @@ -118,11 +123,23 @@ impl FnPtrArg for AnyPtr { fn from_repr(r: &ArgRepr) -> Self { match r { ArgRepr::Ptr(e) => e.as_bytes().to_any(), - ArgRepr::Bytes(..) => panic!("ub: calling through incompatible fn pointer type"), + ArgRepr::Bytes(..) | ArgRepr::Record(_) => { + panic!("ub: calling through incompatible fn pointer type") + } } } } +pub fn record_from_repr(r: &ArgRepr) -> T { + match r { + ArgRepr::Record(v) => v + .downcast_ref::() + .expect("ub: calling through incompatible fn pointer type") + .clone(), + _ => panic!("ub: calling through incompatible fn pointer type"), + } +} + // Fixed-capacity, type-erased view of a whole argument list: `FnPtrArgs` // (below) converts a tuple of arguments to and from this common // intermediate, so that converting between two argument lists never needs to diff --git a/libcc2rs/src/format.rs b/libcc2rs/src/format.rs index 777f874ae2..017f8c17cc 100644 --- a/libcc2rs/src/format.rs +++ b/libcc2rs/src/format.rs @@ -62,7 +62,7 @@ pub fn format_c(fmt: &str, va: &[VaArg]) -> String { VaArg::ULong(v) => Arg::ULong(*v), VaArg::Ptr(p) => Arg::Size(p.to_int()), VaArg::RawPtr(v) => Arg::Size(*v as usize), - VaArg::Double(_) => { + VaArg::Double(_) | VaArg::Record(_) => { panic!("format_c: integer conversion expects an integer argument") } }, diff --git a/libcc2rs/src/lib.rs b/libcc2rs/src/lib.rs index b80b0fea9a..d573c4c615 100644 --- a/libcc2rs/src/lib.rs +++ b/libcc2rs/src/lib.rs @@ -18,6 +18,7 @@ pub use ptr_dyn::*; include!(concat!(env!("OUT_DIR"), "/rule_shims.rs")); mod fn_ptr_arg; +pub use fn_ptr_arg::{ArgRepr, FnPtrArg, record_from_repr}; mod fn_ptr; pub use fn_ptr::FnPtr; @@ -55,4 +56,4 @@ pub use fd::*; mod format; pub use format::*; -pub use libcc2rs_macros::{ByteRepr, goto, goto_block, switch}; +pub use libcc2rs_macros::{ByteRepr, FnPtrArg, VaArg, goto, goto_block, switch}; diff --git a/libcc2rs/src/va_args.rs b/libcc2rs/src/va_args.rs index e58e1c07db..941b20a3bf 100644 --- a/libcc2rs/src/va_args.rs +++ b/libcc2rs/src/va_args.rs @@ -1,7 +1,9 @@ // Copyright (c) 2022-present INESC-ID. // Distributed under the MIT license that can be found in the LICENSE file. +use std::any::Any; use std::ffi::c_void; +use std::rc::Rc; use crate::void::AnyPtr; @@ -14,6 +16,7 @@ pub enum VaArg { Double(f64), RawPtr(*mut c_void), Ptr(AnyPtr), + Record(Rc), } macro_rules! impl_va_arg_from { @@ -99,6 +102,16 @@ macro_rules! impl_va_arg_get { )*}; } +pub fn va_record_get(v: &VaArg) -> T { + match v { + VaArg::Record(r) => r + .downcast_ref::() + .expect("VaArgGet: record type mismatch") + .clone(), + _ => panic!("VaArgGet: expected record"), + } +} + impl_va_arg_get!(int: i8, i16, i32, i64, u8, u16, u32, u64); impl_va_arg_get!(float: f32, f64); diff --git a/libcc2rs/src/void.rs b/libcc2rs/src/void.rs index a95496dd07..63a34f44a0 100644 --- a/libcc2rs/src/void.rs +++ b/libcc2rs/src/void.rs @@ -6,7 +6,7 @@ use std::rc::Rc; use crate::rc::Ptr; use crate::reinterpret::ByteRepr; -pub(crate) trait ErasedPtr: std::any::Any { +pub trait ErasedPtr: std::any::Any { fn as_bytes(&self) -> Ptr; fn as_any(&self) -> &dyn std::any::Any; fn equals(&self, other: &dyn ErasedPtr) -> bool; diff --git a/tests/multi-file/cross_tu_tag_collision/out/refcount/cross_tu_tag_collision.rs b/tests/multi-file/cross_tu_tag_collision/out/refcount/cross_tu_tag_collision.rs index ec058a7bfa..0794396fd5 100644 --- a/tests/multi-file/cross_tu_tag_collision/out/refcount/cross_tu_tag_collision.rs +++ b/tests/multi-file/cross_tu_tag_collision/out/refcount/cross_tu_tag_collision.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct widget { pub id: Value, } diff --git a/tests/multi-file/friend_operator/out/refcount/friend_operator.rs b/tests/multi-file/friend_operator/out/refcount/friend_operator.rs index c652dfd5e9..3b30db7ad0 100644 --- a/tests/multi-file/friend_operator/out/refcount/friend_operator.rs +++ b/tests/multi-file/friend_operator/out/refcount/friend_operator.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a: Value, pub b: Value, diff --git a/tests/multi-file/opaque_forward_decl/out/refcount/opaque_forward_decl.rs b/tests/multi-file/opaque_forward_decl/out/refcount/opaque_forward_decl.rs index 39f2fd4f3e..1d9a107f94 100644 --- a/tests/multi-file/opaque_forward_decl/out/refcount/opaque_forward_decl.rs +++ b/tests/multi-file/opaque_forward_decl/out/refcount/opaque_forward_decl.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct container { pub p: Value>, pub x: Value, @@ -52,6 +52,6 @@ pub fn touch_0(c: Ptr) { let c: Value> = Rc::new(RefCell::new(c)); &(*(*(*c.borrow()).upgrade().deref()).p.borrow()); } -#[derive(Clone, Copy, Default, ByteRepr)] +#[derive(Clone, Copy, Default, ByteRepr, VaArg, FnPtrArg)] pub struct opaque; pub fn __cpp2rust_init_globals() {} diff --git a/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs b/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs index 419c298417..ff0864803d 100644 --- a/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs +++ b/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs @@ -31,6 +31,6 @@ unsafe fn main_0() -> i32 { pub unsafe fn touch_0(mut c: *mut container) { &((*c).p); } -#[derive(Clone, Copy, Default, ByteRepr)] +#[derive(Clone, Copy, Default, ByteRepr, VaArg, FnPtrArg)] pub struct opaque; pub unsafe fn __cpp2rust_init_globals() {} diff --git a/tests/multi-file/out_of_line_methods_cross_tu/out/refcount/out_of_line_methods_cross_tu.rs b/tests/multi-file/out_of_line_methods_cross_tu/out/refcount/out_of_line_methods_cross_tu.rs index 5c9909f2ae..450e9dadb8 100644 --- a/tests/multi-file/out_of_line_methods_cross_tu/out/refcount/out_of_line_methods_cross_tu.rs +++ b/tests/multi-file/out_of_line_methods_cross_tu/out/refcount/out_of_line_methods_cross_tu.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } @@ -36,7 +36,7 @@ impl ByteRepr for S { pub trait Base { fn apply(&self, x: i32) -> i32; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Derived { pub factor: Value, } diff --git a/tests/multi-file/template_method_late_instantiation/out/refcount/template_method_late_instantiation.rs b/tests/multi-file/template_method_late_instantiation/out/refcount/template_method_late_instantiation.rs index 07579cd0c4..74a31b546d 100644 --- a/tests/multi-file/template_method_late_instantiation/out/refcount/template_method_late_instantiation.rs +++ b/tests/multi-file/template_method_late_instantiation/out/refcount/template_method_late_instantiation.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S_int_ { pub x: Value, } diff --git a/tests/ub/out/refcount/ctor_ref_member.rs b/tests/ub/out/refcount/ctor_ref_member.rs index b5df071044..62ffdb424f 100644 --- a/tests/ub/out/refcount/ctor_ref_member.rs +++ b/tests/ub/out/refcount/ctor_ref_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Clone, Default)] +#[derive(Clone, VaArg, FnPtrArg, Default)] pub struct S { pub r: Ptr, } diff --git a/tests/ub/out/refcount/ub6.rs b/tests/ub/out/refcount/ub6.rs index aa8222876d..7936c85f9b 100644 --- a/tests/ub/out/refcount/ub6.rs +++ b/tests/ub/out/refcount/ub6.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Clone, Default)] +#[derive(Clone, VaArg, FnPtrArg, Default)] pub struct Pair { pub x1: Ptr, pub x2: Ptr, diff --git a/tests/unit/fn_ptr_typedef_cast.c b/tests/unit/fn_ptr_typedef_cast.c index fadb197f6a..48c3bb01d1 100644 --- a/tests/unit/fn_ptr_typedef_cast.c +++ b/tests/unit/fn_ptr_typedef_cast.c @@ -9,6 +9,17 @@ unsigned long same_type(unsigned long a) { return a; } unsigned long via_size_t_param(size_t b) { return b; } size_t via_size_t_return(unsigned long b) { return b; } +struct pair { + int a; + int b; +}; + +unsigned long pair_scaled(struct pair p, size_t n) { return p.a * n + p.b; } +struct pair make_pair(size_t n) { + struct pair p = {(int)n, (int)n * 2}; + return p; +} + int main() { assert(call_with_ulong(same_type) == 4); assert(call_with_ulong(via_size_t_param) == 4); @@ -23,5 +34,16 @@ int main() { assert(back == original); assert(back(5) == 5); + typedef unsigned long (*pair_ulong_fn)(struct pair, unsigned long); + pair_ulong_fn scaled = (pair_ulong_fn)pair_scaled; + struct pair p = {3, 4}; + assert(scaled(p, 10) == 34); + + typedef struct pair (*make_ulong_fn)(unsigned long); + make_ulong_fn make = (make_ulong_fn)make_pair; + struct pair q = make(5); + assert(q.a == 5); + assert(q.b == 10); + return 0; } diff --git a/tests/unit/out/refcount/10_struct.rs b/tests/unit/out/refcount/10_struct.rs index 9d0e16ea81..b0492c2c72 100644 --- a/tests/unit/out/refcount/10_struct.rs +++ b/tests/unit/out/refcount/10_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct GraphNode { pub dst: Value, pub next: Value>, @@ -36,7 +36,7 @@ impl ByteRepr for GraphNode { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Graph { pub V: Value, pub adj: Value>>, @@ -66,7 +66,7 @@ impl ByteRepr for Graph { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Partial { pub p: Value>, } @@ -109,10 +109,10 @@ impl ByteRepr for Partial { } } } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Declared {} impl Declared {} -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub i: Value, pub d: Value>, diff --git a/tests/unit/out/refcount/addr_of_global.rs b/tests/unit/out/refcount/addr_of_global.rs index e964025e13..dea1b71133 100644 --- a/tests/unit/out/refcount/addr_of_global.rs +++ b/tests/unit/out/refcount/addr_of_global.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub value: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Inner { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub p: Value>, } diff --git a/tests/unit/out/refcount/anonymous-struct.rs b/tests/unit/out/refcount/anonymous-struct.rs index f736080dfc..7514ae12b2 100644 --- a/tests/unit/out/refcount/anonymous-struct.rs +++ b/tests/unit/out/refcount/anonymous-struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_Named { pub a: Value, pub b: Value, @@ -36,7 +36,7 @@ impl ByteRepr for Outer_Named { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_0 { pub c: Value, pub d: Value, @@ -66,7 +66,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_1 { pub g: Value, pub h: Value, @@ -96,7 +96,7 @@ impl ByteRepr for anon_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_2 { pub e: Value, pub f: Value, @@ -126,7 +126,7 @@ impl ByteRepr for anon_2 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_4 { pub j: Value, } @@ -152,7 +152,7 @@ impl ByteRepr for anon_4 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_5 { pub k: Value, } @@ -178,7 +178,7 @@ impl ByteRepr for anon_5 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_3 { pub i: Value, pub inner_named: Value, @@ -212,7 +212,7 @@ impl ByteRepr for anon_3 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub named: Value, pub anonymous_named_0: Value, @@ -313,7 +313,7 @@ fn main_0() -> i32 { ); return 0; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_6 { pub x: Value, pub z: Value, diff --git a/tests/unit/out/refcount/anonymous-struct_c.rs b/tests/unit/out/refcount/anonymous-struct_c.rs index 8ae5a8dc52..ca5f7c50af 100644 --- a/tests/unit/out/refcount/anonymous-struct_c.rs +++ b/tests/unit/out/refcount/anonymous-struct_c.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Named { pub a: Value, pub b: Value, @@ -34,7 +34,7 @@ impl ByteRepr for Named { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_0 { pub c: Value, pub d: Value, @@ -62,7 +62,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_1 { pub g: Value, pub h: Value, @@ -90,7 +90,7 @@ impl ByteRepr for anon_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_2 { pub e: Value, pub f: Value, @@ -118,7 +118,7 @@ impl ByteRepr for anon_2 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_4 { pub j: Value, } @@ -142,7 +142,7 @@ impl ByteRepr for anon_4 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_5 { pub k: Value, } @@ -166,7 +166,7 @@ impl ByteRepr for anon_5 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_3 { pub i: Value, pub inner_named: Value, @@ -198,7 +198,7 @@ impl ByteRepr for anon_3 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub named: Value, pub anon0: Value, @@ -308,7 +308,7 @@ fn main_0() -> i32 { ); return 0; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_6 { pub x: Value, pub z: Value, diff --git a/tests/unit/out/refcount/anonymous_enum.rs b/tests/unit/out/refcount/anonymous_enum.rs index 45162c8a96..ef1577e39d 100644 --- a/tests/unit/out/refcount/anonymous_enum.rs +++ b/tests/unit/out/refcount/anonymous_enum.rs @@ -12,7 +12,7 @@ pub const anon_0_FIRST_B: anon_0 = 1; pub type anon_1 = u32; pub const anon_1_SECOND_A: anon_1 = 0; pub const anon_1_SECOND_B: anon_1 = 1; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a: Value, } @@ -44,7 +44,7 @@ pub const TdEnum_TD_B: TdEnum = 1; pub type anon_2 = u32; pub const anon_2_FIELD_A: anon_2 = 0; pub const anon_2_FIELD_B: anon_2 = 1; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct WithAnonField { pub a: Value, pub field: Value, diff --git a/tests/unit/out/refcount/anonymous_enum_c.rs b/tests/unit/out/refcount/anonymous_enum_c.rs index f525cfc252..c0585ac7ba 100644 --- a/tests/unit/out/refcount/anonymous_enum_c.rs +++ b/tests/unit/out/refcount/anonymous_enum_c.rs @@ -12,7 +12,7 @@ pub const anon_0_FIRST_B: anon_0 = 1; pub type anon_1 = u32; pub const anon_1_SECOND_A: anon_1 = 0; pub const anon_1_SECOND_B: anon_1 = 1; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a: Value, } @@ -42,7 +42,7 @@ pub const TdEnum_enum_TD_B: TdEnum_enum = 1; pub type anon_2 = u32; pub const anon_2_FIELD_A: anon_2 = 0; pub const anon_2_FIELD_B: anon_2 = 1; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct WithAnonField { pub a: Value, pub field: Value, diff --git a/tests/unit/out/refcount/array_const_init.rs b/tests/unit/out/refcount/array_const_init.rs index 01364f981b..d933ef8d34 100644 --- a/tests/unit/out/refcount/array_const_init.rs +++ b/tests/unit/out/refcount/array_const_init.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S { pub head: Value, pub tail: Value>, diff --git a/tests/unit/out/refcount/array_of_noncopy_struct.rs b/tests/unit/out/refcount/array_of_noncopy_struct.rs index 5225d1301e..8a4780593f 100644 --- a/tests/unit/out/refcount/array_of_noncopy_struct.rs +++ b/tests/unit/out/refcount/array_of_noncopy_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct NonCopy { pub data: Value>, pub tag: Value, diff --git a/tests/unit/out/refcount/array_reference.rs b/tests/unit/out/refcount/array_reference.rs index b0fad6a891..26b9148ffd 100644 --- a/tests/unit/out/refcount/array_reference.rs +++ b/tests/unit/out/refcount/array_reference.rs @@ -70,7 +70,7 @@ pub fn fill_and_sum_9(a: Ptr, v: i32, out: Ptr) { pub fn pick_10(s: Ptr) -> Ptr { return ((s).clone() as Ptr); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/as_const.rs b/tests/unit/out/refcount/as_const.rs index a081a47253..6a9e7e24da 100644 --- a/tests/unit/out/refcount/as_const.rs +++ b/tests/unit/out/refcount/as_const.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; pub type Overload = u32; pub const Overload_kMutableOverload: Overload = 1; pub const Overload_kConstOverload: Overload = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/bounded_struct_ptr.rs b/tests/unit/out/refcount/bounded_struct_ptr.rs index f7a35b3e0e..eb7dceda31 100644 --- a/tests/unit/out/refcount/bounded_struct_ptr.rs +++ b/tests/unit/out/refcount/bounded_struct_ptr.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Foo { pub x1: Value, pub x2: Value, diff --git a/tests/unit/out/refcount/bst.rs b/tests/unit/out/refcount/bst.rs index 8a36763d0a..f12b99ae59 100644 --- a/tests/unit/out/refcount/bst.rs +++ b/tests/unit/out/refcount/bst.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node_t { pub left: Value>, pub right: Value>, diff --git a/tests/unit/out/refcount/c_struct.rs b/tests/unit/out/refcount/c_struct.rs index 846635164c..9899c832c5 100644 --- a/tests/unit/out/refcount/c_struct.rs +++ b/tests/unit/out/refcount/c_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, @@ -34,7 +34,7 @@ impl ByteRepr for Point { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Line { pub start: Value, pub end: Value, @@ -62,7 +62,7 @@ impl ByteRepr for Line { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Node { pub value: Value, pub next: Value>, @@ -94,7 +94,7 @@ pub type Color = u32; pub const Color_RED: Color = 0; pub const Color_GREEN: Color = 1; pub const Color_BLUE: Color = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub a: Value, pub b: Value, @@ -122,7 +122,7 @@ impl ByteRepr for Inner { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Container { pub inner: Value, pub color: Value, diff --git a/tests/unit/out/refcount/class.rs b/tests/unit/out/refcount/class.rs index 68387df4fc..631329eb81 100644 --- a/tests/unit/out/refcount/class.rs +++ b/tests/unit/out/refcount/class.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub first: Value, pub second: Value, @@ -36,7 +36,7 @@ impl ByteRepr for Pair { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Route { pub path: Value, pub cost: Value, @@ -66,7 +66,7 @@ impl ByteRepr for Route { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Counter { pub v: Value, pub calls: Value, diff --git a/tests/unit/out/refcount/class_template_lazy_member.rs b/tests/unit/out/refcount/class_template_lazy_member.rs index 597f27eacb..bb71ef5cc9 100644 --- a/tests/unit/out/refcount/class_template_lazy_member.rs +++ b/tests/unit/out/refcount/class_template_lazy_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Point { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Box_int_ { pub val: Value, } @@ -58,7 +58,7 @@ impl ByteRepr for Box_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Box_Point_ { pub val: Value, } diff --git a/tests/unit/out/refcount/class_templates.rs b/tests/unit/out/refcount/class_templates.rs index 051103850a..c06f12501e 100644 --- a/tests/unit/out/refcount/class_templates.rs +++ b/tests/unit/out/refcount/class_templates.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct MyContainer_int_ { vec_: Value>, } @@ -32,7 +32,7 @@ impl ByteRepr for MyContainer_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct MyContainer_char_ { vec_: Value>, } @@ -58,7 +58,7 @@ impl ByteRepr for MyContainer_char_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct MyContainer_float_ { vec_: Value>, } @@ -84,7 +84,7 @@ impl ByteRepr for MyContainer_float_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Boxed_int_ { pub value: Value, } @@ -116,7 +116,7 @@ impl ByteRepr for Boxed_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Boxed_long_ { pub value: Value, } @@ -148,7 +148,7 @@ impl ByteRepr for Boxed_long_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_int__Inner_int_ { pub t: Value, pub u: Value, @@ -178,7 +178,7 @@ impl ByteRepr for Outer_int__Inner_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_int_ { pub v: Value, } @@ -204,7 +204,7 @@ impl ByteRepr for Outer_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_long__Inner_int_ { pub t: Value, pub u: Value, @@ -234,7 +234,7 @@ impl ByteRepr for Outer_long__Inner_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_long__Inner_char_ { pub t: Value, pub u: Value, @@ -264,7 +264,7 @@ impl ByteRepr for Outer_long__Inner_char_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_long_ { pub v: Value, } diff --git a/tests/unit/out/refcount/clone_vs_move.rs b/tests/unit/out/refcount/clone_vs_move.rs index e4a46b0817..f5377c3180 100644 --- a/tests/unit/out/refcount/clone_vs_move.rs +++ b/tests/unit/out/refcount/clone_vs_move.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Bar { pub w: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Bar { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Foo { pub x: Value, pub y: Ptr, @@ -67,7 +67,7 @@ impl Default for Foo { } } impl ByteRepr for Foo {} -#[derive(Clone, Default)] +#[derive(Clone, VaArg, FnPtrArg, Default)] pub struct Refs { pub a: Ptr, pub b: Ptr, diff --git a/tests/unit/out/refcount/complex_function.rs b/tests/unit/out/refcount/complex_function.rs index 7ecac949a6..77393c257a 100644 --- a/tests/unit/out/refcount/complex_function.rs +++ b/tests/unit/out/refcount/complex_function.rs @@ -17,7 +17,7 @@ pub fn ptr_1(x: Ptr) -> Ptr { pub fn bar_2(x: Ptr) -> Ptr { return (x).clone(); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct X1 { pub v: Value, } @@ -43,12 +43,12 @@ impl ByteRepr for X1 { } } } -#[derive(Clone, Default)] +#[derive(Clone, VaArg, FnPtrArg, Default)] pub struct X2 { pub v: Ptr, } impl ByteRepr for X2 {} -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct X3 { pub v: Value>, } @@ -74,7 +74,7 @@ impl ByteRepr for X3 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct X4 { pub v: Value, } diff --git a/tests/unit/out/refcount/compound_assign_paren.rs b/tests/unit/out/refcount/compound_assign_paren.rs index b70abcde74..7dbe5c4dd0 100644 --- a/tests/unit/out/refcount/compound_assign_paren.rs +++ b/tests/unit/out/refcount/compound_assign_paren.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Item { pub flags: Value, } diff --git a/tests/unit/out/refcount/concepts.rs b/tests/unit/out/refcount/concepts.rs index 42486c5961..efe5a35a52 100644 --- a/tests/unit/out/refcount/concepts.rs +++ b/tests/unit/out/refcount/concepts.rs @@ -11,7 +11,7 @@ const _: () = assert!( (::std::mem::size_of::() == 4_usize), "sizeof(int) == 4" ); -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Sized {} pub fn is_small_0() -> bool { return true; diff --git a/tests/unit/out/refcount/constexpr_function.rs b/tests/unit/out/refcount/constexpr_function.rs index 0c0c754328..f42be24c16 100644 --- a/tests/unit/out/refcount/constexpr_function.rs +++ b/tests/unit/out/refcount/constexpr_function.rs @@ -25,7 +25,7 @@ pub fn half_3(x: f64) -> f64 { let x: Value = Rc::new(RefCell::new(x)); return ((*x.borrow()) / 2.0E+0); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Flag { pub v: Value, } @@ -61,7 +61,7 @@ pub fn checked_5(x: i32) -> i32 { assert!(((*x.borrow()) > 0)); return ((*x.borrow()) + 1); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct P { pub v: Value, } diff --git a/tests/unit/out/refcount/constructor.rs b/tests/unit/out/refcount/constructor.rs index 0696f4f000..c56a9a5efb 100644 --- a/tests/unit/out/refcount/constructor.rs +++ b/tests/unit/out/refcount/constructor.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; thread_local!( pub static total_0: Value = Rc::new(RefCell::new(0)); ); -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } @@ -47,7 +47,7 @@ impl ByteRepr for S { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/copy_assign.rs b/tests/unit/out/refcount/copy_assign.rs index cbd671506f..97c442440a 100644 --- a/tests/unit/out/refcount/copy_assign.rs +++ b/tests/unit/out/refcount/copy_assign.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; thread_local!( pub static assigns_0: Value = Rc::new(RefCell::new(0)); ); -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Partial { pub v: Value, pub keep: Value, @@ -58,7 +58,7 @@ impl ByteRepr for Partial { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct NonConstAssign { pub mark: Value, } @@ -98,7 +98,7 @@ impl ByteRepr for NonConstAssign { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct RefQualified { pub mark: Value, } @@ -138,7 +138,7 @@ impl ByteRepr for RefQualified { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Holder { pub p: Value, pub arr: Value>, diff --git a/tests/unit/out/refcount/copy_ctor.rs b/tests/unit/out/refcount/copy_ctor.rs index 9acd7dd092..d86b532a83 100644 --- a/tests/unit/out/refcount/copy_ctor.rs +++ b/tests/unit/out/refcount/copy_ctor.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; thread_local!( pub static copies_0: Value = Rc::new(RefCell::new(0)); ); -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Counted { pub v: Value, } @@ -50,7 +50,7 @@ impl ByteRepr for Counted { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct NonConst { pub mark: Value, } @@ -103,7 +103,7 @@ impl ByteRepr for NonConst { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Ignored { pub v: Value, } @@ -144,7 +144,7 @@ impl ByteRepr for Ignored { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Holder { pub c: Value, pub arr: Value>, diff --git a/tests/unit/out/refcount/copy_move_defaulted.rs b/tests/unit/out/refcount/copy_move_defaulted.rs index 93bf04b711..6e2eec4916 100644 --- a/tests/unit/out/refcount/copy_move_defaulted.rs +++ b/tests/unit/out/refcount/copy_move_defaulted.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub x: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Inner { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Explicit { pub v: Value, pub inner: Value, @@ -91,7 +91,7 @@ impl ByteRepr for Explicit { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Implicit { pub v: Value, pub inner: Value, @@ -136,7 +136,7 @@ impl ByteRepr for Implicit { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct DefaultCopyUserMove { pub v: Value, } @@ -180,7 +180,7 @@ impl ByteRepr for DefaultCopyUserMove { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct UserCopyDefaultMove { pub v: Value, } diff --git a/tests/unit/out/refcount/default.rs b/tests/unit/out/refcount/default.rs index c0a637859e..8a5ccc5ff9 100644 --- a/tests/unit/out/refcount/default.rs +++ b/tests/unit/out/refcount/default.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Pointers { pub x1: Value>, pub x2: Value>, diff --git a/tests/unit/out/refcount/default_function_arguments.rs b/tests/unit/out/refcount/default_function_arguments.rs index 8f0f50edd1..f4ef733073 100644 --- a/tests/unit/out/refcount/default_function_arguments.rs +++ b/tests/unit/out/refcount/default_function_arguments.rs @@ -19,7 +19,7 @@ pub fn baz_1(a: Ptr, b: Option>) -> bool { _lhs == (*b.borrow()).clone() }; } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Bar { pub v: Value, } diff --git a/tests/unit/out/refcount/default_in_statics.rs b/tests/unit/out/refcount/default_in_statics.rs index 6928ef35ad..0e775c0bd3 100644 --- a/tests/unit/out/refcount/default_in_statics.rs +++ b/tests/unit/out/refcount/default_in_statics.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub v: Value, pub name: Value>, @@ -36,7 +36,7 @@ impl ByteRepr for Inner { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Outer { pub p1: Value>, pub p2: Value>, @@ -112,7 +112,7 @@ impl ByteRepr for Outer { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Foo { pub s1: Value>, pub s2: Value>, diff --git a/tests/unit/out/refcount/destructor.rs b/tests/unit/out/refcount/destructor.rs index 140b2f282d..0f9ac673fe 100644 --- a/tests/unit/out/refcount/destructor.rs +++ b/tests/unit/out/refcount/destructor.rs @@ -9,9 +9,9 @@ use std::rc::{Rc, Weak}; thread_local!( pub static global_0: Value = Rc::new(RefCell::new(0)); ); -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct S {} -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Defaulted { pub s: Value, } @@ -37,7 +37,7 @@ impl ByteRepr for Defaulted { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Middle { pub s: Value, } @@ -63,7 +63,7 @@ impl ByteRepr for Middle { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub m: Value, } @@ -89,7 +89,7 @@ impl ByteRepr for Outer { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct ArrayMember { pub items: Value>, } @@ -126,7 +126,7 @@ impl ByteRepr for ArrayMember { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct EmptyBody { pub s: Value, } @@ -152,7 +152,7 @@ impl ByteRepr for EmptyBody { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Templated_char_ { pub v: Value, } @@ -178,7 +178,7 @@ impl ByteRepr for Templated_char_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Templated_int_ { pub v: Value, } @@ -204,7 +204,7 @@ impl ByteRepr for Templated_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Copied { pub v: Value, } @@ -237,7 +237,7 @@ thread_local!( thread_local!( pub static order_count_2: Value = Rc::new(RefCell::new(0)); ); -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tagged { pub tag: Value, } @@ -263,7 +263,7 @@ impl ByteRepr for Tagged { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Ordered { pub first: Value, pub dummy1: Value, diff --git a/tests/unit/out/refcount/doubly_linked_list.rs b/tests/unit/out/refcount/doubly_linked_list.rs index bb37a92591..4e61a525e6 100644 --- a/tests/unit/out/refcount/doubly_linked_list.rs +++ b/tests/unit/out/refcount/doubly_linked_list.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Node { pub val: Value, pub next: Value>, diff --git a/tests/unit/out/refcount/enum_default_in_static.rs b/tests/unit/out/refcount/enum_default_in_static.rs index a33c8fb893..abb2af13fc 100644 --- a/tests/unit/out/refcount/enum_default_in_static.rs +++ b/tests/unit/out/refcount/enum_default_in_static.rs @@ -10,7 +10,7 @@ pub type Mode = u32; pub const Mode_MODE_NONE: Mode = 0; pub const Mode_MODE_ONE: Mode = 1; pub const Mode_MODE_TWO: Mode = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Config { pub count: Value, pub mode: Value, diff --git a/tests/unit/out/refcount/enum_int_interop.rs b/tests/unit/out/refcount/enum_int_interop.rs index d4a71b1179..6c00eff4d9 100644 --- a/tests/unit/out/refcount/enum_int_interop.rs +++ b/tests/unit/out/refcount/enum_int_interop.rs @@ -19,7 +19,7 @@ pub type Tag = u32; pub const Tag_TAG_ZERO: Tag = 0; pub const Tag_TAG_ONE: Tag = 1; pub const Tag_TAG_TWO: Tag = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Entry { pub name: Value>, pub color: Value, diff --git a/tests/unit/out/refcount/enum_int_interop_c.rs b/tests/unit/out/refcount/enum_int_interop_c.rs index 2865040c34..f9b88a9921 100644 --- a/tests/unit/out/refcount/enum_int_interop_c.rs +++ b/tests/unit/out/refcount/enum_int_interop_c.rs @@ -19,7 +19,7 @@ pub type Tag_enum = u32; pub const Tag_enum_TAG_ZERO: Tag_enum = 0; pub const Tag_enum_TAG_ONE: Tag_enum = 1; pub const Tag_enum_TAG_TWO: Tag_enum = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Entry { pub name: Value>, pub color: Value, diff --git a/tests/unit/out/refcount/exprs.rs b/tests/unit/out/refcount/exprs.rs index 98a0a67788..ecf37c6f23 100644 --- a/tests/unit/out/refcount/exprs.rs +++ b/tests/unit/out/refcount/exprs.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct X { pub x: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for X { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Y { pub x: Value, pub p: Value>, diff --git a/tests/unit/out/refcount/fft.rs b/tests/unit/out/refcount/fft.rs index 09ee323ffe..981918a571 100644 --- a/tests/unit/out/refcount/fft.rs +++ b/tests/unit/out/refcount/fft.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Complex { pub re: Value, pub img: Value, diff --git a/tests/unit/out/refcount/fn_ptr_cast.rs b/tests/unit/out/refcount/fn_ptr_cast.rs index d591adc1ad..0451f4b740 100644 --- a/tests/unit/out/refcount/fn_ptr_cast.rs +++ b/tests/unit/out/refcount/fn_ptr_cast.rs @@ -36,7 +36,7 @@ pub fn test_double_cast_2() { _lhs == (*fn_.borrow()).clone() }); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Command { pub data: Value, } diff --git a/tests/unit/out/refcount/fn_ptr_stable_sort.rs b/tests/unit/out/refcount/fn_ptr_stable_sort.rs index b84c69b1d6..fe8d3ce96a 100644 --- a/tests/unit/out/refcount/fn_ptr_stable_sort.rs +++ b/tests/unit/out/refcount/fn_ptr_stable_sort.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Item { pub key: Value, pub value: Value, diff --git a/tests/unit/out/refcount/fn_ptr_struct.rs b/tests/unit/out/refcount/fn_ptr_struct.rs index 7ec553f469..68c73955b8 100644 --- a/tests/unit/out/refcount/fn_ptr_struct.rs +++ b/tests/unit/out/refcount/fn_ptr_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Handler { pub tag: Value, pub cb: Value i32>>, @@ -54,7 +54,7 @@ pub fn negate_1(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); return -(*x.borrow()); } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct S {} impl S { pub fn pick_i32(x: i32) -> i32 { diff --git a/tests/unit/out/refcount/fn_ptr_typedef_cast.rs b/tests/unit/out/refcount/fn_ptr_typedef_cast.rs index be6434ca1d..87a4de20d3 100644 --- a/tests/unit/out/refcount/fn_ptr_typedef_cast.rs +++ b/tests/unit/out/refcount/fn_ptr_typedef_cast.rs @@ -22,6 +22,48 @@ pub fn via_size_t_return_3(b: u64) -> usize { let b: Value = Rc::new(RefCell::new(b)); return ((*b.borrow()) as usize); } +#[derive(VaArg, FnPtrArg, Default)] +pub struct pair { + pub a: Value, + pub b: Value, +} +impl Clone for pair { + fn clone(&self) -> Self { + Self { + a: Rc::new(RefCell::new((*self.a.borrow()).clone())), + b: Rc::new(RefCell::new((*self.b.borrow()).clone())), + } + } +} +impl ByteRepr for pair { + fn byte_size() -> usize { + 8 + } + fn to_bytes(&self, buf: &mut [u8]) { + (*self.a.borrow()).to_bytes(&mut buf[0..4]); + (*self.b.borrow()).to_bytes(&mut buf[4..8]); + } + fn from_bytes(buf: &[u8]) -> Self { + Self { + a: Rc::new(RefCell::new(::from_bytes(&buf[0..4]))), + b: Rc::new(RefCell::new(::from_bytes(&buf[4..8]))), + } + } +} +pub fn pair_scaled_4(p: pair, n: usize) -> u64 { + let p: Value = Rc::new(RefCell::new(p)); + let n: Value = Rc::new(RefCell::new(n)); + return ((((*(*p.borrow()).a.borrow()) as usize).wrapping_mul((*n.borrow()))) + .wrapping_add(((*(*p.borrow()).b.borrow()) as usize)) as u64); +} +pub fn make_pair_5(n: usize) -> pair { + let n: Value = Rc::new(RefCell::new(n)); + let p: Value = Rc::new(RefCell::new(pair { + a: Rc::new(RefCell::new(((*n.borrow()) as i32))), + b: Rc::new(RefCell::new((((*n.borrow()) as i32) * 2))), + })); + return (*p.borrow()).clone(); +} pub fn main() { __cpp2rust_init_globals(); std::process::exit(main_0()); @@ -62,6 +104,22 @@ fn main_0() -> i32 { != 0) ); assert!((((({ (*back.borrow()).call(5_usize,) }) == 5_u64) as i32) != 0)); + let scaled: Value u64>> = Rc::new(RefCell::new( + FnPtr:: u64>::new(pair_scaled_4).cast:: u64>(), + )); + let p: Value = Rc::new(RefCell::new(pair { + a: Rc::new(RefCell::new(3)), + b: Rc::new(RefCell::new(4)), + })); + assert!( + (((({ (*scaled.borrow()).call((*p.borrow()).clone(), 10_u64,) }) == 34_u64) as i32) != 0) + ); + let make: Value pair>> = Rc::new(RefCell::new( + FnPtr:: pair>::new(make_pair_5).cast:: pair>(), + )); + let q: Value = Rc::new(RefCell::new(({ (*make.borrow()).call(5_u64) }))); + assert!(((((*(*q.borrow()).a.borrow()) == 5) as i32) != 0)); + assert!(((((*(*q.borrow()).b.borrow()) == 10) as i32) != 0)); return 0; } pub fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/refcount/fn_ptr_vtable.rs b/tests/unit/out/refcount/fn_ptr_vtable.rs index 3a21f049c7..b59a2ffe91 100644 --- a/tests/unit/out/refcount/fn_ptr_vtable.rs +++ b/tests/unit/out/refcount/fn_ptr_vtable.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Vtable { pub create: Value AnyPtr>>, pub get: Value i32>>, diff --git a/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs b/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs index af5037f71e..21cea53496 100644 --- a/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs +++ b/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value>, pub a: Value, diff --git a/tests/unit/out/refcount/forward_basic.rs b/tests/unit/out/refcount/forward_basic.rs index 1a1009615f..a12cf9b576 100644 --- a/tests/unit/out/refcount/forward_basic.rs +++ b/tests/unit/out/refcount/forward_basic.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; pub type Overload = u32; pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tracked { pub v: Value, pub copies: Value, @@ -99,7 +99,7 @@ impl Holder { Rc::try_unwrap(__this).ok().unwrap().into_inner() } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Holder { pub t: Value, } diff --git a/tests/unit/out/refcount/forward_decltype.rs b/tests/unit/out/refcount/forward_decltype.rs index b20ec0f744..2f842846a1 100644 --- a/tests/unit/out/refcount/forward_decltype.rs +++ b/tests/unit/out/refcount/forward_decltype.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; pub type Overload = u32; pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tracked { pub v: Value, pub copies: Value, diff --git a/tests/unit/out/refcount/forward_explicit.rs b/tests/unit/out/refcount/forward_explicit.rs index 9ce59a5011..986760d87b 100644 --- a/tests/unit/out/refcount/forward_explicit.rs +++ b/tests/unit/out/refcount/forward_explicit.rs @@ -11,7 +11,7 @@ pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; pub const Overload_kIntLvalueOverload: Overload = 3; pub const Overload_kIntRvalueOverload: Overload = 4; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tracked { pub v: Value, pub copies: Value, diff --git a/tests/unit/out/refcount/forward_pack.rs b/tests/unit/out/refcount/forward_pack.rs index e09b50c547..cae97e6b47 100644 --- a/tests/unit/out/refcount/forward_pack.rs +++ b/tests/unit/out/refcount/forward_pack.rs @@ -11,7 +11,7 @@ pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; pub const Overload_kIntLvalueOverload: Overload = 3; pub const Overload_kIntRvalueOverload: Overload = 4; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tracked { pub v: Value, pub copies: Value, @@ -157,7 +157,7 @@ impl Pair { Rc::try_unwrap(__this).ok().unwrap().into_inner() } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub a: Value, pub b: Value, diff --git a/tests/unit/out/refcount/friend.rs b/tests/unit/out/refcount/friend.rs index 138afba717..35399d0f7f 100644 --- a/tests/unit/out/refcount/friend.rs +++ b/tests/unit/out/refcount/friend.rs @@ -29,7 +29,7 @@ pub fn scaled_3(v: Ptr, k: f64) -> f64 { _lhs * (*k.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct V { pub x: Value, } @@ -69,7 +69,7 @@ impl ByteRepr for V { pub fn get_4(w: Ptr) -> i32 { return (*(*w.upgrade().deref()).x.borrow()); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct W_int_ { pub x: Value, } @@ -98,7 +98,7 @@ impl ByteRepr for W_int_ { pub fn get_5(w: Ptr) -> i64 { return (*(*w.upgrade().deref()).x.borrow()); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct W_long_ { pub x: Value, } @@ -124,7 +124,7 @@ impl ByteRepr for W_long_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct D { pub x: Value, } diff --git a/tests/unit/out/refcount/function_overloading.rs b/tests/unit/out/refcount/function_overloading.rs index c9e0eef22e..0c28aa05e8 100644 --- a/tests/unit/out/refcount/function_overloading.rs +++ b/tests/unit/out/refcount/function_overloading.rs @@ -36,7 +36,7 @@ pub fn foo_3(x: Ptr, y: Ptr, z: Ptr) -> i32 { pub fn bar_4(x: Ptr) -> i32 { return (x.read()); } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Foo {} pub fn func_5(x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); diff --git a/tests/unit/out/refcount/global_init_side_effect.rs b/tests/unit/out/refcount/global_init_side_effect.rs index 274bff8281..645c771d82 100644 --- a/tests/unit/out/refcount/global_init_side_effect.rs +++ b/tests/unit/out/refcount/global_init_side_effect.rs @@ -9,7 +9,7 @@ use std::rc::{Rc, Weak}; thread_local!( pub static total_0: Value = Rc::new(RefCell::new(0)); ); -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct S {} impl S { pub fn new(x: i32) -> Self { diff --git a/tests/unit/out/refcount/global_non_const_init.rs b/tests/unit/out/refcount/global_non_const_init.rs index 18e2473632..277f5aff16 100644 --- a/tests/unit/out/refcount/global_non_const_init.rs +++ b/tests/unit/out/refcount/global_non_const_init.rs @@ -33,7 +33,7 @@ thread_local!( pub static depends_on_call_6: Value = Rc::new(RefCell::new((from_call_5.with(|rc| *rc.borrow()) + 1))); ); -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Ctor { pub v: Value, } @@ -97,7 +97,7 @@ thread_local!( thread_local!( pub static inline_member_11: Value = Rc::new(RefCell::new(Ctor::new_2({ 5 }))); ); -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Holder {} thread_local!( pub static member_10: Value = Rc::new(RefCell::new(({ next_0() }))); @@ -112,7 +112,7 @@ pub fn local_static_12() -> i32 { return (once_13.with(|rc| *rc.borrow()) + (*(*local_ctor_14.with(Value::clone).borrow()).v.borrow())); } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Singleton { pub hits: Value, } diff --git a/tests/unit/out/refcount/global_pointers.rs b/tests/unit/out/refcount/global_pointers.rs index 3829faa3ec..d5dcc4454f 100644 --- a/tests/unit/out/refcount/global_pointers.rs +++ b/tests/unit/out/refcount/global_pointers.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Entry { pub name: Value>, pub p: Value>, diff --git a/tests/unit/out/refcount/global_without_initializer.rs b/tests/unit/out/refcount/global_without_initializer.rs index c9e1219c33..38d562eb14 100644 --- a/tests/unit/out/refcount/global_without_initializer.rs +++ b/tests/unit/out/refcount/global_without_initializer.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a: Value, } diff --git a/tests/unit/out/refcount/goto_aggregate_default.rs b/tests/unit/out/refcount/goto_aggregate_default.rs index b2d21ad401..531693714e 100644 --- a/tests/unit/out/refcount/goto_aggregate_default.rs +++ b/tests/unit/out/refcount/goto_aggregate_default.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/goto_cleanup.rs b/tests/unit/out/refcount/goto_cleanup.rs index 3baa50ac56..08b5a78968 100644 --- a/tests/unit/out/refcount/goto_cleanup.rs +++ b/tests/unit/out/refcount/goto_cleanup.rs @@ -77,7 +77,7 @@ pub fn from_switch_2(n: i32) -> i32 { }); panic!("ub: non-void function does not return a value") } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct wrapper { pub item: Value>, } diff --git a/tests/unit/out/refcount/huffman.rs b/tests/unit/out/refcount/huffman.rs index e65e3f3637..ce85f61a30 100644 --- a/tests/unit/out/refcount/huffman.rs +++ b/tests/unit/out/refcount/huffman.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct MinHeapNode { pub data: Value, pub freq: Value, diff --git a/tests/unit/out/refcount/immutable-deref-on-func-call.rs b/tests/unit/out/refcount/immutable-deref-on-func-call.rs index b5136fbc4e..fc28fecf22 100644 --- a/tests/unit/out/refcount/immutable-deref-on-func-call.rs +++ b/tests/unit/out/refcount/immutable-deref-on-func-call.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Item { pub value: Value, } diff --git a/tests/unit/out/refcount/implicit_autoref.rs b/tests/unit/out/refcount/implicit_autoref.rs index 13868962e4..7ffa52b629 100644 --- a/tests/unit/out/refcount/implicit_autoref.rs +++ b/tests/unit/out/refcount/implicit_autoref.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Holder { pub v: Value>, } diff --git a/tests/unit/out/refcount/in_class_field_initializer.rs b/tests/unit/out/refcount/in_class_field_initializer.rs index e39bb56232..628f36563e 100644 --- a/tests/unit/out/refcount/in_class_field_initializer.rs +++ b/tests/unit/out/refcount/in_class_field_initializer.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Inner { pub x: Value, pub y: Value, @@ -44,7 +44,7 @@ impl ByteRepr for Inner { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S { pub a: Value, pub b: Value, @@ -92,7 +92,7 @@ impl ByteRepr for S { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Boxed_int_ { pub v: Value, pub tag: Value, diff --git a/tests/unit/out/refcount/init.rs b/tests/unit/out/refcount/init.rs index f8d165da69..8eba663076 100644 --- a/tests/unit/out/refcount/init.rs +++ b/tests/unit/out/refcount/init.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct X { pub x: Value, } diff --git a/tests/unit/out/refcount/kruskal.rs b/tests/unit/out/refcount/kruskal.rs index c0d931c3cc..091b42c117 100644 --- a/tests/unit/out/refcount/kruskal.rs +++ b/tests/unit/out/refcount/kruskal.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Edge { pub u: Value, pub v: Value, diff --git a/tests/unit/out/refcount/libc_struct_without_default.rs b/tests/unit/out/refcount/libc_struct_without_default.rs index dd6ab382d5..5b974ddb80 100644 --- a/tests/unit/out/refcount/libc_struct_without_default.rs +++ b/tests/unit/out/refcount/libc_struct_without_default.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct UserDefined { pub a: Value>, pub v: Value>, @@ -46,7 +46,7 @@ impl ByteRepr for UserDefined { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct FieldIsLibcType { pub addr: Value, } diff --git a/tests/unit/out/refcount/linked_list.rs b/tests/unit/out/refcount/linked_list.rs index 146005808c..4aeb98a6f9 100644 --- a/tests/unit/out/refcount/linked_list.rs +++ b/tests/unit/out/refcount/linked_list.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Node { pub val: Value, pub next: Value>, diff --git a/tests/unit/out/refcount/local_anon_struct_collision.rs b/tests/unit/out/refcount/local_anon_struct_collision.rs index 51deb2fcb2..5bc55b6dae 100644 --- a/tests/unit/out/refcount/local_anon_struct_collision.rs +++ b/tests/unit/out/refcount/local_anon_struct_collision.rs @@ -12,7 +12,7 @@ pub fn first_0() -> i32 { (*(*p.borrow()).y.borrow_mut()) = 2; return ((*(*p.borrow()).x.borrow()) + (*(*p.borrow()).y.borrow())); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_1 { pub x: Value, pub y: Value, @@ -46,7 +46,7 @@ pub fn second_2() -> i32 { (*(*q.borrow()).b.borrow_mut()) = 20_i64; return (((*(*q.borrow()).a.borrow()) + (*(*q.borrow()).b.borrow())) as i32); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_3 { pub a: Value, pub b: Value, diff --git a/tests/unit/out/refcount/local_record_template.rs b/tests/unit/out/refcount/local_record_template.rs index 2df7b8a86e..c8ce490fbb 100644 --- a/tests/unit/out/refcount/local_record_template.rs +++ b/tests/unit/out/refcount/local_record_template.rs @@ -40,7 +40,7 @@ pub fn wrap_10(v: i64) -> i32 { })); return ({ get_6((*l.borrow()).clone()) }); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Local_5 { pub x: Value, } @@ -66,7 +66,7 @@ impl ByteRepr for Local_5 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Local_7 { pub x: Value, } @@ -99,7 +99,7 @@ pub fn other_11() -> i32 { })); return (({ get_0((*l.borrow()).clone()) }) + ((*(*l.borrow()).y.borrow()) as i32)); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Local_1 { pub x: Value, pub y: Value, @@ -144,7 +144,7 @@ fn main_0() -> i32 { assert!((({ wrap_10(6_i64,) }) == 6)); return 0; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Local_3 { pub x: Value, } diff --git a/tests/unit/out/refcount/memcpy_struct_bytes.rs b/tests/unit/out/refcount/memcpy_struct_bytes.rs index 60dfaa5e4a..85cb492fce 100644 --- a/tests/unit/out/refcount/memcpy_struct_bytes.rs +++ b/tests/unit/out/refcount/memcpy_struct_bytes.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/memcpy_struct_struct.rs b/tests/unit/out/refcount/memcpy_struct_struct.rs index e4d725b2c6..d557c9519f 100644 --- a/tests/unit/out/refcount/memcpy_struct_struct.rs +++ b/tests/unit/out/refcount/memcpy_struct_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Entry { pub bits: Value, pub value: Value, diff --git a/tests/unit/out/refcount/move_ctor.rs b/tests/unit/out/refcount/move_ctor.rs index cbed6a2d99..041fadd051 100644 --- a/tests/unit/out/refcount/move_ctor.rs +++ b/tests/unit/out/refcount/move_ctor.rs @@ -86,7 +86,7 @@ impl ByteRepr for ConstMove { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct ThrowingMove { pub v: Value, pub copies: Value, @@ -152,7 +152,7 @@ impl ByteRepr for ThrowingMove { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct NoexceptMove { pub v: Value, pub copies: Value, diff --git a/tests/unit/out/refcount/move_this.rs b/tests/unit/out/refcount/move_this.rs index 460ba470d1..cd62f3ede7 100644 --- a/tests/unit/out/refcount/move_this.rs +++ b/tests/unit/out/refcount/move_this.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Chain { pub v: Value, } diff --git a/tests/unit/out/refcount/nested_structs.rs b/tests/unit/out/refcount/nested_structs.rs index 5fde805dee..55c110545a 100644 --- a/tests/unit/out/refcount/nested_structs.rs +++ b/tests/unit/out/refcount/nested_structs.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Level0_Level1_1_Level2_1_Level3_1 { pub x1: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Level0_Level1_1_Level2_1_Level3_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Level0_Level1_1_Level2_1_Level3_2 { pub x1: Value, pub x2: Value, @@ -62,7 +62,7 @@ impl ByteRepr for Level0_Level1_1_Level2_1_Level3_2 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Level0_Level1_1_Level2_1 { pub x1: Value, } @@ -88,7 +88,7 @@ impl ByteRepr for Level0_Level1_1_Level2_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Level0_Level1_1 { pub x1: Value, } @@ -114,7 +114,7 @@ impl ByteRepr for Level0_Level1_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Level0_Level1_2 { pub x1: Value, pub x2: Value, @@ -144,7 +144,7 @@ impl ByteRepr for Level0_Level1_2 { } } } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Level0 {} pub fn main() { __cpp2rust_init_globals(); diff --git a/tests/unit/out/refcount/new.rs b/tests/unit/out/refcount/new.rs index bc25b52a56..dbd75e9800 100644 --- a/tests/unit/out/refcount/new.rs +++ b/tests/unit/out/refcount/new.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/new_bst.rs b/tests/unit/out/refcount/new_bst.rs index f54de07bb8..70b14cd1f7 100644 --- a/tests/unit/out/refcount/new_bst.rs +++ b/tests/unit/out/refcount/new_bst.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node_t { pub left: Value>, pub right: Value>, diff --git a/tests/unit/out/refcount/new_struct.rs b/tests/unit/out/refcount/new_struct.rs index 66a67b0837..0ee5cc018d 100644 --- a/tests/unit/out/refcount/new_struct.rs +++ b/tests/unit/out/refcount/new_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub x: Value, pub y: Value, @@ -36,7 +36,7 @@ impl ByteRepr for Pair { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Triple { pub a: Value, pub b: Value, diff --git a/tests/unit/out/refcount/offsetof.rs b/tests/unit/out/refcount/offsetof.rs index 5d3dbea996..e143c05a31 100644 --- a/tests/unit/out/refcount/offsetof.rs +++ b/tests/unit/out/refcount/offsetof.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Layout { pub a: Value, pub b: Value, @@ -40,7 +40,7 @@ impl ByteRepr for Layout { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Frame { pub tag: Value, pub body: Value>, diff --git a/tests/unit/out/refcount/opaque_forward_decl.rs b/tests/unit/out/refcount/opaque_forward_decl.rs index eccaf1602b..907c99a135 100644 --- a/tests/unit/out/refcount/opaque_forward_decl.rs +++ b/tests/unit/out/refcount/opaque_forward_decl.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct container { pub p: Value>, pub x: Value, @@ -46,6 +46,6 @@ fn main_0() -> i32 { &(*(*c.borrow()).p.borrow()); return ((*(*c.borrow()).x.borrow()) - 42); } -#[derive(Clone, Copy, Default, ByteRepr)] +#[derive(Clone, Copy, Default, ByteRepr, VaArg, FnPtrArg)] pub struct opaque; pub fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/refcount/opaque_record_copy.rs b/tests/unit/out/refcount/opaque_record_copy.rs index 1055c182df..6eb297eb3a 100644 --- a/tests/unit/out/refcount/opaque_record_copy.rs +++ b/tests/unit/out/refcount/opaque_record_copy.rs @@ -6,9 +6,9 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Probe {} -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Wrapper_Probe_ { pub base_: Value, pub tag: Value, diff --git a/tests/unit/out/refcount/opaque_then_defined.rs b/tests/unit/out/refcount/opaque_then_defined.rs index 8e4c565901..d731204bd4 100644 --- a/tests/unit/out/refcount/opaque_then_defined.rs +++ b/tests/unit/out/refcount/opaque_then_defined.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct list { pub head: Value>, pub size: Value, @@ -34,7 +34,7 @@ impl ByteRepr for list { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node { pub value: Value, pub next: Value>, diff --git a/tests/unit/out/refcount/operator_arithmetic_free.rs b/tests/unit/out/refcount/operator_arithmetic_free.rs index f36e73e57b..ce4141a69a 100644 --- a/tests/unit/out/refcount/operator_arithmetic_free.rs +++ b/tests/unit/out/refcount/operator_arithmetic_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_arithmetic_member.rs b/tests/unit/out/refcount/operator_arithmetic_member.rs index 9d4c79b5ab..dab5e6d7f9 100644 --- a/tests/unit/out/refcount/operator_arithmetic_member.rs +++ b/tests/unit/out/refcount/operator_arithmetic_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_bitwise_free.rs b/tests/unit/out/refcount/operator_bitwise_free.rs index 9a9e05310f..d480b6dd68 100644 --- a/tests/unit/out/refcount/operator_bitwise_free.rs +++ b/tests/unit/out/refcount/operator_bitwise_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_bitwise_member.rs b/tests/unit/out/refcount/operator_bitwise_member.rs index 416ac195bf..dd440b11fb 100644 --- a/tests/unit/out/refcount/operator_bitwise_member.rs +++ b/tests/unit/out/refcount/operator_bitwise_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_comparison_defaulted.rs b/tests/unit/out/refcount/operator_comparison_defaulted.rs index 9fb43e66d8..f0feb1992c 100644 --- a/tests/unit/out/refcount/operator_comparison_defaulted.rs +++ b/tests/unit/out/refcount/operator_comparison_defaulted.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Eq { pub a: Value, pub b: Value, @@ -55,7 +55,7 @@ impl ByteRepr for Eq { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Cmp { pub a: Value, pub b: Value, @@ -127,7 +127,7 @@ impl ByteRepr for Cmp { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Both { pub a: Value, } @@ -179,7 +179,7 @@ impl ByteRepr for Both { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct OrdOnly { pub a: Value, } @@ -231,7 +231,7 @@ impl ByteRepr for OrdOnly { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub x: Value, } @@ -283,7 +283,7 @@ impl ByteRepr for Inner { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub i: Value, pub y: Value, @@ -355,7 +355,7 @@ impl ByteRepr for Outer { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Secondary { pub a: Value, } @@ -407,7 +407,7 @@ impl ByteRepr for Secondary { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct PtrMember { pub p: Value>, } diff --git a/tests/unit/out/refcount/operator_comparison_free.rs b/tests/unit/out/refcount/operator_comparison_free.rs index 6e6827a073..38c9b8084e 100644 --- a/tests/unit/out/refcount/operator_comparison_free.rs +++ b/tests/unit/out/refcount/operator_comparison_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } @@ -117,7 +117,7 @@ pub fn operator_lt_7(a: i32, b: Ptr) -> bool { _lhs < (*(*b.upgrade().deref()).v.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct V { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_comparison_member.rs b/tests/unit/out/refcount/operator_comparison_member.rs index ce29724c9c..37a6b8ae48 100644 --- a/tests/unit/out/refcount/operator_comparison_member.rs +++ b/tests/unit/out/refcount/operator_comparison_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_comparison_mixed.rs b/tests/unit/out/refcount/operator_comparison_mixed.rs index 5211a616da..8e025beab2 100644 --- a/tests/unit/out/refcount/operator_comparison_mixed.rs +++ b/tests/unit/out/refcount/operator_comparison_mixed.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_compound_assignment_free.rs b/tests/unit/out/refcount/operator_compound_assignment_free.rs index 4b2fb36bb1..0cdadb5544 100644 --- a/tests/unit/out/refcount/operator_compound_assignment_free.rs +++ b/tests/unit/out/refcount/operator_compound_assignment_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_compound_assignment_member.rs b/tests/unit/out/refcount/operator_compound_assignment_member.rs index 56cd792b86..eeab33582b 100644 --- a/tests/unit/out/refcount/operator_compound_assignment_member.rs +++ b/tests/unit/out/refcount/operator_compound_assignment_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_friend.rs b/tests/unit/out/refcount/operator_friend.rs index 8a0affe884..e281fd5ba3 100644 --- a/tests/unit/out/refcount/operator_friend.rs +++ b/tests/unit/out/refcount/operator_friend.rs @@ -15,7 +15,7 @@ pub fn operator_eq_0(_a0: Ptr, _a1: Ptr) -> bool { _lhs == (*(*_a1.upgrade().deref()).b.borrow()) }); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Defaulted { pub a: Value, pub b: Value, @@ -82,7 +82,7 @@ pub fn operator_eq_2(_a0: Ptr, _a1: Ptr) -> bool { _lhs == (*(*_a1.upgrade().deref()).a.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct DefaultedOrd { pub a: Value, } @@ -154,7 +154,7 @@ pub fn operator_add_5(x: Ptr, y: Ptr) -> Inline { })), }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inline { pub a: Value, } @@ -215,7 +215,7 @@ impl ByteRepr for Inline { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct OutOfLine { pub a: Value, } @@ -283,7 +283,7 @@ pub fn operator_eq_10(x: Ptr, y: Ptr) -> bool { _lhs == (*(*y.upgrade().deref()).v.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tmpl_int_ { pub v: Value, } @@ -344,7 +344,7 @@ impl ByteRepr for Tmpl_int_ { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Tmpl_long_ { pub v: Value, } @@ -376,7 +376,7 @@ pub fn operator_eq_11(_a0: Ptr, _a1: Ptr _lhs == (*(*_a1.upgrade().deref()).v.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct TmplDefaulted_int_ { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_less_than.rs b/tests/unit/out/refcount/operator_less_than.rs index c35245a5c1..b8d964738f 100644 --- a/tests/unit/out/refcount/operator_less_than.rs +++ b/tests/unit/out/refcount/operator_less_than.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/operator_logical_free.rs b/tests/unit/out/refcount/operator_logical_free.rs index d0d64ccfc7..f07ae0d8c9 100644 --- a/tests/unit/out/refcount/operator_logical_free.rs +++ b/tests/unit/out/refcount/operator_logical_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_logical_member.rs b/tests/unit/out/refcount/operator_logical_member.rs index a5c9df5965..a4dba0a4f5 100644 --- a/tests/unit/out/refcount/operator_logical_member.rs +++ b/tests/unit/out/refcount/operator_logical_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_member_pointer_free.rs b/tests/unit/out/refcount/operator_member_pointer_free.rs index 9b6f563924..37b51dd8c0 100644 --- a/tests/unit/out/refcount/operator_member_pointer_free.rs +++ b/tests/unit/out/refcount/operator_member_pointer_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub x: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Inner { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S { pub data: Value>, pub inner: Value, diff --git a/tests/unit/out/refcount/operator_member_pointer_member.rs b/tests/unit/out/refcount/operator_member_pointer_member.rs index e4e1261441..8f223f0b18 100644 --- a/tests/unit/out/refcount/operator_member_pointer_member.rs +++ b/tests/unit/out/refcount/operator_member_pointer_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub x: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Inner { } } } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Table {} impl Table { pub fn operator_index(i: i32) -> Ptr { @@ -43,7 +43,7 @@ impl Table { thread_local!( pub static table_0: Value> = Rc::new(RefCell::new(Box::new([7, 8, 9]))); ); -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S { pub data: Value>, pub inner: Value, diff --git a/tests/unit/out/refcount/operator_other_free.rs b/tests/unit/out/refcount/operator_other_free.rs index 0d26549ee4..bf07389628 100644 --- a/tests/unit/out/refcount/operator_other_free.rs +++ b/tests/unit/out/refcount/operator_other_free.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_other_member.rs b/tests/unit/out/refcount/operator_other_member.rs index 9beb6a0a37..d400b9b20b 100644 --- a/tests/unit/out/refcount/operator_other_member.rs +++ b/tests/unit/out/refcount/operator_other_member.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Static {} impl Static { pub fn operator_call(a: i32, b: i32) -> i32 { @@ -15,7 +15,7 @@ impl Static { return ((*a.borrow()) * (*b.borrow())); } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_overloads.rs b/tests/unit/out/refcount/operator_overloads.rs index 42dd25eea8..adb81eb739 100644 --- a/tests/unit/out/refcount/operator_overloads.rs +++ b/tests/unit/out/refcount/operator_overloads.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_qualifiers.rs b/tests/unit/out/refcount/operator_qualifiers.rs index 569f3e0ec5..b5135a3c9c 100644 --- a/tests/unit/out/refcount/operator_qualifiers.rs +++ b/tests/unit/out/refcount/operator_qualifiers.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_three_way.rs b/tests/unit/out/refcount/operator_three_way.rs index 0c0801d7b8..4c15a90a4b 100644 --- a/tests/unit/out/refcount/operator_three_way.rs +++ b/tests/unit/out/refcount/operator_three_way.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub v: Value, } diff --git a/tests/unit/out/refcount/operator_traits.rs b/tests/unit/out/refcount/operator_traits.rs index 1bc3bd670e..9c6c05803b 100644 --- a/tests/unit/out/refcount/operator_traits.rs +++ b/tests/unit/out/refcount/operator_traits.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Lt { pub v: Value, } @@ -70,7 +70,7 @@ impl ByteRepr for Lt { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Eq { pub v: Value, } @@ -107,7 +107,7 @@ impl ByteRepr for Eq { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Cmp { pub v: Value, } @@ -159,7 +159,7 @@ impl ByteRepr for Cmp { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Free { pub v: Value, } @@ -232,7 +232,7 @@ pub fn operator_eq_1(a: Ptr, b: Ptr) -> bool { _lhs == (*(*b.upgrade().deref()).v.borrow()) }; } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Wrapped_int_ { pub v: Value, } diff --git a/tests/unit/out/refcount/overload_mangling.rs b/tests/unit/out/refcount/overload_mangling.rs index 9e71d3fc1d..0004911326 100644 --- a/tests/unit/out/refcount/overload_mangling.rs +++ b/tests/unit/out/refcount/overload_mangling.rs @@ -26,7 +26,7 @@ pub fn twice_2(n: i32) -> i32 { let n: Value = Rc::new(RefCell::new(n)); return ((*n.borrow()) * 2); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub base: Value, } @@ -52,7 +52,7 @@ impl ByteRepr for S { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Box { pub v: Value, } diff --git a/tests/unit/out/refcount/pod.rs b/tests/unit/out/refcount/pod.rs index 8eff4edcbd..238585b974 100644 --- a/tests/unit/out/refcount/pod.rs +++ b/tests/unit/out/refcount/pod.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct POD { pub x1: Value, pub x2: Value, diff --git a/tests/unit/out/refcount/pointer_array.rs b/tests/unit/out/refcount/pointer_array.rs index 5b57ef3a11..56033a1cf2 100644 --- a/tests/unit/out/refcount/pointer_array.rs +++ b/tests/unit/out/refcount/pointer_array.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct StackArray { pub arr: Value]>>, } diff --git a/tests/unit/out/refcount/pointers.rs b/tests/unit/out/refcount/pointers.rs index 3c1e46bc7d..ef7754079e 100644 --- a/tests/unit/out/refcount/pointers.rs +++ b/tests/unit/out/refcount/pointers.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Test { pub x: Value, } diff --git a/tests/unit/out/refcount/polymorphism.rs b/tests/unit/out/refcount/polymorphism.rs index 95559e6465..e7b9237e65 100644 --- a/tests/unit/out/refcount/polymorphism.rs +++ b/tests/unit/out/refcount/polymorphism.rs @@ -9,9 +9,9 @@ use std::rc::{Rc, Weak}; pub trait Animal { fn bark(&self) -> bool; } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Dog {} -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct Cat {} pub fn main() { __cpp2rust_init_globals(); diff --git a/tests/unit/out/refcount/ptr_cast_init.rs b/tests/unit/out/refcount/ptr_cast_init.rs index 3bad3d2990..d0c94849ce 100644 --- a/tests/unit/out/refcount/ptr_cast_init.rs +++ b/tests/unit/out/refcount/ptr_cast_init.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct header { pub tag: Value, pub size: Value, @@ -34,7 +34,7 @@ impl ByteRepr for header { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct view { pub tag: Value, } diff --git a/tests/unit/out/refcount/push_emplace_back.rs b/tests/unit/out/refcount/push_emplace_back.rs index 63b07c612c..1869e96507 100644 --- a/tests/unit/out/refcount/push_emplace_back.rs +++ b/tests/unit/out/refcount/push_emplace_back.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Chunk { pub data: Value, } @@ -32,7 +32,7 @@ impl ByteRepr for Chunk { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Writer { pub output: Value>>, pub chunk: Value, @@ -62,7 +62,7 @@ impl ByteRepr for Writer { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct JPEGData { pub com_data: Value>>>, pub app_data: Value>>>, @@ -187,7 +187,7 @@ pub fn self_ref_push_6(comps: Ptr>) { (*comps.borrow()).with_mut(|__v: &mut Vec| __v.push(a0_clone)) }; } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Pair { pub first: Value, pub second: Value, diff --git a/tests/unit/out/refcount/random.rs b/tests/unit/out/refcount/random.rs index 387f9fede5..42b4e5b2fd 100644 --- a/tests/unit/out/refcount/random.rs +++ b/tests/unit/out/refcount/random.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Pair { pub x: Value, pub y: Value, @@ -56,7 +56,7 @@ impl ByteRepr for Pair {} pub fn zero_0() -> i32 { return 0; } -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct X1 {} pub fn foo_1(x1: i32, x2: Ptr, x3: Ptr, p2: Ptr, p3: Ptr) { let x1: Value = Rc::new(RefCell::new(x1)); diff --git a/tests/unit/out/refcount/reference_wrapper.rs b/tests/unit/out/refcount/reference_wrapper.rs index 0def293222..d3d64d1e1a 100644 --- a/tests/unit/out/refcount/reference_wrapper.rs +++ b/tests/unit/out/refcount/reference_wrapper.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/refs_as_args.rs b/tests/unit/out/refcount/refs_as_args.rs index 43edc9a442..644cd1e18b 100644 --- a/tests/unit/out/refcount/refs_as_args.rs +++ b/tests/unit/out/refcount/refs_as_args.rs @@ -42,7 +42,7 @@ pub fn more_refs_0(x1: i32, x2: i32, r1: Ptr, r2: Ptr) { let __rhs = (rx2.read()); r1.write(__rhs); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Val { pub x: Value, } diff --git a/tests/unit/out/refcount/reinterpret_cast_struct.rs b/tests/unit/out/refcount/reinterpret_cast_struct.rs index f0263990e1..3434b3b893 100644 --- a/tests/unit/out/refcount/reinterpret_cast_struct.rs +++ b/tests/unit/out/refcount/reinterpret_cast_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/reinterpret_cast_struct_to_struct.rs b/tests/unit/out/refcount/reinterpret_cast_struct_to_struct.rs index 0673e8555f..8f3133966e 100644 --- a/tests/unit/out/refcount/reinterpret_cast_struct_to_struct.rs +++ b/tests/unit/out/refcount/reinterpret_cast_struct_to_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, @@ -36,7 +36,7 @@ impl ByteRepr for Point { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub first: Value, pub second: Value, diff --git a/tests/unit/out/refcount/reserved_keywords.rs b/tests/unit/out/refcount/reserved_keywords.rs index e8feeecec0..b258af429d 100644 --- a/tests/unit/out/refcount/reserved_keywords.rs +++ b/tests/unit/out/refcount/reserved_keywords.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub as_: Value, pub async_: Value, diff --git a/tests/unit/out/refcount/rule_of_five.rs b/tests/unit/out/refcount/rule_of_five.rs index 62e98de30e..9cc02017ca 100644 --- a/tests/unit/out/refcount/rule_of_five.rs +++ b/tests/unit/out/refcount/rule_of_five.rs @@ -15,7 +15,7 @@ thread_local!( thread_local!( pub static moves_2: Value = Rc::new(RefCell::new(0)); ); -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Buffer { pub data: Value>, pub size: Value, diff --git a/tests/unit/out/refcount/rule_of_three.rs b/tests/unit/out/refcount/rule_of_three.rs index 189cc33534..90c903ec38 100644 --- a/tests/unit/out/refcount/rule_of_three.rs +++ b/tests/unit/out/refcount/rule_of_three.rs @@ -12,7 +12,7 @@ thread_local!( thread_local!( pub static copies_1: Value = Rc::new(RefCell::new(0)); ); -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct Buffer { pub data: Value>, pub size: Value, diff --git a/tests/unit/out/refcount/rvalue_struct.rs b/tests/unit/out/refcount/rvalue_struct.rs index 4736b16099..2939fd48a0 100644 --- a/tests/unit/out/refcount/rvalue_struct.rs +++ b/tests/unit/out/refcount/rvalue_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a: Value, pub b: Value, diff --git a/tests/unit/out/refcount/scalar_builtin_construct_destruct.rs b/tests/unit/out/refcount/scalar_builtin_construct_destruct.rs index 33afac2a28..41b34e53f1 100644 --- a/tests/unit/out/refcount/scalar_builtin_construct_destruct.rs +++ b/tests/unit/out/refcount/scalar_builtin_construct_destruct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pod { pub v: Value, } diff --git a/tests/unit/out/refcount/static_var_in_class.rs b/tests/unit/out/refcount/static_var_in_class.rs index b17ef61e60..3e3871e1df 100644 --- a/tests/unit/out/refcount/static_var_in_class.rs +++ b/tests/unit/out/refcount/static_var_in_class.rs @@ -9,14 +9,14 @@ use std::rc::{Rc, Weak}; thread_local!( static inner_const_0: Value = Rc::new(RefCell::new(1)); ); -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct C {} thread_local!( pub static inner_const_1: Value = Rc::new(RefCell::new(2)); ); pub type anon_3 = u32; pub const anon_3_kValue: anon_3 = 3; -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct S {} impl S { pub fn f() -> i32 { diff --git a/tests/unit/out/refcount/strdup.rs b/tests/unit/out/refcount/strdup.rs index 70a4dbde4f..767036ab46 100644 --- a/tests/unit/out/refcount/strdup.rs +++ b/tests/unit/out/refcount/strdup.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct record { pub name: Value>, } diff --git a/tests/unit/out/refcount/string_literal_ptr_init.rs b/tests/unit/out/refcount/string_literal_ptr_init.rs index 92f340be7e..1cfd1c6eb7 100644 --- a/tests/unit/out/refcount/string_literal_ptr_init.rs +++ b/tests/unit/out/refcount/string_literal_ptr_init.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct label { pub name: Value>, pub probe: Value i32>>, diff --git a/tests/unit/out/refcount/struct_ctor.rs b/tests/unit/out/refcount/struct_ctor.rs index 4df61ad794..7239026f11 100644 --- a/tests/unit/out/refcount/struct_ctor.rs +++ b/tests/unit/out/refcount/struct_ctor.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct StructWithCtor { x1_: Value, x2_: Value, diff --git a/tests/unit/out/refcount/struct_default_ctor.rs b/tests/unit/out/refcount/struct_default_ctor.rs index c6545c112f..8fa090ba96 100644 --- a/tests/unit/out/refcount/struct_default_ctor.rs +++ b/tests/unit/out/refcount/struct_default_ctor.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct S { pub a: Value, pub b: Value, @@ -51,7 +51,7 @@ impl ByteRepr for S { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Declared { pub v: Value, } diff --git a/tests/unit/out/refcount/struct_ptr.rs b/tests/unit/out/refcount/struct_ptr.rs index 799554b364..37bce055e4 100644 --- a/tests/unit/out/refcount/struct_ptr.rs +++ b/tests/unit/out/refcount/struct_ptr.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct XX { pub x: Value, } diff --git a/tests/unit/out/refcount/tag_vs_identifier_collision.rs b/tests/unit/out/refcount/tag_vs_identifier_collision.rs index 74eea3b775..53a717fe08 100644 --- a/tests/unit/out/refcount/tag_vs_identifier_collision.rs +++ b/tests/unit/out/refcount/tag_vs_identifier_collision.rs @@ -10,7 +10,7 @@ pub type widget_enum = u32; pub const widget_enum_MODE_IDLE: widget_enum = 0; pub const widget_enum_MODE_ACTIVE: widget_enum = 1; pub const widget_enum_MODE_DONE: widget_enum = 2; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct widget { pub id: Value, pub mode: Value, @@ -38,7 +38,7 @@ impl ByteRepr for widget { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct point_struct { pub x: Value, pub y: Value, @@ -145,7 +145,7 @@ impl ByteRepr for slot_union { pub type slot = u32; pub const slot_SLOT_A: slot = 0; pub const slot_SLOT_B: slot = 1; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub tag_field: Value, } @@ -169,7 +169,7 @@ impl ByteRepr for Inner { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub field: Value, } @@ -193,7 +193,7 @@ impl ByteRepr for Outer { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner_struct { pub typedef_field: Value, } diff --git a/tests/unit/out/refcount/template_default_arg.rs b/tests/unit/out/refcount/template_default_arg.rs index a2942c67a4..9f1d86173f 100644 --- a/tests/unit/out/refcount/template_default_arg.rs +++ b/tests/unit/out/refcount/template_default_arg.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct A { pub v: Value, } @@ -54,7 +54,7 @@ impl ByteRepr for A { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct B { pub v: Value, } @@ -94,7 +94,7 @@ impl ByteRepr for B { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct NoDefault { pub v: Value, } @@ -147,7 +147,7 @@ pub fn always_given_3(x: NoDefault) -> i32 { let x: Value = Rc::new(RefCell::new(x)); return (*(*x.borrow()).v.borrow()); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S_NoDefault_ { pub v: Value, } diff --git a/tests/unit/out/refcount/this.rs b/tests/unit/out/refcount/this.rs index 6890977b5f..bd26de3f9a 100644 --- a/tests/unit/out/refcount/this.rs +++ b/tests/unit/out/refcount/this.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub a_: Value, pub self__: Value>, @@ -79,7 +79,7 @@ pub fn bump_0(p: Ptr) { let p: Value> = Rc::new(RefCell::new(p)); (*(*(*p.borrow()).upgrade().deref()).a_.borrow_mut()).postfix_inc(); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct D { pub a_: Value, } diff --git a/tests/unit/out/refcount/typedef-anon-struct.rs b/tests/unit/out/refcount/typedef-anon-struct.rs index 8f5f1ce8d2..7b54b5ad37 100644 --- a/tests/unit/out/refcount/typedef-anon-struct.rs +++ b/tests/unit/out/refcount/typedef-anon-struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer_RunInfo { pub block_idx: Value, pub num_extra_zero_runs: Value, @@ -36,7 +36,7 @@ impl ByteRepr for Outer_RunInfo { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub runs: Value>, } diff --git a/tests/unit/out/refcount/unary_expr_or_type_trait.rs b/tests/unit/out/refcount/unary_expr_or_type_trait.rs index bdd40b6c05..b15e7e241b 100644 --- a/tests/unit/out/refcount/unary_expr_or_type_trait.rs +++ b/tests/unit/out/refcount/unary_expr_or_type_trait.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct S { pub c: Value, pub x: Value, diff --git a/tests/unit/out/refcount/union_addrof_external.rs b/tests/unit/out/refcount/union_addrof_external.rs index 60fa4578f8..5995c26d31 100644 --- a/tests/unit/out/refcount/union_addrof_external.rs +++ b/tests/unit/out/refcount/union_addrof_external.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct record { pub code: Value, pub lo: Value, @@ -90,7 +90,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Container { pub view: Value, } diff --git a/tests/unit/out/refcount/union_cross_arm_cast.rs b/tests/unit/out/refcount/union_cross_arm_cast.rs index ab8974a592..fb95449621 100644 --- a/tests/unit/out/refcount/union_cross_arm_cast.rs +++ b/tests/unit/out/refcount/union_cross_arm_cast.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct shape_a { pub code: Value, pub pad: Value>, @@ -42,7 +42,7 @@ impl ByteRepr for shape_a { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct shape_b { pub code: Value, pub lo: Value, @@ -134,7 +134,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Container { pub len: Value, pub u: Value, diff --git a/tests/unit/out/refcount/union_field_alignment.rs b/tests/unit/out/refcount/union_field_alignment.rs index 78f6a0af37..a88b6f1d4a 100644 --- a/tests/unit/out/refcount/union_field_alignment.rs +++ b/tests/unit/out/refcount/union_field_alignment.rs @@ -44,7 +44,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node { pub next: Value>, pub x: Value, diff --git a/tests/unit/out/refcount/union_flex_array_member.rs b/tests/unit/out/refcount/union_flex_array_member.rs index eb2db7490d..6ff6c49c65 100644 --- a/tests/unit/out/refcount/union_flex_array_member.rs +++ b/tests/unit/out/refcount/union_flex_array_member.rs @@ -44,7 +44,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node { pub len: Value, pub pos: Value, diff --git a/tests/unit/out/refcount/union_memset_memcpy.rs b/tests/unit/out/refcount/union_memset_memcpy.rs index b5760a4a25..03dc4fb401 100644 --- a/tests/unit/out/refcount/union_memset_memcpy.rs +++ b/tests/unit/out/refcount/union_memset_memcpy.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct shape_a { pub code: Value, pub pad: Value>, @@ -42,7 +42,7 @@ impl ByteRepr for shape_a { } } } -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct shape_b { pub code: Value, pub lo: Value, @@ -129,7 +129,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Container { pub view: Value, } diff --git a/tests/unit/out/refcount/union_nested.rs b/tests/unit/out/refcount/union_nested.rs index 49e197d681..163a7a2bc6 100644 --- a/tests/unit/out/refcount/union_nested.rs +++ b/tests/unit/out/refcount/union_nested.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive()] +#[derive(VaArg, FnPtrArg)] pub struct record { pub code: Value, pub pad: Value>, @@ -80,7 +80,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct inner { pub view: Value, } @@ -142,7 +142,7 @@ impl ByteRepr for anon_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub kind: Value, pub level: Value, diff --git a/tests/unit/out/refcount/union_pointer_pun_address.rs b/tests/unit/out/refcount/union_pointer_pun_address.rs index b1fbf8bb41..9bf72f73c6 100644 --- a/tests/unit/out/refcount/union_pointer_pun_address.rs +++ b/tests/unit/out/refcount/union_pointer_pun_address.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node_a { pub n: Value, } @@ -30,7 +30,7 @@ impl ByteRepr for node_a { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node_b { pub data: Value, pub next: Value>, diff --git a/tests/unit/out/refcount/union_struct_dual_use.rs b/tests/unit/out/refcount/union_struct_dual_use.rs index 34d05eff02..c90bf3ad88 100644 --- a/tests/unit/out/refcount/union_struct_dual_use.rs +++ b/tests/unit/out/refcount/union_struct_dual_use.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub a: Value, pub b: Value, @@ -79,7 +79,7 @@ impl ByteRepr for anon_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Outer { pub u: Value, } diff --git a/tests/unit/out/refcount/union_tagged_many_arms.rs b/tests/unit/out/refcount/union_tagged_many_arms.rs index 6ded4a3201..5f33d4956c 100644 --- a/tests/unit/out/refcount/union_tagged_many_arms.rs +++ b/tests/unit/out/refcount/union_tagged_many_arms.rs @@ -59,7 +59,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Slot { pub tag: Value, pub payload: Value, diff --git a/tests/unit/out/refcount/union_tagged_simple.rs b/tests/unit/out/refcount/union_tagged_simple.rs index 48303998bf..e24df792e6 100644 --- a/tests/unit/out/refcount/union_tagged_simple.rs +++ b/tests/unit/out/refcount/union_tagged_simple.rs @@ -47,7 +47,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Event { pub kind: Value, pub handle: Value, diff --git a/tests/unit/out/refcount/union_tagged_struct_arms.rs b/tests/unit/out/refcount/union_tagged_struct_arms.rs index 3a2d418b6e..9514b8922c 100644 --- a/tests/unit/out/refcount/union_tagged_struct_arms.rs +++ b/tests/unit/out/refcount/union_tagged_struct_arms.rs @@ -10,7 +10,7 @@ pub type Choice_enum = u32; pub const Choice_enum_C_LIST: Choice_enum = 1; pub const Choice_enum_C_LETTERS: Choice_enum = 2; pub const Choice_enum_C_INTEGERS: Choice_enum = 3; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_1 { pub items: Value>>, pub count: Value, @@ -42,7 +42,7 @@ impl ByteRepr for anon_1 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_2 { pub lo: Value, pub hi: Value, @@ -78,7 +78,7 @@ impl ByteRepr for anon_2 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct anon_3 { pub lo: Value, pub hi: Value, @@ -159,7 +159,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Branch { pub choice: Value, pub index: Value, diff --git a/tests/unit/out/refcount/union_void_ptr_sized_deref.rs b/tests/unit/out/refcount/union_void_ptr_sized_deref.rs index b0fc1b0d30..b67290394a 100644 --- a/tests/unit/out/refcount/union_void_ptr_sized_deref.rs +++ b/tests/unit/out/refcount/union_void_ptr_sized_deref.rs @@ -54,7 +54,7 @@ impl ByteRepr for anon_0 { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Sink { pub width: Value, pub out: Value, diff --git a/tests/unit/out/refcount/unique_ptr.rs b/tests/unit/out/refcount/unique_ptr.rs index 31d96755ee..408cf2b9d4 100644 --- a/tests/unit/out/refcount/unique_ptr.rs +++ b/tests/unit/out/refcount/unique_ptr.rs @@ -34,7 +34,7 @@ impl ByteRepr for SafePointer { } } } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Pair { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/unique_ptr_nested.rs b/tests/unit/out/refcount/unique_ptr_nested.rs index 0aebff0444..194e275d14 100644 --- a/tests/unit/out/refcount/unique_ptr_nested.rs +++ b/tests/unit/out/refcount/unique_ptr_nested.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Inner { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/unique_ptr_struct.rs b/tests/unit/out/refcount/unique_ptr_struct.rs index b6d6798587..7f80b770f2 100644 --- a/tests/unit/out/refcount/unique_ptr_struct.rs +++ b/tests/unit/out/refcount/unique_ptr_struct.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Point { pub x: Value, pub y: Value, diff --git a/tests/unit/out/refcount/va_arg_mixed_types.rs b/tests/unit/out/refcount/va_arg_mixed_types.rs index 36e5941908..d922518067 100644 --- a/tests/unit/out/refcount/va_arg_mixed_types.rs +++ b/tests/unit/out/refcount/va_arg_mixed_types.rs @@ -6,6 +6,34 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; +#[derive(VaArg, FnPtrArg, Default)] +pub struct pair { + pub a: Value, + pub b: Value, +} +impl Clone for pair { + fn clone(&self) -> Self { + Self { + a: Rc::new(RefCell::new((*self.a.borrow()).clone())), + b: Rc::new(RefCell::new((*self.b.borrow()).clone())), + } + } +} +impl ByteRepr for pair { + fn byte_size() -> usize { + 8 + } + fn to_bytes(&self, buf: &mut [u8]) { + (*self.a.borrow()).to_bytes(&mut buf[0..4]); + (*self.b.borrow()).to_bytes(&mut buf[4..8]); + } + fn from_bytes(buf: &[u8]) -> Self { + Self { + a: Rc::new(RefCell::new(::from_bytes(&buf[0..4]))), + b: Rc::new(RefCell::new(::from_bytes(&buf[4..8]))), + } + } +} pub fn sum_mixed_0(count: i32, __args: &[VaArg]) -> i32 { let count: Value = Rc::new(RefCell::new(count)); let ap: Value = Rc::new(RefCell::new(VaList::default())); @@ -18,6 +46,9 @@ pub fn sum_mixed_0(count: i32, __args: &[VaArg]) -> i32 { (*total.borrow_mut()) += (*ap.borrow_mut()).arg::(); } else if ((((*tag.borrow()) == 1) as i32) != 0) { (*total.borrow_mut()) += ((*ap.borrow_mut()).arg::() as i32); + } else if ((((*tag.borrow()) == 3) as i32) != 0) { + let p: Value = Rc::new(RefCell::new((*ap.borrow_mut()).arg::())); + (*total.borrow_mut()) += ((*(*p.borrow()).a.borrow()) * (*(*p.borrow()).b.borrow())); } else { let val: Value = Rc::new(RefCell::new((*ap.borrow_mut()).arg::())); (*total.borrow_mut()) += ((*val.borrow()) as i32); @@ -57,6 +88,19 @@ fn main_0() -> i32 { }) == 103) as i32) != 0) ); + let p: Value = Rc::new(RefCell::new(pair { + a: Rc::new(RefCell::new(7)), + b: Rc::new(RefCell::new(8)), + })); + assert!( + (((({ + sum_mixed_0( + 2, + &[(3).into(), (*p.borrow()).into(), (0).into(), (5).into()], + ) + }) == 61) as i32) + != 0) + ); return 0; } pub fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs b/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs index 8ae87c7f05..b4a2a3f30b 100644 --- a/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs +++ b/tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct node { pub data: Value, pub next: Value>, diff --git a/tests/unit/out/refcount/va_arg_struct_ctx.rs b/tests/unit/out/refcount/va_arg_struct_ctx.rs index 6da9476395..6e398207c2 100644 --- a/tests/unit/out/refcount/va_arg_struct_ctx.rs +++ b/tests/unit/out/refcount/va_arg_struct_ctx.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct context { pub verbose: Value, pub last_error: Value, diff --git a/tests/unit/out/refcount/va_arg_void_ptr.rs b/tests/unit/out/refcount/va_arg_void_ptr.rs index 1c9fd571eb..54360faab4 100644 --- a/tests/unit/out/refcount/va_arg_void_ptr.rs +++ b/tests/unit/out/refcount/va_arg_void_ptr.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct registry { pub slot: Value, pub level: Value, diff --git a/tests/unit/out/refcount/vector_with_allocator.rs b/tests/unit/out/refcount/vector_with_allocator.rs index fb6d065063..1e5d1a91b7 100644 --- a/tests/unit/out/refcount/vector_with_allocator.rs +++ b/tests/unit/out/refcount/vector_with_allocator.rs @@ -6,9 +6,9 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct TestAllocator_int_ {} -#[derive(Clone, ByteRepr, Default)] +#[derive(Clone, ByteRepr, VaArg, FnPtrArg, Default)] pub struct TestAllocator_double_ {} pub fn copy_0(copy_vector: Vec) { let copy_vector: Value> = Rc::new(RefCell::new(copy_vector)); diff --git a/tests/unit/out/refcount/void_cast.rs b/tests/unit/out/refcount/void_cast.rs index 3a2bda405e..ab18f034f8 100644 --- a/tests/unit/out/refcount/void_cast.rs +++ b/tests/unit/out/refcount/void_cast.rs @@ -10,7 +10,7 @@ pub fn unused_param_0(x: i32) { let x: Value = Rc::new(RefCell::new(x)); &(*x.borrow_mut()); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct NonTrivial { pub data: Value>, } @@ -50,7 +50,7 @@ pub fn bump_and_return_4() -> i32 { (*side_effect_counter_3.with(Value::clone).borrow_mut()).prefix_inc(); return side_effect_counter_3.with(|rc| *rc.borrow()); } -#[derive(Default)] +#[derive(VaArg, FnPtrArg, Default)] pub struct Holder { pub field: Value, } diff --git a/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs b/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs index 7ae29fc012..653e5ad388 100644 --- a/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs +++ b/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs @@ -18,6 +18,22 @@ pub unsafe fn via_size_t_param_2(mut b: usize) -> u64 { pub unsafe fn via_size_t_return_3(mut b: u64) -> usize { return (b as usize); } +#[repr(C)] +#[derive(Copy, Clone, Default)] +pub struct pair { + pub a: i32, + pub b: i32, +} +pub unsafe fn pair_scaled_4(mut p: pair, mut n: usize) -> u64 { + return (((p.a as usize).wrapping_mul(n)).wrapping_add((p.b as usize)) as u64); +} +pub unsafe fn make_pair_5(mut n: usize) -> pair { + let mut p: pair = pair { + a: (n as i32), + b: ((n as i32) * (2)), + }; + return p; +} pub fn main() { unsafe { __cpp2rust_init_globals(); @@ -55,6 +71,19 @@ unsafe fn main_0() -> i32 { >(adapted); assert!(((((back) == (original)) as i32) != 0)); assert!(((((unsafe { (back).unwrap()(5_usize,) }) == (5_u64)) as i32) != 0)); + let mut scaled: Option u64> = std::mem::transmute::< + Option u64>, + Option u64>, + >(Some(pair_scaled_4)); + let mut p: pair = pair { a: 3, b: 4 }; + assert!(((((unsafe { (scaled).unwrap()(p, 10_u64,) }) == (34_u64)) as i32) != 0)); + let mut make: Option pair> = std::mem::transmute::< + Option pair>, + Option pair>, + >(Some(make_pair_5)); + let mut q: pair = (unsafe { (make).unwrap()(5_u64) }); + assert!(((((q.a) == (5)) as i32) != 0)); + assert!(((((q.b) == (10)) as i32) != 0)); return 0; } pub unsafe fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/unsafe/opaque_forward_decl.rs b/tests/unit/out/unsafe/opaque_forward_decl.rs index cb48bcb363..034cea072b 100644 --- a/tests/unit/out/unsafe/opaque_forward_decl.rs +++ b/tests/unit/out/unsafe/opaque_forward_decl.rs @@ -26,6 +26,6 @@ unsafe fn main_0() -> i32 { &(c.p); return ((c.x) - (42)); } -#[derive(Clone, Copy, Default, ByteRepr)] +#[derive(Clone, Copy, Default, ByteRepr, VaArg, FnPtrArg)] pub struct opaque; pub unsafe fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/unsafe/va_arg_mixed_types.rs b/tests/unit/out/unsafe/va_arg_mixed_types.rs index f9130e37c1..aecfc8e7e0 100644 --- a/tests/unit/out/unsafe/va_arg_mixed_types.rs +++ b/tests/unit/out/unsafe/va_arg_mixed_types.rs @@ -6,6 +6,12 @@ use std::collections::BTreeMap; use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; +#[repr(C)] +#[derive(Copy, Clone, Default)] +pub struct pair { + pub a: i32, + pub b: i32, +} pub unsafe fn sum_mixed_0(mut count: i32, __args: &[VaArg]) -> i32 { let mut ap: VaList = VaList::default(); ap = VaList::new(__args); @@ -17,6 +23,9 @@ pub unsafe fn sum_mixed_0(mut count: i32, __args: &[VaArg]) -> i32 { total += ap.arg::(); } else if ((((tag) == (1)) as i32) != 0) { total += (ap.arg::() as i32); + } else if ((((tag) == (3)) as i32) != 0) { + let mut p: pair = ap.arg::(); + total += ((p.a) * (p.b)); } else { let mut val: i64 = ap.arg::(); total += (val as i32); @@ -58,6 +67,12 @@ unsafe fn main_0() -> i32 { }) == (103)) as i32) != 0) ); + let mut p: pair = pair { a: 7, b: 8 }; + assert!( + ((((unsafe { sum_mixed_0(2, &[(3).into(), (p).into(), (0).into(), (5).into(),]) }) == (61)) + as i32) + != 0) + ); return 0; } pub unsafe fn __cpp2rust_init_globals() {} diff --git a/tests/unit/va_arg_mixed_types.c b/tests/unit/va_arg_mixed_types.c index 4acf9ddd9d..0e018bed5a 100644 --- a/tests/unit/va_arg_mixed_types.c +++ b/tests/unit/va_arg_mixed_types.c @@ -1,6 +1,11 @@ #include #include +struct pair { + int a; + int b; +}; + int sum_mixed(int count, ...) { va_list ap; va_start(ap, count); @@ -11,6 +16,9 @@ int sum_mixed(int count, ...) { total += va_arg(ap, int); } else if (tag == 1) { total += (int)va_arg(ap, double); + } else if (tag == 3) { + struct pair p = va_arg(ap, struct pair); + total += p.a * p.b; } else { long val = va_arg(ap, long); total += (int)val; @@ -24,5 +32,7 @@ int main() { assert(sum_mixed(3, 0, 10, 1, 20.5, 2, 30L) == 60); assert(sum_mixed(1, 0, 42) == 42); assert(sum_mixed(2, 1, 3.7, 2, 100L) == 103); + struct pair p = {7, 8}; + assert(sum_mixed(2, 3, p, 0, 5) == 61); return 0; } From e9ac7015ae2260c177613f2f19eee10e30473878 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Mon, 28 Sep 2026 22:18:53 +0100 Subject: [PATCH 2/4] Avoid moves --- cpp2rust/converter/models/converter_refcount.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index bec36d063c..1036ee844e 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -2053,6 +2053,10 @@ bool ConverterRefCount::VisitCXXScalarValueInitExpr( } void ConverterRefCount::ConvertVariadicArg(clang::Expr *arg) { + if (arg->getType()->isRecordType()) { + StrCat(ConvertFreshRValue(arg)); + return; + } if (arg->getType()->isPointerType()) { StrCat(ConvertFreshPointer(arg)); return; From e7ecdb22fea4f8483f3afa0583ed63f4c09117a3 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Mon, 28 Sep 2026 22:22:06 +0100 Subject: [PATCH 3/4] Add RecordImplementsClone --- cpp2rust/converter/converter.cpp | 9 +++++++++ cpp2rust/converter/converter.h | 2 ++ cpp2rust/converter/converter_lib.cpp | 9 --------- cpp2rust/converter/converter_lib.h | 2 -- cpp2rust/converter/models/converter_refcount.cpp | 9 +++++++++ cpp2rust/converter/models/converter_refcount.h | 2 ++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/cpp2rust/converter/converter.cpp b/cpp2rust/converter/converter.cpp index 7a14a746ec..eb27a7316c 100644 --- a/cpp2rust/converter/converter.cpp +++ b/cpp2rust/converter/converter.cpp @@ -4147,6 +4147,10 @@ Converter::GetStructAttributes(const clang::RecordDecl *decl) { struct_attrs.emplace_back("Clone"); } + if (RecordImplementsClone(decl)) { + struct_attrs.emplace_back("VaArg"); + } + if (RecordDerivesDefault(decl)) { struct_attrs.emplace_back("Default"); } @@ -4637,6 +4641,11 @@ void Converter::AddCloneTrait(const clang::RecordDecl *decl) { : std::format(" as *mut {}", record_name))); } +bool Converter::RecordImplementsClone(const clang::RecordDecl *decl) { + return HasDefaultedCopyConstructor(decl) || + GetUserDefinedCopyConstructor(decl) != nullptr; +} + void Converter::AddDefaultTraitForUnion(const clang::RecordDecl *decl) { StrCat(std::format("impl Default for {}", GetRecordName(decl))); PushBrace impl_brace(*this); diff --git a/cpp2rust/converter/converter.h b/cpp2rust/converter/converter.h index 16825b8abe..13512f7244 100644 --- a/cpp2rust/converter/converter.h +++ b/cpp2rust/converter/converter.h @@ -660,6 +660,8 @@ class Converter : public clang::RecursiveASTVisitor { virtual void AddCloneTrait(const clang::RecordDecl *decl); + virtual bool RecordImplementsClone(const clang::RecordDecl *decl); + virtual void AddDefaultTrait(const clang::RecordDecl *decl); virtual void AddDefaultTraitForUnion(const clang::RecordDecl *decl); diff --git a/cpp2rust/converter/converter_lib.cpp b/cpp2rust/converter/converter_lib.cpp index aff12e84b0..4c01a1556e 100644 --- a/cpp2rust/converter/converter_lib.cpp +++ b/cpp2rust/converter/converter_lib.cpp @@ -474,15 +474,6 @@ bool RecordHasOnlyReferenceFields(const clang::RecordDecl *decl) { return true; } -bool RecordImplementsClone(const clang::RecordDecl *decl) { - if (decl->isUnion() || - (HasDefaultedCopyConstructor(decl) && RecordHasOnlyReferenceFields(decl))) { - return true; - } - return !clang::isa(decl) || - HasCallableCopyConstructor(decl); -} - bool HasDefaultedCopyAssignment(const clang::RecordDecl *decl) { auto *cxx = clang::dyn_cast(decl); if (!cxx) { diff --git a/cpp2rust/converter/converter_lib.h b/cpp2rust/converter/converter_lib.h index 3597f8f8d1..6e0a8cc98f 100644 --- a/cpp2rust/converter/converter_lib.h +++ b/cpp2rust/converter/converter_lib.h @@ -107,8 +107,6 @@ bool HasDefaultedCopyConstructor(const clang::RecordDecl *decl); bool RecordHasOnlyReferenceFields(const clang::RecordDecl *decl); -bool RecordImplementsClone(const clang::RecordDecl *decl); - bool RecordDerivesByteRepr(const clang::RecordDecl *decl); bool HasDefaultedCopyAssignment(const clang::RecordDecl *decl); diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index 1036ee844e..60f61a315d 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -469,6 +469,15 @@ std::string ConverterRefCount::GetShallowCopy(const clang::RecordDecl *decl, return std::format("{} {{ {} }}", GetRecordName(decl), fields); } +bool ConverterRefCount::RecordImplementsClone(const clang::RecordDecl *decl) { + if (decl->isUnion() || + (HasDefaultedCopyConstructor(decl) && RecordHasOnlyReferenceFields(decl))) { + return true; + } + return !clang::isa(decl) || + HasCallableCopyConstructor(decl); +} + void ConverterRefCount::AddCloneTrait(const clang::RecordDecl *decl) { auto record_name = GetRecordName(decl); diff --git a/cpp2rust/converter/models/converter_refcount.h b/cpp2rust/converter/models/converter_refcount.h index 0b410404ea..2a11043a49 100644 --- a/cpp2rust/converter/models/converter_refcount.h +++ b/cpp2rust/converter/models/converter_refcount.h @@ -49,6 +49,8 @@ class ConverterRefCount final : public Converter { std::string_view src); void AddCloneTrait(const clang::RecordDecl *decl) override; + bool RecordImplementsClone(const clang::RecordDecl *decl) override; + void AddByteReprTrait(const clang::RecordDecl *decl) override; bool From b3b0b1694f92a5846aaf9e29c308312ea7ab303c Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Mon, 28 Sep 2026 22:28:51 +0100 Subject: [PATCH 4/4] Update tests --- .../converter/models/converter_refcount.cpp | 4 ++-- .../out/unsafe/cross_tu_tag_collision.rs | 2 +- .../out/unsafe/friend_operator.rs | 2 +- .../out/unsafe/opaque_forward_decl.rs | 2 +- .../unsafe/out_of_line_methods_cross_tu.rs | 4 ++-- .../template_method_late_instantiation.rs | 2 +- tests/ub/out/unsafe/ctor_ref_member.rs | 2 +- tests/ub/out/unsafe/ub6.rs | 2 +- tests/unit/out/refcount/va_arg_mixed_types.rs | 7 +++++- tests/unit/out/unsafe/10_struct.rs | 10 ++++----- tests/unit/out/unsafe/addr_of_global.rs | 4 ++-- tests/unit/out/unsafe/anonymous-struct.rs | 18 +++++++-------- tests/unit/out/unsafe/anonymous-struct_c.rs | 18 +++++++-------- tests/unit/out/unsafe/anonymous_enum.rs | 4 ++-- tests/unit/out/unsafe/anonymous_enum_c.rs | 4 ++-- tests/unit/out/unsafe/array_const_init.rs | 2 +- .../out/unsafe/array_of_noncopy_struct.rs | 2 +- tests/unit/out/unsafe/array_reference.rs | 2 +- tests/unit/out/unsafe/as_const.rs | 2 +- tests/unit/out/unsafe/bounded_struct_ptr.rs | 2 +- tests/unit/out/unsafe/bst.rs | 2 +- tests/unit/out/unsafe/c_struct.rs | 10 ++++----- tests/unit/out/unsafe/class.rs | 6 ++--- .../out/unsafe/class_template_lazy_member.rs | 6 ++--- tests/unit/out/unsafe/class_templates.rs | 20 ++++++++--------- tests/unit/out/unsafe/clone_vs_move.rs | 6 ++--- tests/unit/out/unsafe/complex_function.rs | 8 +++---- .../unit/out/unsafe/compound_assign_paren.rs | 2 +- tests/unit/out/unsafe/concepts.rs | 2 +- tests/unit/out/unsafe/constexpr_function.rs | 4 ++-- tests/unit/out/unsafe/constructor.rs | 4 ++-- tests/unit/out/unsafe/copy_assign.rs | 8 +++---- tests/unit/out/unsafe/copy_ctor.rs | 8 +++---- tests/unit/out/unsafe/copy_move_defaulted.rs | 10 ++++----- tests/unit/out/unsafe/default.rs | 2 +- .../out/unsafe/default_function_arguments.rs | 2 +- tests/unit/out/unsafe/default_in_statics.rs | 6 ++--- tests/unit/out/unsafe/destructor.rs | 22 +++++++++---------- tests/unit/out/unsafe/doubly_linked_list.rs | 2 +- .../unit/out/unsafe/enum_default_in_static.rs | 2 +- tests/unit/out/unsafe/enum_int_interop.rs | 2 +- tests/unit/out/unsafe/enum_int_interop_c.rs | 2 +- tests/unit/out/unsafe/exprs.rs | 4 ++-- tests/unit/out/unsafe/fft.rs | 2 +- tests/unit/out/unsafe/fn_ptr_cast.rs | 2 +- tests/unit/out/unsafe/fn_ptr_stable_sort.rs | 2 +- tests/unit/out/unsafe/fn_ptr_struct.rs | 4 ++-- tests/unit/out/unsafe/fn_ptr_typedef_cast.rs | 2 +- tests/unit/out/unsafe/fn_ptr_vtable.rs | 2 +- .../unsafe/foreach_disjoint_field_borrow.rs | 2 +- tests/unit/out/unsafe/forward_basic.rs | 4 ++-- tests/unit/out/unsafe/forward_decltype.rs | 2 +- tests/unit/out/unsafe/forward_explicit.rs | 2 +- tests/unit/out/unsafe/forward_pack.rs | 4 ++-- tests/unit/out/unsafe/friend.rs | 8 +++---- tests/unit/out/unsafe/function_overloading.rs | 2 +- .../out/unsafe/global_init_side_effect.rs | 2 +- .../unit/out/unsafe/global_non_const_init.rs | 6 ++--- tests/unit/out/unsafe/global_pointers.rs | 2 +- .../out/unsafe/global_without_initializer.rs | 2 +- .../unit/out/unsafe/goto_aggregate_default.rs | 2 +- tests/unit/out/unsafe/goto_cleanup.rs | 2 +- tests/unit/out/unsafe/huffman.rs | 2 +- .../unsafe/immutable-deref-on-func-call.rs | 2 +- tests/unit/out/unsafe/implicit_autoref.rs | 2 +- .../out/unsafe/in_class_field_initializer.rs | 6 ++--- tests/unit/out/unsafe/init.rs | 2 +- tests/unit/out/unsafe/kruskal.rs | 2 +- .../out/unsafe/lambda_capture_copy_ctor.rs | 4 ++-- .../out/unsafe/lambda_capture_star_this.rs | 2 +- tests/unit/out/unsafe/lambda_capture_this.rs | 2 +- tests/unit/out/unsafe/lambda_nested.rs | 2 +- .../out/unsafe/libc_struct_without_default.rs | 4 ++-- tests/unit/out/unsafe/linked_list.rs | 2 +- .../out/unsafe/local_anon_struct_collision.rs | 4 ++-- .../unit/out/unsafe/local_record_template.rs | 8 +++---- tests/unit/out/unsafe/memcpy_struct_bytes.rs | 2 +- tests/unit/out/unsafe/memcpy_struct_struct.rs | 2 +- tests/unit/out/unsafe/move_ctor.rs | 4 ++-- tests/unit/out/unsafe/move_this.rs | 2 +- tests/unit/out/unsafe/nested_structs.rs | 12 +++++----- tests/unit/out/unsafe/new.rs | 2 +- tests/unit/out/unsafe/new_bst.rs | 2 +- tests/unit/out/unsafe/new_struct.rs | 4 ++-- tests/unit/out/unsafe/offsetof.rs | 4 ++-- tests/unit/out/unsafe/opaque_forward_decl.rs | 2 +- tests/unit/out/unsafe/opaque_record_copy.rs | 4 ++-- tests/unit/out/unsafe/opaque_then_defined.rs | 4 ++-- .../out/unsafe/operator_arithmetic_free.rs | 2 +- .../out/unsafe/operator_arithmetic_member.rs | 2 +- .../unit/out/unsafe/operator_bitwise_free.rs | 2 +- .../out/unsafe/operator_bitwise_member.rs | 2 +- .../unsafe/operator_comparison_defaulted.rs | 16 +++++++------- .../out/unsafe/operator_comparison_free.rs | 4 ++-- .../out/unsafe/operator_comparison_member.rs | 2 +- .../out/unsafe/operator_comparison_mixed.rs | 2 +- .../operator_compound_assignment_free.rs | 2 +- .../operator_compound_assignment_member.rs | 2 +- tests/unit/out/unsafe/operator_friend.rs | 14 ++++++------ tests/unit/out/unsafe/operator_less_than.rs | 2 +- .../unit/out/unsafe/operator_logical_free.rs | 2 +- .../out/unsafe/operator_logical_member.rs | 2 +- .../unsafe/operator_member_pointer_free.rs | 4 ++-- .../unsafe/operator_member_pointer_member.rs | 6 ++--- tests/unit/out/unsafe/operator_other_free.rs | 2 +- .../unit/out/unsafe/operator_other_member.rs | 4 ++-- tests/unit/out/unsafe/operator_overloads.rs | 2 +- tests/unit/out/unsafe/operator_qualifiers.rs | 2 +- tests/unit/out/unsafe/operator_three_way.rs | 2 +- tests/unit/out/unsafe/operator_traits.rs | 10 ++++----- tests/unit/out/unsafe/overload_mangling.rs | 4 ++-- tests/unit/out/unsafe/pod.rs | 2 +- tests/unit/out/unsafe/pointer_array.rs | 2 +- tests/unit/out/unsafe/pointers.rs | 2 +- tests/unit/out/unsafe/polymorphism.rs | 4 ++-- tests/unit/out/unsafe/ptr_cast_init.rs | 4 ++-- tests/unit/out/unsafe/push_emplace_back.rs | 8 +++---- tests/unit/out/unsafe/random.rs | 4 ++-- tests/unit/out/unsafe/reference_wrapper.rs | 2 +- tests/unit/out/unsafe/refs_as_args.rs | 2 +- .../out/unsafe/reinterpret_cast_struct.rs | 2 +- .../reinterpret_cast_struct_to_struct.rs | 4 ++-- tests/unit/out/unsafe/reserved_keywords.rs | 2 +- tests/unit/out/unsafe/rule_of_five.rs | 2 +- tests/unit/out/unsafe/rule_of_three.rs | 2 +- tests/unit/out/unsafe/rvalue_struct.rs | 2 +- .../scalar_builtin_construct_destruct.rs | 2 +- tests/unit/out/unsafe/static_var_in_class.rs | 4 ++-- tests/unit/out/unsafe/strdup.rs | 2 +- .../out/unsafe/string_literal_ptr_init.rs | 2 +- tests/unit/out/unsafe/struct_ctor.rs | 2 +- tests/unit/out/unsafe/struct_default_ctor.rs | 4 ++-- tests/unit/out/unsafe/struct_ptr.rs | 2 +- .../out/unsafe/tag_vs_identifier_collision.rs | 10 ++++----- tests/unit/out/unsafe/template_default_arg.rs | 8 +++---- tests/unit/out/unsafe/this.rs | 4 ++-- tests/unit/out/unsafe/typedef-anon-struct.rs | 4 ++-- .../out/unsafe/unary_expr_or_type_trait.rs | 2 +- .../unit/out/unsafe/union_addrof_external.rs | 4 ++-- tests/unit/out/unsafe/union_cross_arm_cast.rs | 6 ++--- .../unit/out/unsafe/union_field_alignment.rs | 2 +- .../out/unsafe/union_flex_array_member.rs | 2 +- tests/unit/out/unsafe/union_memset_memcpy.rs | 6 ++--- tests/unit/out/unsafe/union_nested.rs | 6 ++--- .../out/unsafe/union_pointer_pun_address.rs | 4 ++-- .../unit/out/unsafe/union_struct_dual_use.rs | 4 ++-- .../unit/out/unsafe/union_tagged_many_arms.rs | 2 +- tests/unit/out/unsafe/union_tagged_simple.rs | 2 +- .../out/unsafe/union_tagged_struct_arms.rs | 8 +++---- .../out/unsafe/union_void_ptr_sized_deref.rs | 2 +- tests/unit/out/unsafe/unique_ptr.rs | 2 +- tests/unit/out/unsafe/unique_ptr_nested.rs | 2 +- tests/unit/out/unsafe/unique_ptr_struct.rs | 2 +- tests/unit/out/unsafe/va_arg_mixed_types.rs | 2 +- .../out/unsafe/va_arg_non_primitive_ptrs.rs | 2 +- tests/unit/out/unsafe/va_arg_struct_ctx.rs | 2 +- tests/unit/out/unsafe/va_arg_void_ptr.rs | 2 +- .../unit/out/unsafe/vector_with_allocator.rs | 4 ++-- tests/unit/out/unsafe/void_cast.rs | 4 ++-- 159 files changed, 317 insertions(+), 312 deletions(-) diff --git a/cpp2rust/converter/models/converter_refcount.cpp b/cpp2rust/converter/models/converter_refcount.cpp index 60f61a315d..1bf4f7d7cb 100644 --- a/cpp2rust/converter/models/converter_refcount.cpp +++ b/cpp2rust/converter/models/converter_refcount.cpp @@ -470,8 +470,8 @@ std::string ConverterRefCount::GetShallowCopy(const clang::RecordDecl *decl, } bool ConverterRefCount::RecordImplementsClone(const clang::RecordDecl *decl) { - if (decl->isUnion() || - (HasDefaultedCopyConstructor(decl) && RecordHasOnlyReferenceFields(decl))) { + if (decl->isUnion() || (HasDefaultedCopyConstructor(decl) && + RecordHasOnlyReferenceFields(decl))) { return true; } return !clang::isa(decl) || diff --git a/tests/multi-file/cross_tu_tag_collision/out/unsafe/cross_tu_tag_collision.rs b/tests/multi-file/cross_tu_tag_collision/out/unsafe/cross_tu_tag_collision.rs index fb1bdc3611..61947abddf 100644 --- a/tests/multi-file/cross_tu_tag_collision/out/unsafe/cross_tu_tag_collision.rs +++ b/tests/multi-file/cross_tu_tag_collision/out/unsafe/cross_tu_tag_collision.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct widget { pub id: i32, } diff --git a/tests/multi-file/friend_operator/out/unsafe/friend_operator.rs b/tests/multi-file/friend_operator/out/unsafe/friend_operator.rs index 9f6d2117bc..01cb8f598a 100644 --- a/tests/multi-file/friend_operator/out/unsafe/friend_operator.rs +++ b/tests/multi-file/friend_operator/out/unsafe/friend_operator.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a: i32, pub b: i32, diff --git a/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs b/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs index ff0864803d..8069068ccd 100644 --- a/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs +++ b/tests/multi-file/opaque_forward_decl/out/unsafe/opaque_forward_decl.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct container { pub p: *mut opaque, pub x: i32, diff --git a/tests/multi-file/out_of_line_methods_cross_tu/out/unsafe/out_of_line_methods_cross_tu.rs b/tests/multi-file/out_of_line_methods_cross_tu/out/unsafe/out_of_line_methods_cross_tu.rs index c48695c9ce..3ce979c9c8 100644 --- a/tests/multi-file/out_of_line_methods_cross_tu/out/unsafe/out_of_line_methods_cross_tu.rs +++ b/tests/multi-file/out_of_line_methods_cross_tu/out/unsafe/out_of_line_methods_cross_tu.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } @@ -20,7 +20,7 @@ pub unsafe trait Base { unsafe fn apply(&mut self, x: i32) -> i32; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Derived { pub factor: i32, } diff --git a/tests/multi-file/template_method_late_instantiation/out/unsafe/template_method_late_instantiation.rs b/tests/multi-file/template_method_late_instantiation/out/unsafe/template_method_late_instantiation.rs index 86f692cac2..0454858677 100644 --- a/tests/multi-file/template_method_late_instantiation/out/unsafe/template_method_late_instantiation.rs +++ b/tests/multi-file/template_method_late_instantiation/out/unsafe/template_method_late_instantiation.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S_int_ { pub x: i32, } diff --git a/tests/ub/out/unsafe/ctor_ref_member.rs b/tests/ub/out/unsafe/ctor_ref_member.rs index d943ec5597..a68f4eac4a 100644 --- a/tests/ub/out/unsafe/ctor_ref_member.rs +++ b/tests/ub/out/unsafe/ctor_ref_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub r: *const i32, } diff --git a/tests/ub/out/unsafe/ub6.rs b/tests/ub/out/unsafe/ub6.rs index b78127c2b8..2274716195 100644 --- a/tests/ub/out/unsafe/ub6.rs +++ b/tests/ub/out/unsafe/ub6.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub x1: *mut i32, pub x2: *mut i32, diff --git a/tests/unit/out/refcount/va_arg_mixed_types.rs b/tests/unit/out/refcount/va_arg_mixed_types.rs index d922518067..58adbd549c 100644 --- a/tests/unit/out/refcount/va_arg_mixed_types.rs +++ b/tests/unit/out/refcount/va_arg_mixed_types.rs @@ -96,7 +96,12 @@ fn main_0() -> i32 { (((({ sum_mixed_0( 2, - &[(3).into(), (*p.borrow()).into(), (0).into(), (5).into()], + &[ + (3).into(), + ((*p.borrow()).clone()).into(), + (0).into(), + (5).into(), + ], ) }) == 61) as i32) != 0) diff --git a/tests/unit/out/unsafe/10_struct.rs b/tests/unit/out/unsafe/10_struct.rs index 07f50f7e3d..c2428ec2a8 100644 --- a/tests/unit/out/unsafe/10_struct.rs +++ b/tests/unit/out/unsafe/10_struct.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct GraphNode { pub dst: u32, pub next: *mut GraphNode, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Graph { pub V: u32, pub adj: *mut *mut GraphNode, @@ -31,7 +31,7 @@ impl Graph { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Partial { pub p: *mut i32, } @@ -49,11 +49,11 @@ impl Default for Partial { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Declared {} impl Declared {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub i: i32, pub d: *mut Declared, diff --git a/tests/unit/out/unsafe/addr_of_global.rs b/tests/unit/out/unsafe/addr_of_global.rs index 25040e4058..c1975fc75c 100644 --- a/tests/unit/out/unsafe/addr_of_global.rs +++ b/tests/unit/out/unsafe/addr_of_global.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub value: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub p: *mut Inner, } diff --git a/tests/unit/out/unsafe/anonymous-struct.rs b/tests/unit/out/unsafe/anonymous-struct.rs index 6c62cd66e7..c0dfecf4d1 100644 --- a/tests/unit/out/unsafe/anonymous-struct.rs +++ b/tests/unit/out/unsafe/anonymous-struct.rs @@ -7,48 +7,48 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_Named { pub a: i32, pub b: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_0 { pub c: i32, pub d: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_1 { pub g: i32, pub h: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_2 { pub e: i32, pub f: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_4 { pub j: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_5 { pub k: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_3 { pub i: i32, pub inner_named: anon_4, pub anon_5: anon_5, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub named: Outer_Named, pub anonymous_named_0: anon_0, @@ -104,7 +104,7 @@ unsafe fn main_0() -> i32 { return 0; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_6 { pub x: i32, pub z: i32, diff --git a/tests/unit/out/unsafe/anonymous-struct_c.rs b/tests/unit/out/unsafe/anonymous-struct_c.rs index eb207f052f..a672dc3420 100644 --- a/tests/unit/out/unsafe/anonymous-struct_c.rs +++ b/tests/unit/out/unsafe/anonymous-struct_c.rs @@ -7,48 +7,48 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Named { pub a: i32, pub b: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_0 { pub c: i32, pub d: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_1 { pub g: i32, pub h: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_2 { pub e: i32, pub f: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_4 { pub j: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_5 { pub k: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_3 { pub i: i32, pub inner_named: anon_4, pub anon_5: anon_5, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub named: Named, pub anon0: anon_0, @@ -110,7 +110,7 @@ unsafe fn main_0() -> i32 { return 0; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_6 { pub x: i32, pub z: i32, diff --git a/tests/unit/out/unsafe/anonymous_enum.rs b/tests/unit/out/unsafe/anonymous_enum.rs index 3dd44bfca9..2b80d7910f 100644 --- a/tests/unit/out/unsafe/anonymous_enum.rs +++ b/tests/unit/out/unsafe/anonymous_enum.rs @@ -13,7 +13,7 @@ pub type anon_1 = u32; pub const anon_1_SECOND_A: anon_1 = 0; pub const anon_1_SECOND_B: anon_1 = 1; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a: i32, } @@ -24,7 +24,7 @@ pub type anon_2 = u32; pub const anon_2_FIELD_A: anon_2 = 0; pub const anon_2_FIELD_B: anon_2 = 1; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct WithAnonField { pub a: i32, pub field: anon_2, diff --git a/tests/unit/out/unsafe/anonymous_enum_c.rs b/tests/unit/out/unsafe/anonymous_enum_c.rs index ab38346d02..f79beeaa95 100644 --- a/tests/unit/out/unsafe/anonymous_enum_c.rs +++ b/tests/unit/out/unsafe/anonymous_enum_c.rs @@ -13,7 +13,7 @@ pub type anon_1 = u32; pub const anon_1_SECOND_A: anon_1 = 0; pub const anon_1_SECOND_B: anon_1 = 1; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a: i32, } @@ -24,7 +24,7 @@ pub type anon_2 = u32; pub const anon_2_FIELD_A: anon_2 = 0; pub const anon_2_FIELD_B: anon_2 = 1; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct WithAnonField { pub a: i32, pub field: anon_2, diff --git a/tests/unit/out/unsafe/array_const_init.rs b/tests/unit/out/unsafe/array_const_init.rs index 3613157617..278beb5738 100644 --- a/tests/unit/out/unsafe/array_const_init.rs +++ b/tests/unit/out/unsafe/array_const_init.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S { pub head: i32, pub tail: [i32; 3], diff --git a/tests/unit/out/unsafe/array_of_noncopy_struct.rs b/tests/unit/out/unsafe/array_of_noncopy_struct.rs index fc89b19858..6d834341d0 100644 --- a/tests/unit/out/unsafe/array_of_noncopy_struct.rs +++ b/tests/unit/out/unsafe/array_of_noncopy_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct NonCopy { pub data: Vec, pub tag: i32, diff --git a/tests/unit/out/unsafe/array_reference.rs b/tests/unit/out/unsafe/array_reference.rs index 577c3c4ee7..9f9cfe863d 100644 --- a/tests/unit/out/unsafe/array_reference.rs +++ b/tests/unit/out/unsafe/array_reference.rs @@ -57,7 +57,7 @@ pub unsafe fn pick_10(s: *const [libc::c_char; 5]) -> *const [libc::c_char; 5] { return s; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/as_const.rs b/tests/unit/out/unsafe/as_const.rs index 2488f7b43f..61e6c4376e 100644 --- a/tests/unit/out/unsafe/as_const.rs +++ b/tests/unit/out/unsafe/as_const.rs @@ -10,7 +10,7 @@ pub type Overload = u32; pub const Overload_kMutableOverload: Overload = 1; pub const Overload_kConstOverload: Overload = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/bounded_struct_ptr.rs b/tests/unit/out/unsafe/bounded_struct_ptr.rs index b281e26174..535d49897f 100644 --- a/tests/unit/out/unsafe/bounded_struct_ptr.rs +++ b/tests/unit/out/unsafe/bounded_struct_ptr.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Foo { pub x1: i32, pub x2: i32, diff --git a/tests/unit/out/unsafe/bst.rs b/tests/unit/out/unsafe/bst.rs index d40652cc4f..6183e87722 100644 --- a/tests/unit/out/unsafe/bst.rs +++ b/tests/unit/out/unsafe/bst.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node_t { pub left: *mut node_t, pub right: *mut node_t, diff --git a/tests/unit/out/unsafe/c_struct.rs b/tests/unit/out/unsafe/c_struct.rs index 0de37421e6..1f69d3d049 100644 --- a/tests/unit/out/unsafe/c_struct.rs +++ b/tests/unit/out/unsafe/c_struct.rs @@ -7,19 +7,19 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Line { pub start: Point, pub end: Point, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Node { pub value: i32, pub next: *mut Node, @@ -29,13 +29,13 @@ pub const Color_RED: Color = 0; pub const Color_GREEN: Color = 1; pub const Color_BLUE: Color = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub a: i32, pub b: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Container { pub inner: Inner, pub color: Color, diff --git a/tests/unit/out/unsafe/class.rs b/tests/unit/out/unsafe/class.rs index 270727e1e9..282948c5ce 100644 --- a/tests/unit/out/unsafe/class.rs +++ b/tests/unit/out/unsafe/class.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub first: i32, pub second: i32, @@ -42,7 +42,7 @@ impl Pair { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Route { pub path: Pair, pub cost: f64, @@ -55,7 +55,7 @@ impl Route { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Counter { pub v: i32, pub calls: i32, diff --git a/tests/unit/out/unsafe/class_template_lazy_member.rs b/tests/unit/out/unsafe/class_template_lazy_member.rs index 05ad2e74d7..5dd2f06965 100644 --- a/tests/unit/out/unsafe/class_template_lazy_member.rs +++ b/tests/unit/out/unsafe/class_template_lazy_member.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Box_int_ { pub val: i32, } @@ -22,7 +22,7 @@ impl Box_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Box_Point_ { pub val: Point, } diff --git a/tests/unit/out/unsafe/class_templates.rs b/tests/unit/out/unsafe/class_templates.rs index 70f216d9f4..50fa306bc8 100644 --- a/tests/unit/out/unsafe/class_templates.rs +++ b/tests/unit/out/unsafe/class_templates.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct MyContainer_int_ { vec_: Vec, } @@ -33,7 +33,7 @@ impl MyContainer_int_ { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct MyContainer_char_ { vec_: Vec, } @@ -59,7 +59,7 @@ impl MyContainer_char_ { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct MyContainer_float_ { vec_: Vec, } @@ -85,7 +85,7 @@ impl MyContainer_float_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Boxed_int_ { pub value: i32, } @@ -98,7 +98,7 @@ impl Boxed_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Boxed_long_ { pub value: i64, } @@ -111,7 +111,7 @@ impl Boxed_long_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_int__Inner_int_ { pub t: i32, pub u: i32, @@ -122,7 +122,7 @@ impl Outer_int__Inner_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_int_ { pub v: i32, } @@ -132,7 +132,7 @@ impl Outer_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_long__Inner_int_ { pub t: i64, pub u: i32, @@ -143,7 +143,7 @@ impl Outer_long__Inner_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_long__Inner_char_ { pub t: i64, pub u: libc::c_char, @@ -154,7 +154,7 @@ impl Outer_long__Inner_char_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_long_ { pub v: i64, } diff --git a/tests/unit/out/unsafe/clone_vs_move.rs b/tests/unit/out/unsafe/clone_vs_move.rs index dc31af0892..92e7f9cb0b 100644 --- a/tests/unit/out/unsafe/clone_vs_move.rs +++ b/tests/unit/out/unsafe/clone_vs_move.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Bar { pub w: i32, } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Foo { pub x: i32, pub y: *mut i32, @@ -32,7 +32,7 @@ impl Default for Foo { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Refs { pub a: *mut i32, pub b: *mut i32, diff --git a/tests/unit/out/unsafe/complex_function.rs b/tests/unit/out/unsafe/complex_function.rs index de266d91fc..e2143da2ba 100644 --- a/tests/unit/out/unsafe/complex_function.rs +++ b/tests/unit/out/unsafe/complex_function.rs @@ -16,12 +16,12 @@ pub unsafe fn bar_2(x: *mut i32) -> *mut i32 { return x; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X1 { pub v: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X2 { pub v: *mut X1, } @@ -31,7 +31,7 @@ impl X2 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X3 { pub v: *mut X2, } @@ -41,7 +41,7 @@ impl X3 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X4 { pub v: X3, } diff --git a/tests/unit/out/unsafe/compound_assign_paren.rs b/tests/unit/out/unsafe/compound_assign_paren.rs index 9c64191c18..3b5e3de10b 100644 --- a/tests/unit/out/unsafe/compound_assign_paren.rs +++ b/tests/unit/out/unsafe/compound_assign_paren.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Item { pub flags: u8, } diff --git a/tests/unit/out/unsafe/concepts.rs b/tests/unit/out/unsafe/concepts.rs index bfb3757e7a..85d17af3f0 100644 --- a/tests/unit/out/unsafe/concepts.rs +++ b/tests/unit/out/unsafe/concepts.rs @@ -12,7 +12,7 @@ const _: () = assert!( "sizeof(int) == 4" ); #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Sized {} impl Sized { pub unsafe fn size(&mut self) -> i32 { diff --git a/tests/unit/out/unsafe/constexpr_function.rs b/tests/unit/out/unsafe/constexpr_function.rs index 662215ac87..bbd171c606 100644 --- a/tests/unit/out/unsafe/constexpr_function.rs +++ b/tests/unit/out/unsafe/constexpr_function.rs @@ -22,7 +22,7 @@ pub unsafe fn half_3(mut x: f64) -> f64 { return ((x) / (2.0E+0)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Flag { pub v: i32, } @@ -40,7 +40,7 @@ pub unsafe fn checked_5(mut x: i32) -> i32 { return ((x) + (1)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct P { pub v: i32, } diff --git a/tests/unit/out/unsafe/constructor.rs b/tests/unit/out/unsafe/constructor.rs index c001a83830..6f10ffbb58 100644 --- a/tests/unit/out/unsafe/constructor.rs +++ b/tests/unit/out/unsafe/constructor.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub static mut total_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct S { pub v: i32, } @@ -33,7 +33,7 @@ impl S { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/copy_assign.rs b/tests/unit/out/unsafe/copy_assign.rs index 1568437003..9308542a59 100644 --- a/tests/unit/out/unsafe/copy_assign.rs +++ b/tests/unit/out/unsafe/copy_assign.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub static mut assigns_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Partial { pub v: i32, pub keep: i32, @@ -40,7 +40,7 @@ impl Clone for Partial { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct NonConstAssign { pub mark: i32, } @@ -70,7 +70,7 @@ impl Default for NonConstAssign { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct RefQualified { pub mark: i32, } @@ -90,7 +90,7 @@ impl Default for RefQualified { } } #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct Holder { pub p: Partial, pub arr: [Partial; 2], diff --git a/tests/unit/out/unsafe/copy_ctor.rs b/tests/unit/out/unsafe/copy_ctor.rs index 5a9dc96703..8dd19777b0 100644 --- a/tests/unit/out/unsafe/copy_ctor.rs +++ b/tests/unit/out/unsafe/copy_ctor.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub static mut copies_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Counted { pub v: i32, } @@ -29,7 +29,7 @@ impl Clone for Counted { } } #[repr(C)] -#[derive()] +#[derive(VaArg)] pub struct NonConst { pub mark: i32, } @@ -62,7 +62,7 @@ impl Default for NonConst { } } #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Ignored { pub v: i32, } @@ -83,7 +83,7 @@ impl Clone for Ignored { } } #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct Holder { pub c: Counted, pub arr: [Counted; 2], diff --git a/tests/unit/out/unsafe/copy_move_defaulted.rs b/tests/unit/out/unsafe/copy_move_defaulted.rs index dbb3651514..344589b01c 100644 --- a/tests/unit/out/unsafe/copy_move_defaulted.rs +++ b/tests/unit/out/unsafe/copy_move_defaulted.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub x: i32, } #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct Explicit { pub v: i32, pub inner: Inner, @@ -39,7 +39,7 @@ impl Default for Explicit { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Implicit { pub v: i32, pub inner: Inner, @@ -55,7 +55,7 @@ impl Default for Implicit { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct DefaultCopyUserMove { pub v: i32, } @@ -76,7 +76,7 @@ impl DefaultCopyUserMove { } } #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct UserCopyDefaultMove { pub v: i32, } diff --git a/tests/unit/out/unsafe/default.rs b/tests/unit/out/unsafe/default.rs index c8b2e33610..b2a5cd69ce 100644 --- a/tests/unit/out/unsafe/default.rs +++ b/tests/unit/out/unsafe/default.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Pointers { pub x1: *mut i32, pub x2: *const i32, diff --git a/tests/unit/out/unsafe/default_function_arguments.rs b/tests/unit/out/unsafe/default_function_arguments.rs index f3c901e582..23863b2c55 100644 --- a/tests/unit/out/unsafe/default_function_arguments.rs +++ b/tests/unit/out/unsafe/default_function_arguments.rs @@ -15,7 +15,7 @@ pub unsafe fn baz_1(mut a: *mut i32, mut b: Option<*mut i32>) -> bool { return ((a) == (b)); } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Bar { pub v: i32, } diff --git a/tests/unit/out/unsafe/default_in_statics.rs b/tests/unit/out/unsafe/default_in_statics.rs index 78529dee30..6b5d4e878c 100644 --- a/tests/unit/out/unsafe/default_in_statics.rs +++ b/tests/unit/out/unsafe/default_in_statics.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub v: i32, pub name: *const libc::c_char, } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Outer { pub p1: *mut i32, pub p2: *const i32, @@ -39,7 +39,7 @@ impl Default for Outer { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Foo { pub s1: *const libc::c_char, pub s2: *const libc::c_char, diff --git a/tests/unit/out/unsafe/destructor.rs b/tests/unit/out/unsafe/destructor.rs index 0412722e98..e27f06dcfd 100644 --- a/tests/unit/out/unsafe/destructor.rs +++ b/tests/unit/out/unsafe/destructor.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub static mut global_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct S {} impl S { pub unsafe fn destructor(&mut self) { @@ -16,7 +16,7 @@ impl S { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Defaulted { pub s: S, } @@ -26,7 +26,7 @@ impl Defaulted { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Middle { pub s: S, } @@ -36,7 +36,7 @@ impl Middle { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Outer { pub m: Middle, } @@ -46,7 +46,7 @@ impl Outer { } } #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct ArrayMember { pub items: [S; 3], } @@ -65,7 +65,7 @@ impl Default for ArrayMember { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct EmptyBody { pub s: S, } @@ -75,7 +75,7 @@ impl EmptyBody { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Templated_char_ { pub v: libc::c_char, } @@ -87,7 +87,7 @@ impl Templated_char_ { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Templated_int_ { pub v: i32, } @@ -99,7 +99,7 @@ impl Templated_int_ { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Copied { pub v: i32, } @@ -112,7 +112,7 @@ pub static mut order_1: std::cell::LazyCell<[i32; 3]> = std::cell::LazyCell::new(|| unsafe { [0_i32; 3] }); pub static mut order_count_2: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Tagged { pub tag: i32, } @@ -124,7 +124,7 @@ impl Tagged { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Ordered { pub first: Tagged, pub dummy1: i32, diff --git a/tests/unit/out/unsafe/doubly_linked_list.rs b/tests/unit/out/unsafe/doubly_linked_list.rs index 078ba921a2..b2125bab9a 100644 --- a/tests/unit/out/unsafe/doubly_linked_list.rs +++ b/tests/unit/out/unsafe/doubly_linked_list.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Node { pub val: i32, pub next: *mut Node, diff --git a/tests/unit/out/unsafe/enum_default_in_static.rs b/tests/unit/out/unsafe/enum_default_in_static.rs index 8e1f082372..9b9541c37e 100644 --- a/tests/unit/out/unsafe/enum_default_in_static.rs +++ b/tests/unit/out/unsafe/enum_default_in_static.rs @@ -11,7 +11,7 @@ pub const Mode_MODE_NONE: Mode = 0; pub const Mode_MODE_ONE: Mode = 1; pub const Mode_MODE_TWO: Mode = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Config { pub count: i32, pub mode: Mode, diff --git a/tests/unit/out/unsafe/enum_int_interop.rs b/tests/unit/out/unsafe/enum_int_interop.rs index 349262bb22..259871c8a9 100644 --- a/tests/unit/out/unsafe/enum_int_interop.rs +++ b/tests/unit/out/unsafe/enum_int_interop.rs @@ -20,7 +20,7 @@ pub const Tag_TAG_ZERO: Tag = 0; pub const Tag_TAG_ONE: Tag = 1; pub const Tag_TAG_TWO: Tag = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Entry { pub name: *const libc::c_char, pub color: Color, diff --git a/tests/unit/out/unsafe/enum_int_interop_c.rs b/tests/unit/out/unsafe/enum_int_interop_c.rs index a4493283c2..1d385c157e 100644 --- a/tests/unit/out/unsafe/enum_int_interop_c.rs +++ b/tests/unit/out/unsafe/enum_int_interop_c.rs @@ -20,7 +20,7 @@ pub const Tag_enum_TAG_ZERO: Tag_enum = 0; pub const Tag_enum_TAG_ONE: Tag_enum = 1; pub const Tag_enum_TAG_TWO: Tag_enum = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Entry { pub name: *const libc::c_char, pub color: Color, diff --git a/tests/unit/out/unsafe/exprs.rs b/tests/unit/out/unsafe/exprs.rs index 252df93c2a..164ac3417c 100644 --- a/tests/unit/out/unsafe/exprs.rs +++ b/tests/unit/out/unsafe/exprs.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X { pub x: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Y { pub x: X, pub p: *mut X, diff --git a/tests/unit/out/unsafe/fft.rs b/tests/unit/out/unsafe/fft.rs index e05c349f07..3cdfe5ecb0 100644 --- a/tests/unit/out/unsafe/fft.rs +++ b/tests/unit/out/unsafe/fft.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Complex { pub re: f64, pub img: f64, diff --git a/tests/unit/out/unsafe/fn_ptr_cast.rs b/tests/unit/out/unsafe/fn_ptr_cast.rs index 62fdeff053..8665e4288f 100644 --- a/tests/unit/out/unsafe/fn_ptr_cast.rs +++ b/tests/unit/out/unsafe/fn_ptr_cast.rs @@ -30,7 +30,7 @@ pub unsafe fn test_double_cast_2() { assert!(((fn2) == (fn_))); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Command { pub data: *mut ::libc::c_void, } diff --git a/tests/unit/out/unsafe/fn_ptr_stable_sort.rs b/tests/unit/out/unsafe/fn_ptr_stable_sort.rs index f5b0464e02..516b5e9a6f 100644 --- a/tests/unit/out/unsafe/fn_ptr_stable_sort.rs +++ b/tests/unit/out/unsafe/fn_ptr_stable_sort.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Item { pub key: i32, pub value: i32, diff --git a/tests/unit/out/unsafe/fn_ptr_struct.rs b/tests/unit/out/unsafe/fn_ptr_struct.rs index 2172116926..f8d4386cc8 100644 --- a/tests/unit/out/unsafe/fn_ptr_struct.rs +++ b/tests/unit/out/unsafe/fn_ptr_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Handler { pub tag: i32, pub cb: Option i32>, @@ -27,7 +27,7 @@ pub unsafe fn negate_1(mut x: i32) -> i32 { return -x; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S {} impl S { pub unsafe fn pick_i32(mut x: i32) -> i32 { diff --git a/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs b/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs index 653e5ad388..5313be013d 100644 --- a/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs +++ b/tests/unit/out/unsafe/fn_ptr_typedef_cast.rs @@ -19,7 +19,7 @@ pub unsafe fn via_size_t_return_3(mut b: u64) -> usize { return (b as usize); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct pair { pub a: i32, pub b: i32, diff --git a/tests/unit/out/unsafe/fn_ptr_vtable.rs b/tests/unit/out/unsafe/fn_ptr_vtable.rs index c2ae95ad97..7b622d738c 100644 --- a/tests/unit/out/unsafe/fn_ptr_vtable.rs +++ b/tests/unit/out/unsafe/fn_ptr_vtable.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Vtable { pub create: Option *mut ::libc::c_void>, pub get: Option i32>, diff --git a/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs b/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs index b4decd0fc0..5a88a867cf 100644 --- a/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs +++ b/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct S { pub v: Vec, pub a: i32, diff --git a/tests/unit/out/unsafe/forward_basic.rs b/tests/unit/out/unsafe/forward_basic.rs index addc1347a8..1ec3714922 100644 --- a/tests/unit/out/unsafe/forward_basic.rs +++ b/tests/unit/out/unsafe/forward_basic.rs @@ -10,7 +10,7 @@ pub type Overload = u32; pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Tracked { pub v: i32, pub copies: i32, @@ -71,7 +71,7 @@ impl Holder { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Holder { pub t: Tracked, } diff --git a/tests/unit/out/unsafe/forward_decltype.rs b/tests/unit/out/unsafe/forward_decltype.rs index 01c6d44e91..f193317b2b 100644 --- a/tests/unit/out/unsafe/forward_decltype.rs +++ b/tests/unit/out/unsafe/forward_decltype.rs @@ -10,7 +10,7 @@ pub type Overload = u32; pub const Overload_kLvalueOverload: Overload = 1; pub const Overload_kRvalueOverload: Overload = 2; #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Tracked { pub v: i32, pub copies: i32, diff --git a/tests/unit/out/unsafe/forward_explicit.rs b/tests/unit/out/unsafe/forward_explicit.rs index b7914a9741..60b93ec590 100644 --- a/tests/unit/out/unsafe/forward_explicit.rs +++ b/tests/unit/out/unsafe/forward_explicit.rs @@ -12,7 +12,7 @@ pub const Overload_kRvalueOverload: Overload = 2; pub const Overload_kIntLvalueOverload: Overload = 3; pub const Overload_kIntRvalueOverload: Overload = 4; #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Tracked { pub v: i32, pub copies: i32, diff --git a/tests/unit/out/unsafe/forward_pack.rs b/tests/unit/out/unsafe/forward_pack.rs index 21419da1d8..864c2ee3e2 100644 --- a/tests/unit/out/unsafe/forward_pack.rs +++ b/tests/unit/out/unsafe/forward_pack.rs @@ -12,7 +12,7 @@ pub const Overload_kRvalueOverload: Overload = 2; pub const Overload_kIntLvalueOverload: Overload = 3; pub const Overload_kIntRvalueOverload: Overload = 4; #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Tracked { pub v: i32, pub copies: i32, @@ -106,7 +106,7 @@ impl Pair { } } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Pair { pub a: Tracked, pub b: Tracked, diff --git a/tests/unit/out/unsafe/friend.rs b/tests/unit/out/unsafe/friend.rs index 629ca16e77..56a073614b 100644 --- a/tests/unit/out/unsafe/friend.rs +++ b/tests/unit/out/unsafe/friend.rs @@ -19,7 +19,7 @@ pub unsafe fn scaled_3(v: *const V, mut k: f64) -> f64 { return (((*v).x as f64) * (k)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct V { pub x: i32, } @@ -33,7 +33,7 @@ pub unsafe fn get_4(w: *const W_int_) -> i32 { return (*w).x; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct W_int_ { pub x: i32, } @@ -41,12 +41,12 @@ pub unsafe fn get_5(w: *const W_long_) -> i64 { return (*w).x; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct W_long_ { pub x: i64, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct D { pub x: i32, } diff --git a/tests/unit/out/unsafe/function_overloading.rs b/tests/unit/out/unsafe/function_overloading.rs index e81c89a197..d4bbd56590 100644 --- a/tests/unit/out/unsafe/function_overloading.rs +++ b/tests/unit/out/unsafe/function_overloading.rs @@ -22,7 +22,7 @@ pub unsafe fn bar_4(x: *mut i32) -> i32 { return (*x); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Foo {} impl Foo { pub unsafe fn foo_const(&self) {} diff --git a/tests/unit/out/unsafe/global_init_side_effect.rs b/tests/unit/out/unsafe/global_init_side_effect.rs index 520676457e..bbfb6993d6 100644 --- a/tests/unit/out/unsafe/global_init_side_effect.rs +++ b/tests/unit/out/unsafe/global_init_side_effect.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; pub static mut total_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S {} impl S { pub unsafe fn new(mut x: i32) -> Self { diff --git a/tests/unit/out/unsafe/global_non_const_init.rs b/tests/unit/out/unsafe/global_non_const_init.rs index ee22f38b94..40d418bb82 100644 --- a/tests/unit/out/unsafe/global_non_const_init.rs +++ b/tests/unit/out/unsafe/global_non_const_init.rs @@ -28,7 +28,7 @@ pub static mut depends_on_call_6: std::cell::LazyCell = std::cell::LazyCell ((*std::cell::LazyCell::force_mut(&mut *&raw mut from_call_5)) + (1)) }); #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Ctor { pub v: i32, } @@ -64,7 +64,7 @@ pub static mut str_9: std::cell::LazyCell> = pub static mut inline_member_11: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { Ctor::new_2({ 5 }) }); #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Holder {} pub static mut member_10: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { (unsafe { next_0() }) }); @@ -77,7 +77,7 @@ pub unsafe fn local_static_12() -> i32 { + ((*std::cell::LazyCell::force_mut(&mut *&raw mut local_ctor_14)).v)); } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Singleton { pub hits: i32, } diff --git a/tests/unit/out/unsafe/global_pointers.rs b/tests/unit/out/unsafe/global_pointers.rs index 88ed3dd4f5..964ae40160 100644 --- a/tests/unit/out/unsafe/global_pointers.rs +++ b/tests/unit/out/unsafe/global_pointers.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Entry { pub name: *const libc::c_char, pub p: *mut i32, diff --git a/tests/unit/out/unsafe/global_without_initializer.rs b/tests/unit/out/unsafe/global_without_initializer.rs index 3f8ba77bd8..b787dfbacb 100644 --- a/tests/unit/out/unsafe/global_without_initializer.rs +++ b/tests/unit/out/unsafe/global_without_initializer.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a: i32, } diff --git a/tests/unit/out/unsafe/goto_aggregate_default.rs b/tests/unit/out/unsafe/goto_aggregate_default.rs index 522ab992c9..a0a37ecd02 100644 --- a/tests/unit/out/unsafe/goto_aggregate_default.rs +++ b/tests/unit/out/unsafe/goto_aggregate_default.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/goto_cleanup.rs b/tests/unit/out/unsafe/goto_cleanup.rs index fd6e6f9d3f..2a384b5b1f 100644 --- a/tests/unit/out/unsafe/goto_cleanup.rs +++ b/tests/unit/out/unsafe/goto_cleanup.rs @@ -74,7 +74,7 @@ pub unsafe fn from_switch_2(mut n: i32) -> i32 { panic!("ub: non-void function does not return a value") } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct wrapper { pub item: *mut i32, } diff --git a/tests/unit/out/unsafe/huffman.rs b/tests/unit/out/unsafe/huffman.rs index 2f7ff6f1ca..41f0511cd8 100644 --- a/tests/unit/out/unsafe/huffman.rs +++ b/tests/unit/out/unsafe/huffman.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct MinHeapNode { pub data: libc::c_char, pub freq: i32, diff --git a/tests/unit/out/unsafe/immutable-deref-on-func-call.rs b/tests/unit/out/unsafe/immutable-deref-on-func-call.rs index eee8d2c928..8c73ad9849 100644 --- a/tests/unit/out/unsafe/immutable-deref-on-func-call.rs +++ b/tests/unit/out/unsafe/immutable-deref-on-func-call.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Item { pub value: i32, } diff --git a/tests/unit/out/unsafe/implicit_autoref.rs b/tests/unit/out/unsafe/implicit_autoref.rs index af5d489fce..e4eed174ab 100644 --- a/tests/unit/out/unsafe/implicit_autoref.rs +++ b/tests/unit/out/unsafe/implicit_autoref.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Holder { pub v: Vec, } diff --git a/tests/unit/out/unsafe/in_class_field_initializer.rs b/tests/unit/out/unsafe/in_class_field_initializer.rs index 94627868bd..218bafb309 100644 --- a/tests/unit/out/unsafe/in_class_field_initializer.rs +++ b/tests/unit/out/unsafe/in_class_field_initializer.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Inner { pub x: i32, pub y: i32, @@ -18,7 +18,7 @@ impl Default for Inner { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S { pub a: i32, pub b: libc::c_char, @@ -36,7 +36,7 @@ impl Default for S { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Boxed_int_ { pub v: i32, pub tag: i32, diff --git a/tests/unit/out/unsafe/init.rs b/tests/unit/out/unsafe/init.rs index 78f74b321b..a7b6d36d19 100644 --- a/tests/unit/out/unsafe/init.rs +++ b/tests/unit/out/unsafe/init.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X { pub x: i32, } diff --git a/tests/unit/out/unsafe/kruskal.rs b/tests/unit/out/unsafe/kruskal.rs index 19d63264bf..51a0da37f4 100644 --- a/tests/unit/out/unsafe/kruskal.rs +++ b/tests/unit/out/unsafe/kruskal.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Edge { pub u: i32, pub v: i32, diff --git a/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs b/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs index 050c2dd1c1..942d060047 100644 --- a/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs +++ b/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive()] +#[derive(VaArg)] pub struct Counted { pub copies: i32, pub moves: i32, @@ -47,7 +47,7 @@ impl Default for Counted { } pub static mut drops_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive()] +#[derive(VaArg)] pub struct Dropped {} impl Dropped { pub unsafe fn new() -> Self { diff --git a/tests/unit/out/unsafe/lambda_capture_star_this.rs b/tests/unit/out/unsafe/lambda_capture_star_this.rs index c77accbeef..906a0cebea 100644 --- a/tests/unit/out/unsafe/lambda_capture_star_this.rs +++ b/tests/unit/out/unsafe/lambda_capture_star_this.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub n: i32, } diff --git a/tests/unit/out/unsafe/lambda_capture_this.rs b/tests/unit/out/unsafe/lambda_capture_this.rs index d7e78fe7f2..372d66b326 100644 --- a/tests/unit/out/unsafe/lambda_capture_this.rs +++ b/tests/unit/out/unsafe/lambda_capture_this.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub n: i32, pub step: i32, diff --git a/tests/unit/out/unsafe/lambda_nested.rs b/tests/unit/out/unsafe/lambda_nested.rs index 4d06b1e601..c6c02bfbe3 100644 --- a/tests/unit/out/unsafe/lambda_nested.rs +++ b/tests/unit/out/unsafe/lambda_nested.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/libc_struct_without_default.rs b/tests/unit/out/unsafe/libc_struct_without_default.rs index 9af37125ca..012d3f46f3 100644 --- a/tests/unit/out/unsafe/libc_struct_without_default.rs +++ b/tests/unit/out/unsafe/libc_struct_without_default.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Clone)] +#[derive(Clone, VaArg)] pub struct UserDefined { pub a: Vec, pub v: Vec, @@ -21,7 +21,7 @@ impl Default for UserDefined { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct FieldIsLibcType { pub addr: libc::sockaddr, } diff --git a/tests/unit/out/unsafe/linked_list.rs b/tests/unit/out/unsafe/linked_list.rs index bdfaa8c785..1a2765715e 100644 --- a/tests/unit/out/unsafe/linked_list.rs +++ b/tests/unit/out/unsafe/linked_list.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Node { pub val: i32, pub next: *mut Node, diff --git a/tests/unit/out/unsafe/local_anon_struct_collision.rs b/tests/unit/out/unsafe/local_anon_struct_collision.rs index c1e104d417..c42caac2e1 100644 --- a/tests/unit/out/unsafe/local_anon_struct_collision.rs +++ b/tests/unit/out/unsafe/local_anon_struct_collision.rs @@ -13,7 +13,7 @@ pub unsafe fn first_0() -> i32 { return ((p.x) + (p.y)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_1 { pub x: i32, pub y: i32, @@ -25,7 +25,7 @@ pub unsafe fn second_2() -> i32 { return (((q.a) + (q.b)) as i32); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_3 { pub a: i64, pub b: i64, diff --git a/tests/unit/out/unsafe/local_record_template.rs b/tests/unit/out/unsafe/local_record_template.rs index e1ca02ca61..6aba1dbbb0 100644 --- a/tests/unit/out/unsafe/local_record_template.rs +++ b/tests/unit/out/unsafe/local_record_template.rs @@ -30,12 +30,12 @@ pub unsafe fn wrap_10(mut v: i64) -> i32 { return (unsafe { get_6(l) }); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Local_5 { pub x: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Local_7 { pub x: i64, } @@ -44,7 +44,7 @@ pub unsafe fn other_11() -> i32 { return ((unsafe { get_0(l) }) + (l.y as i32)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Local_1 { pub x: i64, pub y: i64, @@ -65,7 +65,7 @@ unsafe fn main_0() -> i32 { return 0; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Local_3 { pub x: i32, } diff --git a/tests/unit/out/unsafe/memcpy_struct_bytes.rs b/tests/unit/out/unsafe/memcpy_struct_bytes.rs index c5ae26c19e..e74d99a88e 100644 --- a/tests/unit/out/unsafe/memcpy_struct_bytes.rs +++ b/tests/unit/out/unsafe/memcpy_struct_bytes.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/memcpy_struct_struct.rs b/tests/unit/out/unsafe/memcpy_struct_struct.rs index 80d31fde3d..5274ff4e42 100644 --- a/tests/unit/out/unsafe/memcpy_struct_struct.rs +++ b/tests/unit/out/unsafe/memcpy_struct_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Entry { pub bits: u8, pub value: u16, diff --git a/tests/unit/out/unsafe/move_ctor.rs b/tests/unit/out/unsafe/move_ctor.rs index 729f935021..cd80ca4ef2 100644 --- a/tests/unit/out/unsafe/move_ctor.rs +++ b/tests/unit/out/unsafe/move_ctor.rs @@ -51,7 +51,7 @@ impl Default for ConstMove { } } #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct ThrowingMove { pub v: i32, pub copies: i32, @@ -90,7 +90,7 @@ impl Clone for ThrowingMove { } } #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct NoexceptMove { pub v: i32, pub copies: i32, diff --git a/tests/unit/out/unsafe/move_this.rs b/tests/unit/out/unsafe/move_this.rs index 0d47e4f951..261dc5d7b0 100644 --- a/tests/unit/out/unsafe/move_this.rs +++ b/tests/unit/out/unsafe/move_this.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Default)] +#[derive(VaArg, Default)] pub struct Chain { pub v: i32, } diff --git a/tests/unit/out/unsafe/nested_structs.rs b/tests/unit/out/unsafe/nested_structs.rs index 30f8bd5061..34f2640ea4 100644 --- a/tests/unit/out/unsafe/nested_structs.rs +++ b/tests/unit/out/unsafe/nested_structs.rs @@ -7,34 +7,34 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0_Level1_1_Level2_1_Level3_1 { pub x1: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0_Level1_1_Level2_1_Level3_2 { pub x1: i32, pub x2: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0_Level1_1_Level2_1 { pub x1: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0_Level1_1 { pub x1: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0_Level1_2 { pub x1: i32, pub x2: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Level0 {} pub fn main() { unsafe { diff --git a/tests/unit/out/unsafe/new.rs b/tests/unit/out/unsafe/new.rs index 8cd8f319c9..e030d5200d 100644 --- a/tests/unit/out/unsafe/new.rs +++ b/tests/unit/out/unsafe/new.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/new_bst.rs b/tests/unit/out/unsafe/new_bst.rs index b402927f5a..43fa336d27 100644 --- a/tests/unit/out/unsafe/new_bst.rs +++ b/tests/unit/out/unsafe/new_bst.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node_t { pub left: *mut node_t, pub right: *mut node_t, diff --git a/tests/unit/out/unsafe/new_struct.rs b/tests/unit/out/unsafe/new_struct.rs index 0cff57ae66..16f30b7d25 100644 --- a/tests/unit/out/unsafe/new_struct.rs +++ b/tests/unit/out/unsafe/new_struct.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub x: i32, pub y: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Triple { pub a: i32, pub b: i32, diff --git a/tests/unit/out/unsafe/offsetof.rs b/tests/unit/out/unsafe/offsetof.rs index 39be734970..0c870f9fba 100644 --- a/tests/unit/out/unsafe/offsetof.rs +++ b/tests/unit/out/unsafe/offsetof.rs @@ -7,14 +7,14 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Layout { pub a: u8, pub b: u32, pub c: u16, } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Frame { pub tag: u16, pub body: [libc::c_char; 64], diff --git a/tests/unit/out/unsafe/opaque_forward_decl.rs b/tests/unit/out/unsafe/opaque_forward_decl.rs index 034cea072b..9b59a9bc5d 100644 --- a/tests/unit/out/unsafe/opaque_forward_decl.rs +++ b/tests/unit/out/unsafe/opaque_forward_decl.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct container { pub p: *mut opaque, pub x: i32, diff --git a/tests/unit/out/unsafe/opaque_record_copy.rs b/tests/unit/out/unsafe/opaque_record_copy.rs index 085e35d7d9..10ca506681 100644 --- a/tests/unit/out/unsafe/opaque_record_copy.rs +++ b/tests/unit/out/unsafe/opaque_record_copy.rs @@ -7,10 +7,10 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Probe {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Wrapper_Probe_ { pub base_: Probe, pub tag: i32, diff --git a/tests/unit/out/unsafe/opaque_then_defined.rs b/tests/unit/out/unsafe/opaque_then_defined.rs index ba00f09b49..501ceb39b7 100644 --- a/tests/unit/out/unsafe/opaque_then_defined.rs +++ b/tests/unit/out/unsafe/opaque_then_defined.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct list { pub head: *mut node, pub size: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node { pub value: i32, pub next: *mut node, diff --git a/tests/unit/out/unsafe/operator_arithmetic_free.rs b/tests/unit/out/unsafe/operator_arithmetic_free.rs index 01a1a6e1f4..8654f6d007 100644 --- a/tests/unit/out/unsafe/operator_arithmetic_free.rs +++ b/tests/unit/out/unsafe/operator_arithmetic_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_arithmetic_member.rs b/tests/unit/out/unsafe/operator_arithmetic_member.rs index b441aed14d..04c45a0d15 100644 --- a/tests/unit/out/unsafe/operator_arithmetic_member.rs +++ b/tests/unit/out/unsafe/operator_arithmetic_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_bitwise_free.rs b/tests/unit/out/unsafe/operator_bitwise_free.rs index ef4ec64e6c..a9b5ae8698 100644 --- a/tests/unit/out/unsafe/operator_bitwise_free.rs +++ b/tests/unit/out/unsafe/operator_bitwise_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: u32, } diff --git a/tests/unit/out/unsafe/operator_bitwise_member.rs b/tests/unit/out/unsafe/operator_bitwise_member.rs index 379a839765..7ec2dbb11c 100644 --- a/tests/unit/out/unsafe/operator_bitwise_member.rs +++ b/tests/unit/out/unsafe/operator_bitwise_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: u32, } diff --git a/tests/unit/out/unsafe/operator_comparison_defaulted.rs b/tests/unit/out/unsafe/operator_comparison_defaulted.rs index 6643bfaf82..7bf9e9b538 100644 --- a/tests/unit/out/unsafe/operator_comparison_defaulted.rs +++ b/tests/unit/out/unsafe/operator_comparison_defaulted.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Eq { pub a: i32, pub b: i32, @@ -25,7 +25,7 @@ impl std::cmp::PartialEq for Eq { } impl std::cmp::Eq for Eq {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Cmp { pub a: i32, pub b: i32, @@ -70,7 +70,7 @@ impl std::cmp::PartialEq for Cmp { } impl std::cmp::Eq for Cmp {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Both { pub a: i32, } @@ -106,7 +106,7 @@ impl std::cmp::PartialEq for Both { } impl std::cmp::Eq for Both {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct OrdOnly { pub a: i32, } @@ -139,7 +139,7 @@ impl std::cmp::PartialEq for OrdOnly { } impl std::cmp::Eq for OrdOnly {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub x: i32, } @@ -175,7 +175,7 @@ impl std::cmp::PartialEq for Inner { } impl std::cmp::Eq for Inner {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub i: Inner, pub y: i32, @@ -224,7 +224,7 @@ impl std::cmp::PartialEq for Outer { } impl std::cmp::Eq for Outer {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Secondary { pub a: i32, } @@ -278,7 +278,7 @@ impl std::cmp::PartialEq for Secondary { } impl std::cmp::Eq for Secondary {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct PtrMember { pub p: *mut i32, } diff --git a/tests/unit/out/unsafe/operator_comparison_free.rs b/tests/unit/out/unsafe/operator_comparison_free.rs index d86a6ad3b9..3050380037 100644 --- a/tests/unit/out/unsafe/operator_comparison_free.rs +++ b/tests/unit/out/unsafe/operator_comparison_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } @@ -60,7 +60,7 @@ pub unsafe fn operator_lt_7(mut a: i32, b: *const S) -> bool { return ((a) < ((*b).v)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct V { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_comparison_member.rs b/tests/unit/out/unsafe/operator_comparison_member.rs index 946888fefc..64af07f988 100644 --- a/tests/unit/out/unsafe/operator_comparison_member.rs +++ b/tests/unit/out/unsafe/operator_comparison_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_comparison_mixed.rs b/tests/unit/out/unsafe/operator_comparison_mixed.rs index dedb10c477..6530037c1d 100644 --- a/tests/unit/out/unsafe/operator_comparison_mixed.rs +++ b/tests/unit/out/unsafe/operator_comparison_mixed.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_compound_assignment_free.rs b/tests/unit/out/unsafe/operator_compound_assignment_free.rs index f0f0d5a561..a4c4254739 100644 --- a/tests/unit/out/unsafe/operator_compound_assignment_free.rs +++ b/tests/unit/out/unsafe/operator_compound_assignment_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: u32, } diff --git a/tests/unit/out/unsafe/operator_compound_assignment_member.rs b/tests/unit/out/unsafe/operator_compound_assignment_member.rs index 40fbc78c00..a21c693f23 100644 --- a/tests/unit/out/unsafe/operator_compound_assignment_member.rs +++ b/tests/unit/out/unsafe/operator_compound_assignment_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: u32, } diff --git a/tests/unit/out/unsafe/operator_friend.rs b/tests/unit/out/unsafe/operator_friend.rs index 1ed60df8ed..f3019537d4 100644 --- a/tests/unit/out/unsafe/operator_friend.rs +++ b/tests/unit/out/unsafe/operator_friend.rs @@ -10,7 +10,7 @@ pub unsafe fn operator_eq_0(_a0: *const Defaulted, _a1: *const Defaulted) -> boo return (((*_a0).a) == ((*_a1).a)) && (((*_a0).b) == ((*_a1).b)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Defaulted { pub a: i32, pub b: i32, @@ -37,7 +37,7 @@ pub unsafe fn operator_eq_2(_a0: *const DefaultedOrd, _a1: *const DefaultedOrd) return (((*_a0).a) == ((*_a1).a)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct DefaultedOrd { pub a: i32, } @@ -69,7 +69,7 @@ pub unsafe fn operator_add_5(x: *const Inline, y: *const Inline) -> Inline { }; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inline { pub a: i32, } @@ -98,7 +98,7 @@ impl std::cmp::PartialEq for Inline { } impl std::cmp::Eq for Inline {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct OutOfLine { pub a: i32, } @@ -128,7 +128,7 @@ pub unsafe fn operator_eq_10(x: *const Tmpl_int_, y: *const Tmpl_long_) -> bool return (((*x).v as i64) == ((*y).v)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Tmpl_int_ { pub v: i32, } @@ -157,7 +157,7 @@ impl std::cmp::PartialEq for Tmpl_int_ { } impl std::cmp::Eq for Tmpl_int_ {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Tmpl_long_ { pub v: i64, } @@ -168,7 +168,7 @@ pub unsafe fn operator_eq_11( return (((*_a0).v) == ((*_a1).v)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct TmplDefaulted_int_ { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_less_than.rs b/tests/unit/out/unsafe/operator_less_than.rs index 7d8dd400dc..8eb549eb93 100644 --- a/tests/unit/out/unsafe/operator_less_than.rs +++ b/tests/unit/out/unsafe/operator_less_than.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/operator_logical_free.rs b/tests/unit/out/unsafe/operator_logical_free.rs index 176f335b9d..180a4cdc2e 100644 --- a/tests/unit/out/unsafe/operator_logical_free.rs +++ b/tests/unit/out/unsafe/operator_logical_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_logical_member.rs b/tests/unit/out/unsafe/operator_logical_member.rs index 3c97c6f6c7..689fdcbcf0 100644 --- a/tests/unit/out/unsafe/operator_logical_member.rs +++ b/tests/unit/out/unsafe/operator_logical_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_member_pointer_free.rs b/tests/unit/out/unsafe/operator_member_pointer_free.rs index 308f1c5a96..4890b19917 100644 --- a/tests/unit/out/unsafe/operator_member_pointer_free.rs +++ b/tests/unit/out/unsafe/operator_member_pointer_free.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub x: i32, } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S { pub data: [i32; 3], pub inner: Inner, diff --git a/tests/unit/out/unsafe/operator_member_pointer_member.rs b/tests/unit/out/unsafe/operator_member_pointer_member.rs index 59f1153f64..267179dd4a 100644 --- a/tests/unit/out/unsafe/operator_member_pointer_member.rs +++ b/tests/unit/out/unsafe/operator_member_pointer_member.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub x: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Table {} impl Table { pub unsafe fn operator_index(mut i: i32) -> *mut i32 { @@ -22,7 +22,7 @@ impl Table { pub static mut table_0: std::cell::LazyCell<[i32; 3]> = std::cell::LazyCell::new(|| unsafe { [7, 8, 9] }); #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S { pub data: [i32; 3], pub inner: Inner, diff --git a/tests/unit/out/unsafe/operator_other_free.rs b/tests/unit/out/unsafe/operator_other_free.rs index eb1f4e6bf1..66ca4394c8 100644 --- a/tests/unit/out/unsafe/operator_other_free.rs +++ b/tests/unit/out/unsafe/operator_other_free.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_other_member.rs b/tests/unit/out/unsafe/operator_other_member.rs index 4a4502f105..fa9552a05b 100644 --- a/tests/unit/out/unsafe/operator_other_member.rs +++ b/tests/unit/out/unsafe/operator_other_member.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Static {} impl Static { pub unsafe fn operator_call(mut a: i32, mut b: i32) -> i32 { @@ -15,7 +15,7 @@ impl Static { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_overloads.rs b/tests/unit/out/unsafe/operator_overloads.rs index a6e7425619..ac6c4a1b31 100644 --- a/tests/unit/out/unsafe/operator_overloads.rs +++ b/tests/unit/out/unsafe/operator_overloads.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_qualifiers.rs b/tests/unit/out/unsafe/operator_qualifiers.rs index 85e663d42b..1f6654f166 100644 --- a/tests/unit/out/unsafe/operator_qualifiers.rs +++ b/tests/unit/out/unsafe/operator_qualifiers.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_three_way.rs b/tests/unit/out/unsafe/operator_three_way.rs index 7ded6102f1..4601067dc5 100644 --- a/tests/unit/out/unsafe/operator_three_way.rs +++ b/tests/unit/out/unsafe/operator_three_way.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub v: i32, } diff --git a/tests/unit/out/unsafe/operator_traits.rs b/tests/unit/out/unsafe/operator_traits.rs index 8c33a83507..9f1a9b7ea6 100644 --- a/tests/unit/out/unsafe/operator_traits.rs +++ b/tests/unit/out/unsafe/operator_traits.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Lt { pub v: i32, } @@ -44,7 +44,7 @@ impl std::cmp::PartialEq for Lt { } impl std::cmp::Eq for Lt {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Eq { pub v: i32, } @@ -60,7 +60,7 @@ impl std::cmp::PartialEq for Eq { } impl std::cmp::Eq for Eq {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Cmp { pub v: i32, } @@ -89,7 +89,7 @@ impl std::cmp::PartialEq for Cmp { } impl std::cmp::Eq for Cmp {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Free { pub v: i32, } @@ -124,7 +124,7 @@ pub unsafe fn operator_eq_1(a: *const Free, b: *const Free) -> bool { return (((*a).v) == ((*b).v)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Wrapped_int_ { pub v: i32, } diff --git a/tests/unit/out/unsafe/overload_mangling.rs b/tests/unit/out/unsafe/overload_mangling.rs index a93a3b63dc..6ac504645b 100644 --- a/tests/unit/out/unsafe/overload_mangling.rs +++ b/tests/unit/out/unsafe/overload_mangling.rs @@ -16,7 +16,7 @@ pub unsafe fn twice_2(mut n: i32) -> i32 { return ((n) * (2)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub base: i32, } @@ -82,7 +82,7 @@ impl S { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Box { pub v: i32, } diff --git a/tests/unit/out/unsafe/pod.rs b/tests/unit/out/unsafe/pod.rs index 00ea9c182b..e4f500c829 100644 --- a/tests/unit/out/unsafe/pod.rs +++ b/tests/unit/out/unsafe/pod.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct POD { pub x1: i32, pub x2: i32, diff --git a/tests/unit/out/unsafe/pointer_array.rs b/tests/unit/out/unsafe/pointer_array.rs index 1689684b9b..e94b79e07c 100644 --- a/tests/unit/out/unsafe/pointer_array.rs +++ b/tests/unit/out/unsafe/pointer_array.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct StackArray { pub arr: [*mut i32; 3], } diff --git a/tests/unit/out/unsafe/pointers.rs b/tests/unit/out/unsafe/pointers.rs index dbc4ec662f..c010822a38 100644 --- a/tests/unit/out/unsafe/pointers.rs +++ b/tests/unit/out/unsafe/pointers.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Test { pub x: i32, } diff --git a/tests/unit/out/unsafe/polymorphism.rs b/tests/unit/out/unsafe/polymorphism.rs index 4296f8adf8..c5091fe4ac 100644 --- a/tests/unit/out/unsafe/polymorphism.rs +++ b/tests/unit/out/unsafe/polymorphism.rs @@ -10,10 +10,10 @@ pub unsafe trait Animal { unsafe fn bark(&self) -> bool; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Dog {} #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Cat {} impl Cat { unsafe fn meow(&self) -> bool { diff --git a/tests/unit/out/unsafe/ptr_cast_init.rs b/tests/unit/out/unsafe/ptr_cast_init.rs index d2df72491a..13f5f4064d 100644 --- a/tests/unit/out/unsafe/ptr_cast_init.rs +++ b/tests/unit/out/unsafe/ptr_cast_init.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct header { pub tag: i32, pub size: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct view { pub tag: i32, } diff --git a/tests/unit/out/unsafe/push_emplace_back.rs b/tests/unit/out/unsafe/push_emplace_back.rs index 3c1e7f1503..e4142bd821 100644 --- a/tests/unit/out/unsafe/push_emplace_back.rs +++ b/tests/unit/out/unsafe/push_emplace_back.rs @@ -7,18 +7,18 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Chunk { pub data: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Writer { pub output: *mut Vec, pub chunk: Chunk, } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct JPEGData { pub com_data: Vec>, pub app_data: Vec>, @@ -82,7 +82,7 @@ pub unsafe fn self_ref_push_6(mut comps: *mut Vec) { }; } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Pair { pub first: i32, pub second: i32, diff --git a/tests/unit/out/unsafe/random.rs b/tests/unit/out/unsafe/random.rs index b283bd0b74..42805b9485 100644 --- a/tests/unit/out/unsafe/random.rs +++ b/tests/unit/out/unsafe/random.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct Pair { pub x: i32, pub y: i32, @@ -54,7 +54,7 @@ pub unsafe fn zero_0() -> i32 { return 0; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct X1 {} pub unsafe fn foo_1(mut x1: i32, x2: *mut i32, mut x3: *mut i32, p2: *mut Pair, mut p3: *mut Pair) { } diff --git a/tests/unit/out/unsafe/reference_wrapper.rs b/tests/unit/out/unsafe/reference_wrapper.rs index 0e55e8a50f..e8e610a65c 100644 --- a/tests/unit/out/unsafe/reference_wrapper.rs +++ b/tests/unit/out/unsafe/reference_wrapper.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/refs_as_args.rs b/tests/unit/out/unsafe/refs_as_args.rs index 0d6d91a1af..a28c508b42 100644 --- a/tests/unit/out/unsafe/refs_as_args.rs +++ b/tests/unit/out/unsafe/refs_as_args.rs @@ -18,7 +18,7 @@ pub unsafe fn more_refs_0(mut x1: i32, mut x2: i32, r1: *mut i32, r2: *const i32 (*r1) = (*rx2); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Val { pub x: i32, } diff --git a/tests/unit/out/unsafe/reinterpret_cast_struct.rs b/tests/unit/out/unsafe/reinterpret_cast_struct.rs index e92e19a786..96b08fc0f6 100644 --- a/tests/unit/out/unsafe/reinterpret_cast_struct.rs +++ b/tests/unit/out/unsafe/reinterpret_cast_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/reinterpret_cast_struct_to_struct.rs b/tests/unit/out/unsafe/reinterpret_cast_struct_to_struct.rs index cbc43d90e0..0bf207c53d 100644 --- a/tests/unit/out/unsafe/reinterpret_cast_struct_to_struct.rs +++ b/tests/unit/out/unsafe/reinterpret_cast_struct_to_struct.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: u32, pub y: u32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub first: u32, pub second: u32, diff --git a/tests/unit/out/unsafe/reserved_keywords.rs b/tests/unit/out/unsafe/reserved_keywords.rs index ee6a7fe1d3..20f7011d1b 100644 --- a/tests/unit/out/unsafe/reserved_keywords.rs +++ b/tests/unit/out/unsafe/reserved_keywords.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub as_: i32, pub async_: i32, diff --git a/tests/unit/out/unsafe/rule_of_five.rs b/tests/unit/out/unsafe/rule_of_five.rs index dabd88343b..6bc96a8264 100644 --- a/tests/unit/out/unsafe/rule_of_five.rs +++ b/tests/unit/out/unsafe/rule_of_five.rs @@ -10,7 +10,7 @@ pub static mut alive_0: std::cell::LazyCell = std::cell::LazyCell::new(|| u pub static mut copies_1: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); pub static mut moves_2: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive()] +#[derive(VaArg)] pub struct Buffer { pub data: [i32; 4], pub size: i32, diff --git a/tests/unit/out/unsafe/rule_of_three.rs b/tests/unit/out/unsafe/rule_of_three.rs index 3863734899..557eae1b9a 100644 --- a/tests/unit/out/unsafe/rule_of_three.rs +++ b/tests/unit/out/unsafe/rule_of_three.rs @@ -9,7 +9,7 @@ use std::rc::Rc; pub static mut alive_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); pub static mut copies_1: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); #[repr(C)] -#[derive()] +#[derive(VaArg)] pub struct Buffer { pub data: [i32; 4], pub size: i32, diff --git a/tests/unit/out/unsafe/rvalue_struct.rs b/tests/unit/out/unsafe/rvalue_struct.rs index 18eccbc40f..681e94688e 100644 --- a/tests/unit/out/unsafe/rvalue_struct.rs +++ b/tests/unit/out/unsafe/rvalue_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a: i32, pub b: i32, diff --git a/tests/unit/out/unsafe/scalar_builtin_construct_destruct.rs b/tests/unit/out/unsafe/scalar_builtin_construct_destruct.rs index 03987f8466..aa73f3c468 100644 --- a/tests/unit/out/unsafe/scalar_builtin_construct_destruct.rs +++ b/tests/unit/out/unsafe/scalar_builtin_construct_destruct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pod { pub v: i32, } diff --git a/tests/unit/out/unsafe/static_var_in_class.rs b/tests/unit/out/unsafe/static_var_in_class.rs index 82cd4a1698..1293bb8597 100644 --- a/tests/unit/out/unsafe/static_var_in_class.rs +++ b/tests/unit/out/unsafe/static_var_in_class.rs @@ -8,7 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; static mut inner_const_0: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 1 }); #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct C {} impl C { pub unsafe fn get(&mut self) -> i32 { @@ -19,7 +19,7 @@ pub static mut inner_const_1: std::cell::LazyCell = std::cell::LazyCell::ne pub type anon_3 = u32; pub const anon_3_kValue: anon_3 = 3; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S {} impl S { pub unsafe fn f() -> i32 { diff --git a/tests/unit/out/unsafe/strdup.rs b/tests/unit/out/unsafe/strdup.rs index 216ebc40f8..9180cea577 100644 --- a/tests/unit/out/unsafe/strdup.rs +++ b/tests/unit/out/unsafe/strdup.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct record { pub name: *mut libc::c_char, } diff --git a/tests/unit/out/unsafe/string_literal_ptr_init.rs b/tests/unit/out/unsafe/string_literal_ptr_init.rs index 158debef2e..bf7ffb5ee8 100644 --- a/tests/unit/out/unsafe/string_literal_ptr_init.rs +++ b/tests/unit/out/unsafe/string_literal_ptr_init.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct label { pub name: *const libc::c_char, pub probe: Option i32>, diff --git a/tests/unit/out/unsafe/struct_ctor.rs b/tests/unit/out/unsafe/struct_ctor.rs index 568cddfd34..fe1e37d8b8 100644 --- a/tests/unit/out/unsafe/struct_ctor.rs +++ b/tests/unit/out/unsafe/struct_ctor.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct StructWithCtor { x1_: i32, x2_: i32, diff --git a/tests/unit/out/unsafe/struct_default_ctor.rs b/tests/unit/out/unsafe/struct_default_ctor.rs index ed788786ed..fc9b47eef7 100644 --- a/tests/unit/out/unsafe/struct_default_ctor.rs +++ b/tests/unit/out/unsafe/struct_default_ctor.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct S { pub a: i32, pub b: bool, @@ -24,7 +24,7 @@ impl Default for S { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Declared { pub v: i32, } diff --git a/tests/unit/out/unsafe/struct_ptr.rs b/tests/unit/out/unsafe/struct_ptr.rs index 04d274f4cf..c25d2d0b93 100644 --- a/tests/unit/out/unsafe/struct_ptr.rs +++ b/tests/unit/out/unsafe/struct_ptr.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct XX { pub x: i32, } diff --git a/tests/unit/out/unsafe/tag_vs_identifier_collision.rs b/tests/unit/out/unsafe/tag_vs_identifier_collision.rs index ab8ba8bcb4..a5d7e9e3cb 100644 --- a/tests/unit/out/unsafe/tag_vs_identifier_collision.rs +++ b/tests/unit/out/unsafe/tag_vs_identifier_collision.rs @@ -11,13 +11,13 @@ pub const widget_enum_MODE_IDLE: widget_enum = 0; pub const widget_enum_MODE_ACTIVE: widget_enum = 1; pub const widget_enum_MODE_DONE: widget_enum = 2; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct widget { pub id: i32, pub mode: widget_enum, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct point_struct { pub x: i32, pub y: i32, @@ -48,17 +48,17 @@ pub type slot = u32; pub const slot_SLOT_A: slot = 0; pub const slot_SLOT_B: slot = 1; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub tag_field: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub field: Inner, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner_struct { pub typedef_field: i32, } diff --git a/tests/unit/out/unsafe/template_default_arg.rs b/tests/unit/out/unsafe/template_default_arg.rs index 72e51f1f9b..e92dcc1a51 100644 --- a/tests/unit/out/unsafe/template_default_arg.rs +++ b/tests/unit/out/unsafe/template_default_arg.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct A { pub v: i32, } @@ -27,7 +27,7 @@ impl Default for A { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct B { pub v: i32, } @@ -43,7 +43,7 @@ impl Default for B { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct NoDefault { pub v: i32, } @@ -69,7 +69,7 @@ pub unsafe fn always_given_3(mut x: NoDefault) -> i32 { return x.v; } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S_NoDefault_ { pub v: i32, } diff --git a/tests/unit/out/unsafe/this.rs b/tests/unit/out/unsafe/this.rs index cb7f69fe29..bc0159a8fc 100644 --- a/tests/unit/out/unsafe/this.rs +++ b/tests/unit/out/unsafe/this.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub a_: i32, pub self__: *mut S, @@ -100,7 +100,7 @@ pub unsafe fn bump_0(mut p: *mut S) { (*p).a_.postfix_inc(); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct D { pub a_: i32, } diff --git a/tests/unit/out/unsafe/typedef-anon-struct.rs b/tests/unit/out/unsafe/typedef-anon-struct.rs index 44d6a9cfb1..fa4b0cf664 100644 --- a/tests/unit/out/unsafe/typedef-anon-struct.rs +++ b/tests/unit/out/unsafe/typedef-anon-struct.rs @@ -7,13 +7,13 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer_RunInfo { pub block_idx: i32, pub num_extra_zero_runs: i32, } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct Outer { pub runs: Vec, } diff --git a/tests/unit/out/unsafe/unary_expr_or_type_trait.rs b/tests/unit/out/unsafe/unary_expr_or_type_trait.rs index 4f76b9ceef..000608e50a 100644 --- a/tests/unit/out/unsafe/unary_expr_or_type_trait.rs +++ b/tests/unit/out/unsafe/unary_expr_or_type_trait.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C, align(16))] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct S { pub c: libc::c_char, pub x: i64, diff --git a/tests/unit/out/unsafe/union_addrof_external.rs b/tests/unit/out/unsafe/union_addrof_external.rs index 8bf37c2563..93bf1e1b78 100644 --- a/tests/unit/out/unsafe/union_addrof_external.rs +++ b/tests/unit/out/unsafe/union_addrof_external.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct record { pub code: u16, pub lo: u16, @@ -36,7 +36,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Container { pub view: anon_0, } diff --git a/tests/unit/out/unsafe/union_cross_arm_cast.rs b/tests/unit/out/unsafe/union_cross_arm_cast.rs index fe98da0971..f5e784dd69 100644 --- a/tests/unit/out/unsafe/union_cross_arm_cast.rs +++ b/tests/unit/out/unsafe/union_cross_arm_cast.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct shape_a { pub code: u16, pub pad: [libc::c_char; 14], @@ -21,7 +21,7 @@ impl Default for shape_a { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct shape_b { pub code: u16, pub lo: u16, @@ -53,7 +53,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Container { pub len: u32, pub u: anon_0, diff --git a/tests/unit/out/unsafe/union_field_alignment.rs b/tests/unit/out/unsafe/union_field_alignment.rs index 580c093ba0..e725f8b717 100644 --- a/tests/unit/out/unsafe/union_field_alignment.rs +++ b/tests/unit/out/unsafe/union_field_alignment.rs @@ -18,7 +18,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node { pub next: *mut node, pub x: anon_0, diff --git a/tests/unit/out/unsafe/union_flex_array_member.rs b/tests/unit/out/unsafe/union_flex_array_member.rs index 4432e3ee9d..629435f7df 100644 --- a/tests/unit/out/unsafe/union_flex_array_member.rs +++ b/tests/unit/out/unsafe/union_flex_array_member.rs @@ -18,7 +18,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node { pub len: usize, pub pos: usize, diff --git a/tests/unit/out/unsafe/union_memset_memcpy.rs b/tests/unit/out/unsafe/union_memset_memcpy.rs index 373f70f385..3be87f28b7 100644 --- a/tests/unit/out/unsafe/union_memset_memcpy.rs +++ b/tests/unit/out/unsafe/union_memset_memcpy.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct shape_a { pub code: u16, pub pad: [libc::c_char; 14], @@ -21,7 +21,7 @@ impl Default for shape_a { } } #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct shape_b { pub code: u16, pub lo: u16, @@ -51,7 +51,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Container { pub view: anon_0, } diff --git a/tests/unit/out/unsafe/union_nested.rs b/tests/unit/out/unsafe/union_nested.rs index 14481281e4..6baf1d197d 100644 --- a/tests/unit/out/unsafe/union_nested.rs +++ b/tests/unit/out/unsafe/union_nested.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Copy, Clone, VaArg)] pub struct record { pub code: u16, pub pad: [libc::c_char; 14], @@ -32,7 +32,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct inner { pub view: anon_0, } @@ -48,7 +48,7 @@ impl Default for anon_1 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub kind: i32, pub level: i32, diff --git a/tests/unit/out/unsafe/union_pointer_pun_address.rs b/tests/unit/out/unsafe/union_pointer_pun_address.rs index f0f0b8e820..45c19d78bb 100644 --- a/tests/unit/out/unsafe/union_pointer_pun_address.rs +++ b/tests/unit/out/unsafe/union_pointer_pun_address.rs @@ -7,12 +7,12 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node_a { pub n: i32, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node_b { pub data: *mut ::libc::c_void, pub next: *mut node_b, diff --git a/tests/unit/out/unsafe/union_struct_dual_use.rs b/tests/unit/out/unsafe/union_struct_dual_use.rs index a5171c872f..d366f5943f 100644 --- a/tests/unit/out/unsafe/union_struct_dual_use.rs +++ b/tests/unit/out/unsafe/union_struct_dual_use.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub a: i32, pub b: i32, @@ -27,7 +27,7 @@ impl Default for anon_1 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Outer { pub u: anon_1, } diff --git a/tests/unit/out/unsafe/union_tagged_many_arms.rs b/tests/unit/out/unsafe/union_tagged_many_arms.rs index fb880a6484..0ad834b8bd 100644 --- a/tests/unit/out/unsafe/union_tagged_many_arms.rs +++ b/tests/unit/out/unsafe/union_tagged_many_arms.rs @@ -27,7 +27,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Slot { pub tag: Tag_enum, pub payload: anon_0, diff --git a/tests/unit/out/unsafe/union_tagged_simple.rs b/tests/unit/out/unsafe/union_tagged_simple.rs index 21de983a3a..6e8b94c285 100644 --- a/tests/unit/out/unsafe/union_tagged_simple.rs +++ b/tests/unit/out/unsafe/union_tagged_simple.rs @@ -21,7 +21,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Event { pub kind: Kind_enum, pub handle: *mut ::libc::c_void, diff --git a/tests/unit/out/unsafe/union_tagged_struct_arms.rs b/tests/unit/out/unsafe/union_tagged_struct_arms.rs index 8a86d68b06..1cdc8b892b 100644 --- a/tests/unit/out/unsafe/union_tagged_struct_arms.rs +++ b/tests/unit/out/unsafe/union_tagged_struct_arms.rs @@ -11,14 +11,14 @@ pub const Choice_enum_C_LIST: Choice_enum = 1; pub const Choice_enum_C_LETTERS: Choice_enum = 2; pub const Choice_enum_C_INTEGERS: Choice_enum = 3; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_1 { pub items: *mut *mut libc::c_char, pub count: i64, pub cursor: i64, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_2 { pub lo: i32, pub hi: i32, @@ -26,7 +26,7 @@ pub struct anon_2 { pub step: u8, } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct anon_3 { pub lo: i64, pub hi: i64, @@ -47,7 +47,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Branch { pub choice: Choice_enum, pub index: i32, diff --git a/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs b/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs index 28a14022b6..4a738ee538 100644 --- a/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs +++ b/tests/unit/out/unsafe/union_void_ptr_sized_deref.rs @@ -24,7 +24,7 @@ impl Default for anon_0 { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Sink { pub width: Width_enum, pub out: anon_0, diff --git a/tests/unit/out/unsafe/unique_ptr.rs b/tests/unit/out/unsafe/unique_ptr.rs index 197fe41bd9..d0e8a5c330 100644 --- a/tests/unit/out/unsafe/unique_ptr.rs +++ b/tests/unit/out/unsafe/unique_ptr.rs @@ -27,7 +27,7 @@ impl SafePointer { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Pair { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/unique_ptr_nested.rs b/tests/unit/out/unsafe/unique_ptr_nested.rs index 596fa235fd..8304b5feda 100644 --- a/tests/unit/out/unsafe/unique_ptr_nested.rs +++ b/tests/unit/out/unsafe/unique_ptr_nested.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Inner { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/unique_ptr_struct.rs b/tests/unit/out/unsafe/unique_ptr_struct.rs index a17a15df17..5938b778f6 100644 --- a/tests/unit/out/unsafe/unique_ptr_struct.rs +++ b/tests/unit/out/unsafe/unique_ptr_struct.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Point { pub x: i32, pub y: i32, diff --git a/tests/unit/out/unsafe/va_arg_mixed_types.rs b/tests/unit/out/unsafe/va_arg_mixed_types.rs index aecfc8e7e0..27bef95ee1 100644 --- a/tests/unit/out/unsafe/va_arg_mixed_types.rs +++ b/tests/unit/out/unsafe/va_arg_mixed_types.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct pair { pub a: i32, pub b: i32, diff --git a/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs b/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs index 65c520839a..cd3e078570 100644 --- a/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs +++ b/tests/unit/out/unsafe/va_arg_non_primitive_ptrs.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct node { pub data: i32, pub next: *mut node, diff --git a/tests/unit/out/unsafe/va_arg_struct_ctx.rs b/tests/unit/out/unsafe/va_arg_struct_ctx.rs index 23f38305e9..dd1f97e8c0 100644 --- a/tests/unit/out/unsafe/va_arg_struct_ctx.rs +++ b/tests/unit/out/unsafe/va_arg_struct_ctx.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct context { pub verbose: i32, pub last_error: i32, diff --git a/tests/unit/out/unsafe/va_arg_void_ptr.rs b/tests/unit/out/unsafe/va_arg_void_ptr.rs index a689103354..6dd4d539f9 100644 --- a/tests/unit/out/unsafe/va_arg_void_ptr.rs +++ b/tests/unit/out/unsafe/va_arg_void_ptr.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct registry { pub slot: *mut ::libc::c_void, pub level: i64, diff --git a/tests/unit/out/unsafe/vector_with_allocator.rs b/tests/unit/out/unsafe/vector_with_allocator.rs index 332dd9a843..ade5713fb4 100644 --- a/tests/unit/out/unsafe/vector_with_allocator.rs +++ b/tests/unit/out/unsafe/vector_with_allocator.rs @@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct TestAllocator_int_ {} impl TestAllocator_int_ { pub unsafe fn allocate(&mut self, mut n: usize) -> *mut i32 { @@ -21,7 +21,7 @@ impl TestAllocator_int_ { } } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct TestAllocator_double_ {} impl TestAllocator_double_ { pub unsafe fn allocate(&mut self, mut n: usize) -> *mut f64 { diff --git a/tests/unit/out/unsafe/void_cast.rs b/tests/unit/out/unsafe/void_cast.rs index 56e4e485db..4e57a34498 100644 --- a/tests/unit/out/unsafe/void_cast.rs +++ b/tests/unit/out/unsafe/void_cast.rs @@ -10,7 +10,7 @@ pub unsafe fn unused_param_0(mut x: i32) { &(x); } #[repr(C)] -#[derive(Clone, Default)] +#[derive(Clone, VaArg, Default)] pub struct NonTrivial { pub data: Vec, } @@ -27,7 +27,7 @@ pub unsafe fn bump_and_return_4() -> i32 { return (*std::cell::LazyCell::force_mut(&mut *&raw mut side_effect_counter_3)); } #[repr(C)] -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, VaArg, Default)] pub struct Holder { pub field: i32, }