From e3f6bf85ff32ca697a22a2f33976a430ab148ffc Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Thu, 5 Nov 2026 09:02:36 +0000 Subject: [PATCH 1/3] Add inline attribute on inline C++ methods --- cpp2rust/converter/converter.cpp | 15 ++++++++++++--- cpp2rust/converter/converter.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cpp2rust/converter/converter.cpp b/cpp2rust/converter/converter.cpp index 2f672f549..ecae37c22 100644 --- a/cpp2rust/converter/converter.cpp +++ b/cpp2rust/converter/converter.cpp @@ -402,7 +402,7 @@ bool Converter::VisitFunctionDecl(clang::FunctionDecl *decl) { } // main_0 should be static if (!decl->isMain()) { - StrCat(AccessSpecifierAsString(decl->getAccess())); + StrCat(InlineAttribute(decl), AccessSpecifierAsString(decl->getAccess())); } StrCat(keyword_unsafe_, keyword::kFn, std::move(function_name)); { @@ -1143,11 +1143,20 @@ Converter::GetConversionName(const clang::CXXConversionDecl *decl) const { : name; } +std::string Converter::InlineAttribute(const clang::FunctionDecl *decl) { + return decl->isInlined() && decl->doesThisDeclarationHaveABody() + ? "#[inline] " + : ""; +} + bool Converter::ConvertCXXMethodDecl(clang::CXXMethodDecl *decl) { if (auto *ctor = clang::dyn_cast(decl)) { return VisitCXXConstructorDecl(ctor); } + if (method_target_ != MethodTarget::TraitDecl) { + StrCat(InlineAttribute(decl)); + } if (method_target_ == MethodTarget::ValueImpl && (decl->isStatic() || (!decl->isVirtual() && !decl->getParent()->isAbstract()))) { @@ -1204,8 +1213,8 @@ bool Converter::VisitCXXConstructorDecl(clang::CXXConstructorDecl *decl) { return false; } - StrCat(AccessSpecifierAsString(decl->getAccess()), keyword_unsafe_, - keyword::kFn, GetCtorName(decl)); + StrCat(InlineAttribute(decl), AccessSpecifierAsString(decl->getAccess()), + keyword_unsafe_, keyword::kFn, GetCtorName(decl)); { PushParen paren(*this); ConvertFunctionParameters(decl); diff --git a/cpp2rust/converter/converter.h b/cpp2rust/converter/converter.h index ebc92cd42..cbabbd12a 100644 --- a/cpp2rust/converter/converter.h +++ b/cpp2rust/converter/converter.h @@ -197,6 +197,8 @@ class Converter : public clang::RecursiveASTVisitor { virtual bool ConvertOutOfLineMethod(clang::CXXMethodDecl *decl); + std::string InlineAttribute(const clang::FunctionDecl *decl); + bool ConvertCXXMethodDecl(clang::CXXMethodDecl *decl); std::string GetMethodName(const clang::CXXMethodDecl *decl); From b7f63a775cb947a4c842b7465740993491bd5799 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Thu, 5 Nov 2026 09:16:13 +0000 Subject: [PATCH 2/3] Update tests --- .../out/refcount/defaulted_move_cross_tu.rs | 6 + .../out/unsafe/defaulted_move_cross_tu.rs | 6 + .../refcount/out_of_line_methods_cross_tu.rs | 2 + .../unsafe/out_of_line_methods_cross_tu.rs | 2 + .../template_method_late_instantiation.rs | 2 + .../template_method_late_instantiation.rs | 2 + tests/ub/out/refcount/ctor_ref_member.rs | 1 + tests/ub/out/unsafe/ctor_ref_member.rs | 1 + tests/unit/inline_functions.cpp | 73 ++++++++++++ tests/unit/out/refcount/05_new.rs | 1 + tests/unit/out/refcount/10_struct.rs | 2 + tests/unit/out/refcount/any.rs | 1 + .../out/refcount/array_of_noncopy_struct.rs | 2 + tests/unit/out/refcount/as_const.rs | 4 + tests/unit/out/refcount/class.rs | 11 ++ .../refcount/class_template_lazy_member.rs | 4 + tests/unit/out/refcount/class_templates.rs | 26 +++++ tests/unit/out/refcount/complex_function.rs | 3 + tests/unit/out/refcount/concepts.rs | 1 + tests/unit/out/refcount/constexpr_function.rs | 8 ++ tests/unit/out/refcount/constructor.rs | 7 ++ .../refcount/container_element_receiver.rs | 1 + .../unit/out/refcount/container_field_addr.rs | 2 + .../conversion_operator_same_translation.rs | 4 + tests/unit/out/refcount/copy_assign.rs | 13 +++ tests/unit/out/refcount/copy_ctor.rs | 19 +++ .../unit/out/refcount/copy_move_defaulted.rs | 20 ++++ tests/unit/out/refcount/copy_move_deleted.rs | 11 ++ .../refcount/default_function_arguments.rs | 2 + tests/unit/out/refcount/destructor.rs | 6 + tests/unit/out/refcount/destructor_params.rs | 3 + .../out/refcount/destructor_temporaries.rs | 2 + tests/unit/out/refcount/doubly_linked_list.rs | 2 + tests/unit/out/refcount/exprs.rs | 2 + .../out/refcount/field_method_receiver.rs | 7 ++ tests/unit/out/refcount/field_pointers.rs | 5 + tests/unit/out/refcount/fn_ptr.rs | 1 + tests/unit/out/refcount/fn_ptr_struct.rs | 6 + tests/unit/out/refcount/fn_ref.rs | 1 + .../refcount/foreach_disjoint_field_borrow.rs | 2 + tests/unit/out/refcount/forward_basic.rs | 6 + tests/unit/out/refcount/forward_decltype.rs | 3 + tests/unit/out/refcount/forward_explicit.rs | 3 + tests/unit/out/refcount/forward_pack.rs | 5 + tests/unit/out/refcount/friend.rs | 6 + .../unit/out/refcount/function_overloading.rs | 6 + .../out/refcount/global_init_side_effect.rs | 1 + .../out/refcount/global_non_const_init.rs | 5 + tests/unit/out/refcount/huffman.rs | 8 ++ .../refcount/immutable-deref-on-func-call.rs | 1 + tests/unit/out/refcount/implicit_autoref.rs | 2 + .../refcount/in_class_field_initializer.rs | 1 + tests/unit/out/refcount/init_list.rs | 1 + .../out/refcount/inline_container_fields.rs | 8 ++ tests/unit/out/refcount/inline_functions.rs | 109 ++++++++++++++++++ tests/unit/out/refcount/kruskal.rs | 7 ++ tests/unit/out/refcount/lambda_as_field.rs | 6 + .../out/refcount/lambda_capture_copy_ctor.rs | 7 ++ .../out/refcount/lambda_capture_star_this.rs | 4 + .../unit/out/refcount/lambda_capture_this.rs | 5 + .../unit/out/refcount/lambda_decltype_type.rs | 2 + .../out/refcount/lambda_move_only_capture.rs | 4 + tests/unit/out/refcount/lambda_nested.rs | 1 + .../refcount/libc_struct_without_default.rs | 2 + tests/unit/out/refcount/linked_list.rs | 1 + tests/unit/out/refcount/map.rs | 2 + tests/unit/out/refcount/map_key_copy_ctor.rs | 4 + tests/unit/out/refcount/map_key_identity.rs | 1 + tests/unit/out/refcount/max.rs | 3 + tests/unit/out/refcount/move_assign.rs | 6 + tests/unit/out/refcount/move_ctor.rs | 11 ++ tests/unit/out/refcount/move_this.rs | 8 ++ .../refcount/nttp_distinct_specializations.rs | 3 + .../refcount/operator_arithmetic_member.rs | 11 ++ .../out/refcount/operator_bitwise_member.rs | 6 + .../refcount/operator_comparison_defaulted.rs | 17 +++ .../refcount/operator_comparison_member.rs | 7 ++ .../out/refcount/operator_comparison_mixed.rs | 6 + .../refcount/operator_comparison_nonbool.rs | 9 ++ .../operator_comparison_noncopyable.rs | 4 + .../operator_compound_assignment_member.rs | 11 ++ tests/unit/out/refcount/operator_friend.rs | 10 ++ tests/unit/out/refcount/operator_less_than.rs | 1 + .../out/refcount/operator_logical_member.rs | 3 + .../operator_member_pointer_member.rs | 6 + .../out/refcount/operator_other_member.rs | 7 ++ tests/unit/out/refcount/operator_overloads.rs | 7 ++ .../unit/out/refcount/operator_qualifiers.rs | 9 ++ tests/unit/out/refcount/operator_three_way.rs | 2 + tests/unit/out/refcount/operator_traits.rs | 4 + tests/unit/out/refcount/overload_mangling.rs | 21 ++++ .../refcount/pair_converting_construction.rs | 10 ++ tests/unit/out/refcount/pointers.rs | 4 + tests/unit/out/refcount/polymorphism.rs | 3 + tests/unit/out/refcount/push_emplace_back.rs | 5 + tests/unit/out/refcount/random.rs | 4 + tests/unit/out/refcount/rule_of_five.rs | 6 + tests/unit/out/refcount/rule_of_three.rs | 4 + .../unit/out/refcount/rvalue_rule_arg_move.rs | 4 + tests/unit/out/refcount/rvalue_struct.rs | 1 + .../out/refcount/size_t_template_param.rs | 2 + tests/unit/out/refcount/sort_no_copy.rs | 8 ++ tests/unit/out/refcount/static_local.rs | 1 + .../unit/out/refcount/static_var_in_class.rs | 2 + tests/unit/out/refcount/stdcopy.rs | 1 + tests/unit/out/refcount/struct_ctor.rs | 5 + .../unit/out/refcount/struct_default_ctor.rs | 1 + .../refcount/structured_binding_copy_ctor.rs | 3 + .../structured_binding_element_ctor.rs | 4 + .../refcount/structured_binding_move_ctor.rs | 6 + tests/unit/out/refcount/swap_map_no_copy.rs | 28 +++++ .../unit/out/refcount/template_default_arg.rs | 6 + tests/unit/out/refcount/this.rs | 18 +++ .../unit/out/refcount/typedef-anon-struct.rs | 2 + tests/unit/out/refcount/unboxed_locals.rs | 1 + tests/unit/out/refcount/unboxed_records.rs | 1 + tests/unit/out/refcount/unique_ptr.rs | 3 + .../out/refcount/unique_ptr_const_deref.rs | 2 + .../out/refcount/unique_ptr_field_reset.rs | 3 + tests/unit/out/refcount/unique_ptr_nested.rs | 2 + tests/unit/out/refcount/va_list_field.rs | 2 + .../out/refcount/vector_iter_range_ctor.rs | 2 + .../out/refcount/vector_subscript_direct.rs | 3 + .../out/refcount/vector_with_allocator.rs | 4 + tests/unit/out/refcount/void_cast.rs | 4 + tests/unit/out/refcount/wide_char.rs | 10 ++ tests/unit/out/unsafe/05_new.rs | 1 + tests/unit/out/unsafe/10_struct.rs | 2 + tests/unit/out/unsafe/any.rs | 1 + .../out/unsafe/array_of_noncopy_struct.rs | 2 + tests/unit/out/unsafe/as_const.rs | 4 + tests/unit/out/unsafe/class.rs | 11 ++ .../out/unsafe/class_template_lazy_member.rs | 4 + tests/unit/out/unsafe/class_templates.rs | 26 +++++ tests/unit/out/unsafe/complex_function.rs | 3 + tests/unit/out/unsafe/concepts.rs | 1 + tests/unit/out/unsafe/constexpr_function.rs | 8 ++ tests/unit/out/unsafe/constructor.rs | 7 ++ .../out/unsafe/container_element_receiver.rs | 1 + tests/unit/out/unsafe/container_field_addr.rs | 2 + .../conversion_operator_same_translation.rs | 4 + tests/unit/out/unsafe/copy_assign.rs | 13 +++ tests/unit/out/unsafe/copy_ctor.rs | 19 +++ tests/unit/out/unsafe/copy_move_defaulted.rs | 20 ++++ tests/unit/out/unsafe/copy_move_deleted.rs | 11 ++ .../out/unsafe/default_function_arguments.rs | 2 + tests/unit/out/unsafe/destructor.rs | 6 + tests/unit/out/unsafe/destructor_params.rs | 3 + .../unit/out/unsafe/destructor_temporaries.rs | 2 + tests/unit/out/unsafe/doubly_linked_list.rs | 2 + tests/unit/out/unsafe/exprs.rs | 2 + .../unit/out/unsafe/field_method_receiver.rs | 7 ++ tests/unit/out/unsafe/field_pointers.rs | 5 + tests/unit/out/unsafe/fn_ptr.rs | 1 + tests/unit/out/unsafe/fn_ptr_struct.rs | 6 + tests/unit/out/unsafe/fn_ref.rs | 1 + .../unsafe/foreach_disjoint_field_borrow.rs | 2 + tests/unit/out/unsafe/forward_basic.rs | 6 + tests/unit/out/unsafe/forward_decltype.rs | 3 + tests/unit/out/unsafe/forward_explicit.rs | 3 + tests/unit/out/unsafe/forward_pack.rs | 5 + tests/unit/out/unsafe/friend.rs | 6 + tests/unit/out/unsafe/function_overloading.rs | 6 + .../out/unsafe/global_init_side_effect.rs | 1 + .../unit/out/unsafe/global_non_const_init.rs | 5 + tests/unit/out/unsafe/huffman.rs | 8 ++ .../unsafe/immutable-deref-on-func-call.rs | 1 + tests/unit/out/unsafe/implicit_autoref.rs | 2 + .../out/unsafe/in_class_field_initializer.rs | 1 + tests/unit/out/unsafe/init_list.rs | 1 + .../out/unsafe/inline_container_fields.rs | 8 ++ tests/unit/out/unsafe/inline_functions.rs | 109 ++++++++++++++++++ tests/unit/out/unsafe/kruskal.rs | 7 ++ tests/unit/out/unsafe/lambda_as_field.rs | 6 + .../out/unsafe/lambda_capture_copy_ctor.rs | 7 ++ .../out/unsafe/lambda_capture_star_this.rs | 4 + tests/unit/out/unsafe/lambda_capture_this.rs | 5 + tests/unit/out/unsafe/lambda_decltype_type.rs | 2 + .../out/unsafe/lambda_move_only_capture.rs | 4 + tests/unit/out/unsafe/lambda_nested.rs | 1 + .../out/unsafe/libc_struct_without_default.rs | 2 + tests/unit/out/unsafe/linked_list.rs | 1 + tests/unit/out/unsafe/map.rs | 2 + tests/unit/out/unsafe/map_key_copy_ctor.rs | 4 + tests/unit/out/unsafe/map_key_identity.rs | 1 + tests/unit/out/unsafe/max.rs | 3 + tests/unit/out/unsafe/move_assign.rs | 6 + tests/unit/out/unsafe/move_ctor.rs | 11 ++ tests/unit/out/unsafe/move_this.rs | 8 ++ .../unsafe/nttp_distinct_specializations.rs | 3 + .../out/unsafe/operator_arithmetic_member.rs | 11 ++ .../out/unsafe/operator_bitwise_member.rs | 6 + .../unsafe/operator_comparison_defaulted.rs | 17 +++ .../out/unsafe/operator_comparison_member.rs | 7 ++ .../out/unsafe/operator_comparison_mixed.rs | 6 + .../out/unsafe/operator_comparison_nonbool.rs | 9 ++ .../unsafe/operator_comparison_noncopyable.rs | 4 + .../operator_compound_assignment_member.rs | 11 ++ tests/unit/out/unsafe/operator_friend.rs | 10 ++ tests/unit/out/unsafe/operator_less_than.rs | 1 + .../out/unsafe/operator_logical_member.rs | 3 + .../unsafe/operator_member_pointer_member.rs | 6 + .../unit/out/unsafe/operator_other_member.rs | 7 ++ tests/unit/out/unsafe/operator_overloads.rs | 7 ++ tests/unit/out/unsafe/operator_qualifiers.rs | 9 ++ tests/unit/out/unsafe/operator_three_way.rs | 2 + tests/unit/out/unsafe/operator_traits.rs | 4 + tests/unit/out/unsafe/overload_mangling.rs | 21 ++++ .../unsafe/pair_converting_construction.rs | 10 ++ tests/unit/out/unsafe/pointers.rs | 4 + tests/unit/out/unsafe/polymorphism.rs | 3 + tests/unit/out/unsafe/push_emplace_back.rs | 5 + tests/unit/out/unsafe/random.rs | 4 + tests/unit/out/unsafe/rule_of_five.rs | 6 + tests/unit/out/unsafe/rule_of_three.rs | 4 + tests/unit/out/unsafe/rvalue_rule_arg_move.rs | 4 + tests/unit/out/unsafe/rvalue_struct.rs | 1 + .../unit/out/unsafe/size_t_template_param.rs | 2 + tests/unit/out/unsafe/sort_no_copy.rs | 8 ++ tests/unit/out/unsafe/static_local.rs | 1 + tests/unit/out/unsafe/static_var_in_class.rs | 2 + tests/unit/out/unsafe/stdcopy.rs | 1 + tests/unit/out/unsafe/struct_ctor.rs | 5 + tests/unit/out/unsafe/struct_default_ctor.rs | 1 + .../unsafe/structured_binding_copy_ctor.rs | 3 + .../unsafe/structured_binding_element_ctor.rs | 4 + .../unsafe/structured_binding_move_ctor.rs | 6 + tests/unit/out/unsafe/swap_map_no_copy.rs | 28 +++++ tests/unit/out/unsafe/template_default_arg.rs | 6 + tests/unit/out/unsafe/this.rs | 18 +++ tests/unit/out/unsafe/typedef-anon-struct.rs | 2 + tests/unit/out/unsafe/unboxed_locals.rs | 1 + tests/unit/out/unsafe/unboxed_records.rs | 1 + tests/unit/out/unsafe/unique_ptr.rs | 3 + .../unit/out/unsafe/unique_ptr_const_deref.rs | 2 + .../unit/out/unsafe/unique_ptr_field_reset.rs | 3 + tests/unit/out/unsafe/unique_ptr_nested.rs | 2 + tests/unit/out/unsafe/va_list_field.rs | 2 + .../unit/out/unsafe/vector_iter_range_ctor.rs | 2 + .../out/unsafe/vector_subscript_direct.rs | 3 + .../unit/out/unsafe/vector_with_allocator.rs | 4 + tests/unit/out/unsafe/void_cast.rs | 4 + tests/unit/out/unsafe/wide_char.rs | 10 ++ 243 files changed, 1549 insertions(+) create mode 100644 tests/unit/inline_functions.cpp create mode 100644 tests/unit/out/refcount/inline_functions.rs create mode 100644 tests/unit/out/unsafe/inline_functions.rs diff --git a/tests/multi-file/defaulted_move_cross_tu/out/refcount/defaulted_move_cross_tu.rs b/tests/multi-file/defaulted_move_cross_tu/out/refcount/defaulted_move_cross_tu.rs index 12e4cb5da..f5b73f05b 100644 --- a/tests/multi-file/defaulted_move_cross_tu/out/refcount/defaulted_move_cross_tu.rs +++ b/tests/multi-file/defaulted_move_cross_tu/out/refcount/defaulted_move_cross_tu.rs @@ -18,12 +18,14 @@ pub struct S { pub n: Box<[i32]>, } impl S { + #[inline] pub fn new(mut x: i32) -> Self { Self { v: vec![x; (x as usize) as usize], n: Box::new([x, (x + 1)]), } } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { v: field!(_a0, v).with_mut(std::mem::take), @@ -51,6 +53,7 @@ pub struct T { pub v: Vec, } impl T { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { v: field!(_a0, v).with_mut(std::mem::take), @@ -96,6 +99,7 @@ pub trait SImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl SImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), v) .as_pointer() @@ -117,9 +121,11 @@ pub trait TImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl TImpl for Ptr { + #[inline] fn size(&self) -> i32 { return ((*(*self).upgrade().deref()).v.len() as i32); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), v) .as_pointer() diff --git a/tests/multi-file/defaulted_move_cross_tu/out/unsafe/defaulted_move_cross_tu.rs b/tests/multi-file/defaulted_move_cross_tu/out/unsafe/defaulted_move_cross_tu.rs index b4631b754..627be91a4 100644 --- a/tests/multi-file/defaulted_move_cross_tu/out/unsafe/defaulted_move_cross_tu.rs +++ b/tests/multi-file/defaulted_move_cross_tu/out/unsafe/defaulted_move_cross_tu.rs @@ -14,6 +14,7 @@ pub struct S { pub n: [i32; 2], } impl S { + #[inline] pub unsafe fn new(mut x: i32) -> Self { let mut this = Self { v: vec![x; (x as usize) as usize], @@ -21,6 +22,7 @@ impl S { }; this } + #[inline] pub unsafe fn move_from(_a0: *mut S) -> Self { let mut this = Self { v: std::mem::take(&mut (*_a0).v), @@ -28,6 +30,7 @@ impl S { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut S) -> *mut S { self.v = std::mem::take(&mut (*_a0).v); match ( @@ -50,15 +53,18 @@ pub struct T { pub v: Vec, } impl T { + #[inline] pub unsafe fn size(&self) -> i32 { return (self.v.len() as i32); } + #[inline] pub unsafe fn move_from(_a0: *mut T) -> Self { let mut this = Self { v: std::mem::take(&mut (*_a0).v), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut T) -> *mut T { self.v = std::mem::take(&mut (*_a0).v); return &mut (*(self as *mut T)); 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 639041a52..ea7728b7b 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 @@ -31,6 +31,7 @@ pub struct Pair { #[offset(4)] pub second: i32, } +#[inline] pub fn pair_diff_0(mut p: Ptr) -> i32 { return ({ p.with(|__s| __s.first) } - { p.with(|__s| __s.second) }); } @@ -88,6 +89,7 @@ pub trait SImpl { } } impl SImpl for Ptr { + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.v); } 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 6c6f7ee5c..2c0377ba9 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 @@ -12,6 +12,7 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn get(&self) -> i32 { return self.v; } @@ -31,6 +32,7 @@ pub struct Pair { pub first: i32, pub second: i32, } +#[inline] pub unsafe fn pair_diff_0(mut p: *const Pair) -> i32 { return (((*p).first) - ((*p).second)); } 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 6ba3c3a10..fdc050924 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 @@ -37,9 +37,11 @@ pub trait S_int_Impl { } } impl S_int_Impl for Ptr { + #[inline] fn set(&self, mut v: i32) { field!((*self), x).write(v); } + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.x); } 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 d70135863..e7a630c16 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 @@ -12,6 +12,7 @@ pub struct S_int_ { pub x: i32, } impl S_int_ { + #[inline] pub unsafe fn set(&mut self, mut v: i32) { self.x = v; } @@ -34,6 +35,7 @@ unsafe fn main_0() -> i32 { return 0; } impl S_int_ { + #[inline] pub unsafe fn get(&mut self) -> i32 { return self.x; } diff --git a/tests/ub/out/refcount/ctor_ref_member.rs b/tests/ub/out/refcount/ctor_ref_member.rs index 7bade32e0..b3fff7900 100644 --- a/tests/ub/out/refcount/ctor_ref_member.rs +++ b/tests/ub/out/refcount/ctor_ref_member.rs @@ -15,6 +15,7 @@ pub struct S { pub r: Ptr, } impl S { + #[inline] pub fn new(x: Ptr) -> Self { Self { r: (x).clone() } } diff --git a/tests/ub/out/unsafe/ctor_ref_member.rs b/tests/ub/out/unsafe/ctor_ref_member.rs index 21de4ecc9..be59dfa9d 100644 --- a/tests/ub/out/unsafe/ctor_ref_member.rs +++ b/tests/ub/out/unsafe/ctor_ref_member.rs @@ -13,6 +13,7 @@ pub struct S { pub r: *const i32, } impl S { + #[inline] pub unsafe fn new(x: *const i32) -> Self { let mut this = Self { r: x }; this diff --git a/tests/unit/inline_functions.cpp b/tests/unit/inline_functions.cpp new file mode 100644 index 000000000..3812e4bb5 --- /dev/null +++ b/tests/unit/inline_functions.cpp @@ -0,0 +1,73 @@ +#include + +inline int inlined_free(int a) { return a + 1; } + +constexpr int inlined_constexpr_free(int a) { return a + 2; } + +inline int inlined_declared_free(int a); + +int inlined_declared_free(int a) { return a + 3; } + +int not_inlined_free(int a) { return a + 4; } + +static int not_inlined_static_free(int a) { return a + 5; } + +class Base { +public: + virtual int inlined_override(int a) const = 0; + + virtual int not_inlined_override(int a) const = 0; +}; + +class Derived : public Base { +public: + explicit Derived(int v) : v_(v) {} + + int inlined_override(int a) const override { return v_ + a; } + + int not_inlined_override(int a) const override; + + int inlined_in_class() const { return v_ * 2; } + + static int inlined_static_in_class(int a) { return a * 3; } + + inline int inlined_declared_in_class() const; + + int inlined_defined_out_of_line() const; + + int not_inlined_out_of_line() const; + + static int not_inlined_static_out_of_line(int a); + +private: + int v_; +}; + +int Derived::not_inlined_override(int a) const { return v_ - a; } + +int Derived::inlined_declared_in_class() const { return v_ * 4; } + +inline int Derived::inlined_defined_out_of_line() const { return v_ * 5; } + +int Derived::not_inlined_out_of_line() const { return v_ * 6; } + +int Derived::not_inlined_static_out_of_line(int a) { return a * 7; } + +int main() { + Derived d(3); + const Base &b = d; + assert(inlined_free(1) == 2); + assert(inlined_constexpr_free(1) == 3); + assert(inlined_declared_free(1) == 4); + assert(not_inlined_free(1) == 5); + assert(not_inlined_static_free(1) == 6); + assert(b.inlined_override(1) == 4); + assert(b.not_inlined_override(1) == 2); + assert(d.inlined_in_class() == 6); + assert(Derived::inlined_static_in_class(2) == 6); + assert(d.inlined_declared_in_class() == 12); + assert(d.inlined_defined_out_of_line() == 15); + assert(d.not_inlined_out_of_line() == 18); + assert(Derived::not_inlined_static_out_of_line(2) == 14); + return 0; +} diff --git a/tests/unit/out/refcount/05_new.rs b/tests/unit/out/refcount/05_new.rs index 058936c70..6a9f31985 100644 --- a/tests/unit/out/refcount/05_new.rs +++ b/tests/unit/out/refcount/05_new.rs @@ -34,6 +34,7 @@ pub trait DImpl { fn operator_call(&self, ptr: Ptr); } impl DImpl for Ptr { + #[inline] fn operator_call(&self, mut ptr: Ptr) { ptr.delete(); } diff --git a/tests/unit/out/refcount/10_struct.rs b/tests/unit/out/refcount/10_struct.rs index a419f3930..3c7838eb3 100644 --- a/tests/unit/out/refcount/10_struct.rs +++ b/tests/unit/out/refcount/10_struct.rs @@ -32,6 +32,7 @@ pub struct Partial { pub p: Ptr, } impl Partial { + #[inline] pub fn new_1(mut q: Ptr) -> Self { Self { p: (q).clone() } } @@ -89,6 +90,7 @@ pub trait GraphImpl { fn push(&self, src: u32, dst: u32); } impl GraphImpl for Ptr { + #[inline] fn push(&self, mut src: u32, mut dst: u32) { let __rhs = Ptr::alloc(GraphNode { dst: dst, diff --git a/tests/unit/out/refcount/any.rs b/tests/unit/out/refcount/any.rs index ef9bf551c..99e6bcdf9 100644 --- a/tests/unit/out/refcount/any.rs +++ b/tests/unit/out/refcount/any.rs @@ -15,6 +15,7 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub fn new(mut x: i32, mut y: i32) -> Self { Self { x: x, y: y } } diff --git a/tests/unit/out/refcount/array_of_noncopy_struct.rs b/tests/unit/out/refcount/array_of_noncopy_struct.rs index b455c22b7..f4ae45e14 100644 --- a/tests/unit/out/refcount/array_of_noncopy_struct.rs +++ b/tests/unit/out/refcount/array_of_noncopy_struct.rs @@ -16,6 +16,7 @@ pub struct NonCopy { pub tag: i32, } impl NonCopy { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(std::mem::take), @@ -55,6 +56,7 @@ pub trait NonCopyImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl NonCopyImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), data) .as_pointer() diff --git a/tests/unit/out/refcount/as_const.rs b/tests/unit/out/refcount/as_const.rs index cf7b0c8fb..41eaacf8a 100644 --- a/tests/unit/out/refcount/as_const.rs +++ b/tests/unit/out/refcount/as_const.rs @@ -50,15 +50,19 @@ pub trait SImpl { fn value_ref_4(&self) -> Ptr; } impl SImpl for Ptr { + #[inline] fn f_1(&self) -> Overload { return Overload_kMutableOverload; } + #[inline] fn f_2(&self) -> Overload { return Overload_kConstOverload; } + #[inline] fn value_ref_3(&self) -> Ptr { return field_ptr!((*self), v); } + #[inline] fn value_ref_4(&self) -> Ptr { return field_ptr!((*self), v); } diff --git a/tests/unit/out/refcount/class.rs b/tests/unit/out/refcount/class.rs index 3024b5c0e..81ad488c8 100644 --- a/tests/unit/out/refcount/class.rs +++ b/tests/unit/out/refcount/class.rs @@ -112,10 +112,12 @@ pub trait CounterImpl { fn operator_eq(&self, o: Ptr) -> bool; } impl CounterImpl for Ptr { + #[inline] fn Get(&self) -> i32 { field!((*self), calls).with_mut(|__v| __v.prefix_inc()); return (*self).with(|__s| __s.v); } + #[inline] fn operator_eq(&self, o: Ptr) -> bool { field!((*self), calls).with_mut(|__v| __v.prefix_inc()); return ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }); @@ -130,19 +132,24 @@ pub trait PairImpl { fn SetSecond(&self, new_second: i32) -> i32; } impl PairImpl for Ptr { + #[inline] fn NOP(&self) {} + #[inline] fn GetFirst(&self) -> i32 { return (*self).with(|__s| __s.first); } + #[inline] fn GetSecond(&self) -> i32 { return (*self).with(|__s| __s.second); } + #[inline] fn Set(&self, field: Ptr, mut new_val: i32) -> i32 { ({ PairImpl::NOP(self) }); let mut old_val: i32 = (field.read()); field.write({ new_val }); return old_val; } + #[inline] fn SetFirst(&self, mut new_first: i32) -> i32 { return (({ PairImpl::GetFirst(self) }) + ({ @@ -150,6 +157,7 @@ impl PairImpl for Ptr { PairImpl::Set(self, _field, new_first) })); } + #[inline] fn SetSecond(&self, mut new_second: i32) -> i32 { return (({ PairImpl::GetSecond(self) }) + ({ @@ -162,6 +170,7 @@ pub trait RouteImpl { fn SetCost(&self, new_cost: f64) -> f64; } impl RouteImpl for Ptr { + #[inline] fn SetCost(&self, mut new_cost: f64) -> f64 { let mut old_cost: f64 = (*self).with(|__s| __s.cost); field!((*self), cost).write(new_cost); @@ -173,12 +182,14 @@ pub trait TallyImpl { fn SameNameBetweenConstAndNonConst_2(&self) -> i32; } impl TallyImpl for Ptr { + #[inline] fn SameNameBetweenConstAndNonConst_1(&self) -> i32 { { field!((*self), calls).with_mut(|__v| *__v = *__v + 1) }; return 1; } + #[inline] fn SameNameBetweenConstAndNonConst_2(&self) -> i32 { { field!((*self), calls).with_mut(|__v| *__v = *__v + 10) diff --git a/tests/unit/out/refcount/class_template_lazy_member.rs b/tests/unit/out/refcount/class_template_lazy_member.rs index 520120f7d..cc6784dc2 100644 --- a/tests/unit/out/refcount/class_template_lazy_member.rs +++ b/tests/unit/out/refcount/class_template_lazy_member.rs @@ -64,6 +64,7 @@ pub trait Box_Point_Impl { } } impl Box_Point_Impl for Ptr { + #[inline] fn get(&self) -> Point { return (*self).with(|__s| __s.val.clone()); } @@ -75,6 +76,7 @@ pub trait Box_int_Impl { fn twice(&self) -> i32; } impl Box_int_Impl for Ptr { + #[inline] fn twice(&self) -> i32 { return ((*self).with(|__s| __s.val) + (*self).with(|__s| __s.val)); } @@ -83,6 +85,7 @@ pub trait Deduced_Point_Impl { fn get(&self) -> Point; } impl Deduced_Point_Impl for Ptr { + #[inline] fn get(&self) -> Point { return (*self).with(|__s| __s.val.clone()); } @@ -91,6 +94,7 @@ pub trait Deduced_int_Impl { fn twice(&self) -> i32; } impl Deduced_int_Impl for Ptr { + #[inline] fn twice(&self) -> i32 { return ((*self).with(|__s| __s.val) + (*self).with(|__s| __s.val)); } diff --git a/tests/unit/out/refcount/class_templates.rs b/tests/unit/out/refcount/class_templates.rs index 7429326d9..5343e8242 100644 --- a/tests/unit/out/refcount/class_templates.rs +++ b/tests/unit/out/refcount/class_templates.rs @@ -14,6 +14,7 @@ pub struct MyContainer_int_ { vec_: Vec, } impl MyContainer_int_ { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { vec_: field!(_a0, vec_).with_mut(std::mem::take), @@ -28,6 +29,7 @@ pub struct MyContainer_char_ { vec_: Vec, } impl MyContainer_char_ { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { vec_: field!(_a0, vec_).with_mut(std::mem::take), @@ -42,6 +44,7 @@ pub struct MyContainer_float_ { vec_: Vec, } impl MyContainer_float_ { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { vec_: field!(_a0, vec_).with_mut(std::mem::take), @@ -246,25 +249,31 @@ pub trait MyContainer_char_Impl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl MyContainer_char_Impl for Ptr { + #[inline] fn empty(&self) -> bool { return (*(*self).upgrade().deref()).vec_.is_empty(); } + #[inline] fn size(&self) -> usize { return (*(*self).upgrade().deref()).vec_.len(); } + #[inline] fn back_4(&self) -> Ptr { return field_ref!((*self), vec_).decay().to_last(); } + #[inline] fn pop_back(&self) { field!((*self), vec_).with_mut(|__v: &mut Vec| __v.pop()); return; } + #[inline] fn push_back(&self, item: Ptr) { { let a0_clone = (item.read()).clone(); field!((*self), vec_).with_mut(|__v: &mut Vec| __v.push(a0_clone)) }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), vec_) .as_pointer() @@ -284,25 +293,31 @@ pub trait MyContainer_float_Impl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl MyContainer_float_Impl for Ptr { + #[inline] fn empty(&self) -> bool { return (*(*self).upgrade().deref()).vec_.is_empty(); } + #[inline] fn size(&self) -> usize { return (*(*self).upgrade().deref()).vec_.len(); } + #[inline] fn back_4(&self) -> Ptr { return field_ref!((*self), vec_).decay().to_last(); } + #[inline] fn pop_back(&self) { field!((*self), vec_).with_mut(|__v: &mut Vec| __v.pop()); return; } + #[inline] fn push_back(&self, item: Ptr) { { let a0_clone = (item.read()).clone(); field!((*self), vec_).with_mut(|__v: &mut Vec| __v.push(a0_clone)) }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), vec_) .as_pointer() @@ -322,25 +337,31 @@ pub trait MyContainer_int_Impl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl MyContainer_int_Impl for Ptr { + #[inline] fn empty(&self) -> bool { return (*(*self).upgrade().deref()).vec_.is_empty(); } + #[inline] fn size(&self) -> usize { return (*(*self).upgrade().deref()).vec_.len(); } + #[inline] fn back_4(&self) -> Ptr { return field_ref!((*self), vec_).decay().to_last(); } + #[inline] fn pop_back(&self) { field!((*self), vec_).with_mut(|__v: &mut Vec| __v.pop()); return; } + #[inline] fn push_back(&self, item: Ptr) { { let a0_clone = (item.read()).clone(); field!((*self), vec_).with_mut(|__v: &mut Vec| __v.push(a0_clone)) }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), vec_) .as_pointer() @@ -352,6 +373,7 @@ pub trait Outer_int_Impl { fn with(&self, n: i32) -> Outer_int__Inner_int_; } impl Outer_int_Impl for Ptr { + #[inline] fn with(&self, mut n: i32) -> Outer_int__Inner_int_ { return Outer_int__Inner_int_ { t: (*self).with(|__s| __s.v), @@ -363,6 +385,7 @@ pub trait Outer_int__Inner_int_Impl { fn sum(&self) -> i32; } impl Outer_int__Inner_int_Impl for Ptr { + #[inline] fn sum(&self) -> i32 { return (((*self).with(|__s| __s.t) as i32) + ((*self).with(|__s| __s.u) as i32)); } @@ -371,6 +394,7 @@ pub trait Outer_long_Impl { fn with(&self, n: i32) -> Outer_long__Inner_int_; } impl Outer_long_Impl for Ptr { + #[inline] fn with(&self, mut n: i32) -> Outer_long__Inner_int_ { return Outer_long__Inner_int_ { t: (*self).with(|__s| __s.v), @@ -382,6 +406,7 @@ pub trait Outer_long__Inner_char_Impl { fn sum(&self) -> i32; } impl Outer_long__Inner_char_Impl for Ptr { + #[inline] fn sum(&self) -> i32 { return (((*self).with(|__s| __s.t) as i32) + ((*self).with(|__s| __s.u) as i32)); } @@ -390,6 +415,7 @@ pub trait Outer_long__Inner_int_Impl { fn sum(&self) -> i32; } impl Outer_long__Inner_int_Impl for Ptr { + #[inline] fn sum(&self) -> i32 { return (((*self).with(|__s| __s.t) as i32) + ((*self).with(|__s| __s.u) as i32)); } diff --git a/tests/unit/out/refcount/complex_function.rs b/tests/unit/out/refcount/complex_function.rs index 002759a46..6d60f5955 100644 --- a/tests/unit/out/refcount/complex_function.rs +++ b/tests/unit/out/refcount/complex_function.rs @@ -257,6 +257,7 @@ pub trait X2Impl { fn get(&self) -> Ptr; } impl X2Impl for Ptr { + #[inline] fn get(&self) -> Ptr { return ((*self).with(|__s| __s.v.clone())).clone(); } @@ -265,6 +266,7 @@ pub trait X3Impl { fn get(&self) -> Ptr; } impl X3Impl for Ptr { + #[inline] fn get(&self) -> Ptr { return (*self).with(|__s| __s.v.clone()); } @@ -273,6 +275,7 @@ pub trait X4Impl { fn get(&self) -> Ptr; } impl X4Impl for Ptr { + #[inline] fn get(&self) -> Ptr { return field_ptr!((*self), v); } diff --git a/tests/unit/out/refcount/concepts.rs b/tests/unit/out/refcount/concepts.rs index 0f7c09aa5..f9ef3a0c4 100644 --- a/tests/unit/out/refcount/concepts.rs +++ b/tests/unit/out/refcount/concepts.rs @@ -61,6 +61,7 @@ pub trait SizedImpl { fn size(&self) -> i32; } impl SizedImpl for Ptr { + #[inline] fn size(&self) -> i32 { return 4; } diff --git a/tests/unit/out/refcount/constexpr_function.rs b/tests/unit/out/refcount/constexpr_function.rs index 48087c1ca..a514e2ce1 100644 --- a/tests/unit/out/refcount/constexpr_function.rs +++ b/tests/unit/out/refcount/constexpr_function.rs @@ -9,15 +9,18 @@ use std::rc::{Rc, Weak}; pub fn runtime_only_0(mut x: i32) -> i32 { return (x * 2); } +#[inline] pub fn first_1(mut p: Ptr) -> i32 { return (p.read()); } +#[inline] pub fn scaled_2(mut x: i32) -> i32 { if (x < 0) { return ({ runtime_only_0(-x) }); } return x; } +#[inline] pub fn half_3(mut x: f64) -> f64 { return (x / 2_f64); } @@ -27,15 +30,18 @@ pub struct Flag { #[offset(0)] pub v: i32, } +#[inline] pub fn use_4(f: Flag) -> i32 { let f: Value = Rc::new(RefCell::new(f)); assert!(({ FlagImpl::to_bool(&f.as_pointer(),) })); return { (*f.borrow()).v }; } +#[inline] pub fn checked_5(mut x: i32) -> i32 { assert!((x > 0)); return (x + 1); } +#[inline] pub fn in_constant_context_6() -> bool { {} return (({ runtime_only_0(1) }) == 0); @@ -78,6 +84,7 @@ pub trait FlagImpl { fn to_bool(&self) -> bool; } impl FlagImpl for Ptr { + #[inline] fn to_bool(&self) -> bool { return ((*self).with(|__s| __s.v) != 0); } @@ -86,6 +93,7 @@ pub trait PImpl { fn get(&self) -> i32; } impl PImpl for Ptr

{ + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.v); } diff --git a/tests/unit/out/refcount/constructor.rs b/tests/unit/out/refcount/constructor.rs index 26ea4704f..5b948c77e 100644 --- a/tests/unit/out/refcount/constructor.rs +++ b/tests/unit/out/refcount/constructor.rs @@ -17,6 +17,7 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub fn new(mut init: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { v: init })); let this: Ptr = __this.as_pointer(); @@ -35,9 +36,11 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub fn new_2(mut x: i32, mut y: i32) -> Self { Self { x: x, y: y } } + #[inline] pub fn new_1(mut v: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Point::new_2({ v }, { (v + 1) }))); let this: Ptr = __this.as_pointer(); @@ -46,6 +49,7 @@ impl Point { }; Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn new_3() -> Self { let __this: Value = Rc::new(RefCell::new(Point::new_1({ 4 }))); let this: Ptr = __this.as_pointer(); @@ -86,14 +90,17 @@ pub trait SImpl { fn destructor(&self); } impl SImpl for Ptr { + #[inline] fn const_method(&self) -> i32 { return ((*self).with(|__s| __s.v) * 2); } + #[inline] fn mut_method(&self) { { field!((*self), v).with_mut(|__v| *__v = *__v + 1) }; } + #[inline] fn destructor(&self) { ({ SImpl::mut_method(self) }); total_0.with(|rc| *rc.borrow_mut() += ({ SImpl::const_method(self) })); diff --git a/tests/unit/out/refcount/container_element_receiver.rs b/tests/unit/out/refcount/container_element_receiver.rs index 18dd3a054..da77d4433 100644 --- a/tests/unit/out/refcount/container_element_receiver.rs +++ b/tests/unit/out/refcount/container_element_receiver.rs @@ -17,6 +17,7 @@ pub struct Holder { pub vec_: Vec, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { ref_: ({ (*_a0.upgrade().deref()).ref_.clone() }).clone(), diff --git a/tests/unit/out/refcount/container_field_addr.rs b/tests/unit/out/refcount/container_field_addr.rs index 4ec814198..baa40f2ba 100644 --- a/tests/unit/out/refcount/container_field_addr.rs +++ b/tests/unit/out/refcount/container_field_addr.rs @@ -16,6 +16,7 @@ pub struct S { pub v: Vec, } impl S { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { tag: { (*_a0.upgrade().deref()).tag }, @@ -67,6 +68,7 @@ pub trait SImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl SImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), tag).write({ { (*_a0.upgrade().deref()).tag } }); field_ref!((*self), v) diff --git a/tests/unit/out/refcount/conversion_operator_same_translation.rs b/tests/unit/out/refcount/conversion_operator_same_translation.rs index 0479837a2..040466201 100644 --- a/tests/unit/out/refcount/conversion_operator_same_translation.rs +++ b/tests/unit/out/refcount/conversion_operator_same_translation.rs @@ -48,9 +48,11 @@ pub trait SImpl { fn to_u8(&self) -> u8; } impl SImpl for Ptr { + #[inline] fn to_i8(&self) -> i8 { return ((*self).with(|__s| __s.v) as i8); } + #[inline] fn to_u8(&self) -> u8 { return (((*self).with(|__s| __s.v) + 1) as u8); } @@ -60,9 +62,11 @@ pub trait TImpl { fn to_i64_2(&self) -> i64; } impl TImpl for Ptr { + #[inline] fn to_i64_1(&self) -> i64 { return ((*self).with(|__s| __s.v) as i64); } + #[inline] fn to_i64_2(&self) -> i64 { return (((*self).with(|__s| __s.v) + 1) as i64); } diff --git a/tests/unit/out/refcount/copy_assign.rs b/tests/unit/out/refcount/copy_assign.rs index a248e0443..cb78cd882 100644 --- a/tests/unit/out/refcount/copy_assign.rs +++ b/tests/unit/out/refcount/copy_assign.rs @@ -18,9 +18,11 @@ pub struct Partial { pub keep: i32, } impl Partial { + #[inline] pub fn new(mut v: i32, mut keep: i32) -> Self { Self { v: v, keep: keep } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -44,6 +46,7 @@ pub struct NonConstAssign { pub mark: i32, } impl NonConstAssign { + #[inline] pub fn new() -> Self { Self { mark: 0 } } @@ -60,6 +63,7 @@ pub struct RefQualified { pub mark: i32, } impl RefQualified { + #[inline] pub fn new() -> Self { Self { mark: 0 } } @@ -102,9 +106,11 @@ pub struct CopyCounted { pub v: i32, } impl CopyCounted { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: CopyCounted = Self { v: o.with(|__s| __s.v), @@ -251,6 +257,7 @@ pub trait CopyCountedImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl CopyCountedImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ _a0.with(|__s| __s.v) }); return (*self).clone(); @@ -260,6 +267,7 @@ pub trait HasCopyCountedImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl HasCopyCountedImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _arg0: Ptr = field_ptr!(_a0, c); @@ -281,6 +289,7 @@ pub trait HolderImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, p); @@ -306,10 +315,12 @@ pub trait NonConstAssignImpl { fn operator_assign_3(&self, o: Ptr) -> Ptr; } impl NonConstAssignImpl for Ptr { + #[inline] fn operator_assign_2(&self, o: Ptr) -> Ptr { field!((*self), mark).write({ (o.with(|__s| __s.mark) + 1) }); return (*self).clone(); } + #[inline] fn operator_assign_3(&self, o: Ptr) -> Ptr { field!((*self), mark).write({ (o.with(|__s| __s.mark) + 10) }); return (*self).clone(); @@ -319,6 +330,7 @@ pub trait PartialImpl { fn copy_assign(&self, o: Ptr) -> Ptr; } impl PartialImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { if ((*self) == (o)) { return (*self).clone(); @@ -332,6 +344,7 @@ pub trait RefQualifiedImpl { fn copy_assign(&self, o: Ptr) -> Ptr; } impl RefQualifiedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), mark).write({ (o.with(|__s| __s.mark) + 1) }); return (*self).clone(); diff --git a/tests/unit/out/refcount/copy_ctor.rs b/tests/unit/out/refcount/copy_ctor.rs index c2bf8d295..b875fa4b4 100644 --- a/tests/unit/out/refcount/copy_ctor.rs +++ b/tests/unit/out/refcount/copy_ctor.rs @@ -17,9 +17,11 @@ pub struct Counted { pub v: i32, } impl Counted { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Counted = Self { v: o.with(|__s| __s.v), @@ -41,14 +43,17 @@ pub struct NonConst { pub mark: i32, } impl NonConst { + #[inline] pub fn new() -> Self { Self { mark: 0 } } + #[inline] pub fn new_1(o: Ptr) -> Self { Self { mark: (o.with(|__s| __s.mark) + 1), } } + #[inline] pub fn new_2(o: Ptr) -> Self { Self { mark: (o.with(|__s| __s.mark) + 10), @@ -76,9 +81,11 @@ pub struct Ignored { pub v: i32, } impl Ignored { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(_a0: Ptr) -> Self { let __this: Ignored = Self { v: -1_i32 }; (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); @@ -121,15 +128,18 @@ pub struct Box_int_ { pub val: i32, } impl Box_int_ { + #[inline] pub fn new(v: i32) -> Self { let v: Value = Rc::new(RefCell::new(v)); Self { val: (*v.borrow()) } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { val: o.with(|__s| __s.val), } } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { val: { (*_a0.upgrade().deref()).val }, @@ -152,6 +162,7 @@ pub struct Owner { pub box_: Box_int_, } impl Owner { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { box_: Box_int_::move_from({ field_ptr!(_a0, box_) }), @@ -166,6 +177,7 @@ pub struct OutOfLine { pub v: i32, } impl OutOfLine { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } @@ -191,6 +203,7 @@ pub struct Tracked { pub copied_from: i32, } impl Tracked { + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Tracked = Self { copied_from: 0 }; field!(o, copied_from).with_mut(|__v| __v.prefix_inc()); @@ -292,6 +305,7 @@ pub trait CountedImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl CountedImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ _a0.with(|__s| __s.v) }); return (*self).clone(); @@ -301,6 +315,7 @@ pub trait HolderImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _arg0: Ptr = field_ptr!(_a0, c); @@ -322,6 +337,7 @@ pub trait IgnoredImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl IgnoredImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ _a0.with(|__s| __s.v) }); return (*self).clone(); @@ -331,6 +347,7 @@ pub trait NonConstImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl NonConstImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), mark).write({ _a0.with(|__s| __s.mark) }); return (*self).clone(); @@ -340,6 +357,7 @@ pub trait OutOfLineImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl OutOfLineImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ _a0.with(|__s| __s.v) }); return (*self).clone(); @@ -349,6 +367,7 @@ pub trait TrackedImpl { fn copy_assign(&self, o: Ptr) -> Ptr; } impl TrackedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!(o, copied_from).with_mut(|__v| __v.prefix_inc()); return (*self).clone(); diff --git a/tests/unit/out/refcount/copy_move_defaulted.rs b/tests/unit/out/refcount/copy_move_defaulted.rs index cb9598431..4f034742a 100644 --- a/tests/unit/out/refcount/copy_move_defaulted.rs +++ b/tests/unit/out/refcount/copy_move_defaulted.rs @@ -26,6 +26,7 @@ pub struct Explicit { pub arr: Box<[i32]>, } impl Explicit { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -76,9 +77,11 @@ pub struct DefaultCopyUserMove { pub v: i32, } impl DefaultCopyUserMove { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: DefaultCopyUserMove = Self { v: o.with(|__s| __s.v), @@ -95,14 +98,17 @@ pub struct UserCopyDefaultMove { pub v: i32, } impl UserCopyDefaultMove { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: (o.with(|__s| __s.v) + 100), } } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { v: { (*_a0.upgrade().deref()).v }, @@ -133,6 +139,7 @@ pub struct Buffer { pub arr: Box<[i32]>, } impl Buffer { + #[inline] pub fn new(mut n: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: vec![n; (n as usize) as usize], @@ -147,6 +154,7 @@ impl Buffer { }; Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(std::mem::take), @@ -186,6 +194,7 @@ pub struct Owner { pub p: Option>, } impl Owner { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(std::mem::take), @@ -217,6 +226,7 @@ pub struct Copyable { pub data: Vec, } impl Copyable { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(std::mem::take), @@ -238,6 +248,7 @@ pub struct Holder { pub p: Option>, } impl Holder { + #[inline] pub fn new(mut v: i32) -> Self { Self { inner: Inner { x: v }, @@ -245,6 +256,7 @@ impl Holder { p: None, } } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { inner: { (*_a0.upgrade().deref()).inner.clone() }, @@ -479,6 +491,7 @@ pub trait BufferImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl BufferImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), data) .as_pointer() @@ -503,6 +516,7 @@ pub trait CopyableImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl CopyableImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), data) .as_pointer() @@ -514,6 +528,7 @@ pub trait DefaultCopyUserMoveImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl DefaultCopyUserMoveImpl for Ptr { + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); field!(o, v).write(0); @@ -524,6 +539,7 @@ pub trait ExplicitImpl { fn destructor(&self); } impl ExplicitImpl for Ptr { + #[inline] fn destructor(&self) {} } pub trait HolderImpl { @@ -531,6 +547,7 @@ pub trait HolderImpl { fn destructor(&self); } impl HolderImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), inner).write({ { (*_a0.upgrade().deref()).inner.clone() } }); field!((*self), e).write({ { (*_a0.upgrade().deref()).e.clone() } }); @@ -546,6 +563,7 @@ pub trait OwnerImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl OwnerImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), data) .as_pointer() @@ -570,10 +588,12 @@ pub trait UserCopyDefaultMoveImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl UserCopyDefaultMoveImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ (o.with(|__s| __s.v) + 100) }); return (*self).clone(); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ { (*_a0.upgrade().deref()).v } }); return (*self).clone(); diff --git a/tests/unit/out/refcount/copy_move_deleted.rs b/tests/unit/out/refcount/copy_move_deleted.rs index 2fd4e7dd7..602f93baf 100644 --- a/tests/unit/out/refcount/copy_move_deleted.rs +++ b/tests/unit/out/refcount/copy_move_deleted.rs @@ -14,9 +14,11 @@ pub struct NoCopy { pub v: i32, } impl NoCopy { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: NoCopy = Self { v: o.with(|__s| __s.v), @@ -32,9 +34,11 @@ pub struct PrivateCopy { pub v: i32, } impl PrivateCopy { + #[inline] pub fn new() -> Self { Self { v: 0 } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: PrivateCopy = Self { v: o.with(|__s| __s.v), @@ -55,6 +59,7 @@ pub struct Immovable { pub v: i32, } impl Immovable { + #[inline] pub fn new() -> Self { Self { v: 0 } } @@ -74,6 +79,7 @@ pub struct Container { pub tag: i32, } impl Container { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { inner: NoCopy::move_from({ field_ptr!(_a0, inner) }), @@ -89,6 +95,7 @@ pub struct VecHolder { pub items: Vec, } impl VecHolder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { items: field!(_a0, items).with_mut(std::mem::take), @@ -139,6 +146,7 @@ pub trait ContainerImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl ContainerImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, inner); @@ -152,6 +160,7 @@ pub trait NoCopyImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl NoCopyImpl for Ptr { + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); field!(o, v).write(0); @@ -165,6 +174,7 @@ pub trait PrivateCopyImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl PrivateCopyImpl for Ptr { + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); field!(o, v).write(0); @@ -175,6 +185,7 @@ pub trait VecHolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl VecHolderImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), items) .as_pointer() diff --git a/tests/unit/out/refcount/default_function_arguments.rs b/tests/unit/out/refcount/default_function_arguments.rs index 05161592a..8827fc01f 100644 --- a/tests/unit/out/refcount/default_function_arguments.rs +++ b/tests/unit/out/refcount/default_function_arguments.rs @@ -22,6 +22,7 @@ pub struct Bar { pub v: i32, } impl Bar { + #[inline] pub fn new(v: Option) -> Self { let mut v: i32 = v.unwrap_or_else(|| 1); Self { v: v } @@ -72,6 +73,7 @@ pub struct Holder_int_ { pub v: i32, } impl Holder_int_ { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } diff --git a/tests/unit/out/refcount/destructor.rs b/tests/unit/out/refcount/destructor.rs index ff6b3c641..ee185a14e 100644 --- a/tests/unit/out/refcount/destructor.rs +++ b/tests/unit/out/refcount/destructor.rs @@ -209,6 +209,7 @@ pub trait CopiedImpl { fn destructor(&self); } impl CopiedImpl for Ptr { + #[inline] fn destructor(&self) { (*global_0.with(Value::clone).borrow_mut()).postfix_inc(); } @@ -225,6 +226,7 @@ pub trait EmptyBodyImpl { fn destructor(&self); } impl EmptyBodyImpl for Ptr { + #[inline] fn destructor(&self) { field_ptr!(self, s).destructor(); } @@ -259,6 +261,7 @@ pub trait SImpl { fn destructor(&self); } impl SImpl for Ptr { + #[inline] fn destructor(&self) { (*global_0.with(Value::clone).borrow_mut()).postfix_inc(); } @@ -267,6 +270,7 @@ pub trait TaggedImpl { fn destructor(&self); } impl TaggedImpl for Ptr { + #[inline] fn destructor(&self) { (*order_1.with(Value::clone).borrow_mut()) [((*order_count_2.with(Value::clone).borrow_mut()).postfix_inc()) as usize] = @@ -277,6 +281,7 @@ pub trait Templated_char_Impl { fn destructor(&self); } impl Templated_char_Impl for Ptr { + #[inline] fn destructor(&self) { global_0.with(|rc| { *rc.borrow_mut() = { @@ -290,6 +295,7 @@ pub trait Templated_int_Impl { fn destructor(&self); } impl Templated_int_Impl for Ptr { + #[inline] fn destructor(&self) { global_0.with(|rc| { *rc.borrow_mut() = { diff --git a/tests/unit/out/refcount/destructor_params.rs b/tests/unit/out/refcount/destructor_params.rs index 38335c532..2303174bf 100644 --- a/tests/unit/out/refcount/destructor_params.rs +++ b/tests/unit/out/refcount/destructor_params.rs @@ -34,6 +34,7 @@ pub struct Holder { pub v: i32, } impl Holder { + #[inline] pub fn new(s: S) -> Self { let s: Value = Rc::new(RefCell::new(s)); Self { @@ -79,6 +80,7 @@ pub trait HolderImpl { fn add(&self, s: S) -> i32; } impl HolderImpl for Ptr { + #[inline] fn add(&self, s: S) -> i32 { let s: Value = Rc::new(RefCell::new(s)); return ((*self).with(|__s| __s.v) + { (*s.borrow()).v }); @@ -88,6 +90,7 @@ pub trait SImpl { fn destructor(&self); } impl SImpl for Ptr { + #[inline] fn destructor(&self) { (*destroyed_0.with(Value::clone).borrow_mut()).postfix_inc(); last_1.with(|rc| *rc.borrow_mut() = (*self).with(|__s| __s.v)); diff --git a/tests/unit/out/refcount/destructor_temporaries.rs b/tests/unit/out/refcount/destructor_temporaries.rs index 12855a558..af831d9a4 100644 --- a/tests/unit/out/refcount/destructor_temporaries.rs +++ b/tests/unit/out/refcount/destructor_temporaries.rs @@ -142,10 +142,12 @@ pub trait SImpl { fn get(&self) -> i32; } impl SImpl for Ptr { + #[inline] fn destructor(&self) { (*destroyed_0.with(Value::clone).borrow_mut()).postfix_inc(); last_1.with(|rc| *rc.borrow_mut() = (*self).with(|__s| __s.v)); } + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.v); } diff --git a/tests/unit/out/refcount/doubly_linked_list.rs b/tests/unit/out/refcount/doubly_linked_list.rs index 2046bf2eb..b10082e3c 100644 --- a/tests/unit/out/refcount/doubly_linked_list.rs +++ b/tests/unit/out/refcount/doubly_linked_list.rs @@ -247,9 +247,11 @@ pub trait NodeImpl { fn SetPrev(&self, p: Ptr); } impl NodeImpl for Ptr { + #[inline] fn SetNext(&self, mut n: Ptr) { field!((*self), next).write((n).clone()); } + #[inline] fn SetPrev(&self, mut p: Ptr) { field!((*self), prev).write((p).clone()); } diff --git a/tests/unit/out/refcount/exprs.rs b/tests/unit/out/refcount/exprs.rs index 6218fc0be..a0c5a8948 100644 --- a/tests/unit/out/refcount/exprs.rs +++ b/tests/unit/out/refcount/exprs.rs @@ -67,9 +67,11 @@ pub trait YImpl { fn ptr(&self) -> Ptr; } impl YImpl for Ptr { + #[inline] fn foo(&self) -> Ptr { return field_ptr!((*self), x); } + #[inline] fn ptr(&self) -> Ptr { return (field_ptr!((*self), x)); } diff --git a/tests/unit/out/refcount/field_method_receiver.rs b/tests/unit/out/refcount/field_method_receiver.rs index 9425881f3..001906d6d 100644 --- a/tests/unit/out/refcount/field_method_receiver.rs +++ b/tests/unit/out/refcount/field_method_receiver.rs @@ -28,6 +28,7 @@ pub struct S { pub v: Vec, } impl S { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { tag: { (*_a0.upgrade().deref()).tag }, @@ -123,18 +124,22 @@ pub trait CounterImpl { fn take(&self, other: Ptr); } impl CounterImpl for Ptr { + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.n); } + #[inline] fn add(&self, mut k: i32) { { let __rhs = k; field!((*self), n).with_mut(|__v| *__v = *__v + __rhs) }; } + #[inline] fn self_(&self) -> Ptr { return (*self).clone(); } + #[inline] fn take(&self, mut other: Ptr) { { let __rhs = { other.with(|__s| __s.n) }; @@ -148,12 +153,14 @@ pub trait SImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl SImpl for Ptr { + #[inline] fn bump(&self) { ({ let _k: i32 = (*self).with(|__s| __s.tag); CounterImpl::add(&field_ptr!((*self), c), _k) }); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), tag).write({ { (*_a0.upgrade().deref()).tag } }); field!((*self), c).write({ { (*_a0.upgrade().deref()).c.clone() } }); diff --git a/tests/unit/out/refcount/field_pointers.rs b/tests/unit/out/refcount/field_pointers.rs index 789b7bbc8..b32444672 100644 --- a/tests/unit/out/refcount/field_pointers.rs +++ b/tests/unit/out/refcount/field_pointers.rs @@ -55,6 +55,7 @@ pub struct Outer { pub buf: Box<[i32]>, } impl Outer { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { x: { (*_a0.upgrade().deref()).x }, @@ -239,6 +240,7 @@ pub trait OuterImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl OuterImpl for Ptr { + #[inline] fn next(&self) -> i32 { return (array_elem!( (*self), @@ -247,15 +249,18 @@ impl OuterImpl for Ptr { ) .read()); } + #[inline] fn sum(&self) -> i32 { return ((*self).with(|__s| __s.x) + (*self).with(|__s| __s.inner.a)); } + #[inline] fn push(&self, mut k: i32) { { let __a1 = (k + (*self).with(|__s| __s.x)); field!((*self), v).with_mut(|__v: &mut Vec| __v.push(__a1)) }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), x).write({ { (*_a0.upgrade().deref()).x } }); field!((*self), inner).write({ { (*_a0.upgrade().deref()).inner.clone() } }); diff --git a/tests/unit/out/refcount/fn_ptr.rs b/tests/unit/out/refcount/fn_ptr.rs index ac91c5b29..876e967c3 100644 --- a/tests/unit/out/refcount/fn_ptr.rs +++ b/tests/unit/out/refcount/fn_ptr.rs @@ -37,6 +37,7 @@ pub struct HashHolder_unsigned_long__ptr__bool__ { pub h: FnPtr u64>, } impl HashHolder_unsigned_long__ptr__bool__ { + #[inline] pub fn new(h: Ptr u64>>) -> Self { Self { h: (h.read()) } } diff --git a/tests/unit/out/refcount/fn_ptr_struct.rs b/tests/unit/out/refcount/fn_ptr_struct.rs index e5db91574..563ab0e47 100644 --- a/tests/unit/out/refcount/fn_ptr_struct.rs +++ b/tests/unit/out/refcount/fn_ptr_struct.rs @@ -25,12 +25,15 @@ pub fn negate_1(mut x: i32) -> i32 { #[byte_size(1)] pub struct S {} impl S { + #[inline] pub fn pick_1(mut x: i32) -> i32 { return (x + 1); } + #[inline] pub fn pick_2(mut x: i64) -> i32 { return ((x as i32) + 2); } + #[inline] pub fn solo(mut x: i32) -> i32 { return (x + 3); } @@ -43,9 +46,11 @@ pub struct MoveOnly { pub data_: i32, } impl MoveOnly { + #[inline] pub fn new(mut data: i32) -> Self { Self { data_: data } } + #[inline] pub fn move_from(x: Ptr) -> Self { let __this: MoveOnly = Self { data_: x.with(|__s| __s.data_), @@ -106,6 +111,7 @@ pub trait MoveOnlyImpl { fn get(&self) -> i32; } impl MoveOnlyImpl for Ptr { + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.data_); } diff --git a/tests/unit/out/refcount/fn_ref.rs b/tests/unit/out/refcount/fn_ref.rs index 70b1f00b9..461736094 100644 --- a/tests/unit/out/refcount/fn_ref.rs +++ b/tests/unit/out/refcount/fn_ref.rs @@ -50,6 +50,7 @@ pub trait HolderImpl { fn run(&self, x: i32) -> i32; } impl HolderImpl for Ptr { + #[inline] fn run(&self, mut x: i32) -> i32 { return ({ (*self).with(|__s| __s.f.clone()).call(x) }); } diff --git a/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs b/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs index 67ec11f8b..979b1dd3a 100644 --- a/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs +++ b/tests/unit/out/refcount/foreach_disjoint_field_borrow.rs @@ -16,6 +16,7 @@ pub struct S { pub a: i32, } impl S { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { v: field!(_a0, v).with_mut(std::mem::take), @@ -46,6 +47,7 @@ pub trait SImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl SImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), v) .as_pointer() diff --git a/tests/unit/out/refcount/forward_basic.rs b/tests/unit/out/refcount/forward_basic.rs index 31ffd5027..977f7edad 100644 --- a/tests/unit/out/refcount/forward_basic.rs +++ b/tests/unit/out/refcount/forward_basic.rs @@ -21,6 +21,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -28,6 +29,7 @@ impl Tracked { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -35,6 +37,7 @@ impl Tracked { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), @@ -62,6 +65,7 @@ pub fn chosen_overload_1(_a0: Ptr) -> Overload { return Overload_kRvalueOverload; } impl Holder { + #[inline] pub fn new_1(x: Ptr) -> Self { Self { t: Tracked::copy_from({ (x).clone() }), @@ -69,6 +73,7 @@ impl Holder { } } impl Holder { + #[inline] pub fn new_2(x: Ptr) -> Self { Self { t: Tracked::move_from({ (x).clone() }), @@ -85,6 +90,7 @@ pub struct Holder { pub t: Tracked, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { t: Tracked::move_from({ field_ptr!(_a0, t) }), diff --git a/tests/unit/out/refcount/forward_decltype.rs b/tests/unit/out/refcount/forward_decltype.rs index 4de2c4f25..260efe9af 100644 --- a/tests/unit/out/refcount/forward_decltype.rs +++ b/tests/unit/out/refcount/forward_decltype.rs @@ -21,6 +21,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -28,6 +29,7 @@ impl Tracked { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -35,6 +37,7 @@ impl Tracked { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), diff --git a/tests/unit/out/refcount/forward_explicit.rs b/tests/unit/out/refcount/forward_explicit.rs index 01eba2b2c..9faf30244 100644 --- a/tests/unit/out/refcount/forward_explicit.rs +++ b/tests/unit/out/refcount/forward_explicit.rs @@ -23,6 +23,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -30,6 +31,7 @@ impl Tracked { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -37,6 +39,7 @@ impl Tracked { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), diff --git a/tests/unit/out/refcount/forward_pack.rs b/tests/unit/out/refcount/forward_pack.rs index 23c6ae190..1d5733115 100644 --- a/tests/unit/out/refcount/forward_pack.rs +++ b/tests/unit/out/refcount/forward_pack.rs @@ -23,6 +23,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -30,6 +31,7 @@ impl Tracked { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -37,6 +39,7 @@ impl Tracked { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), @@ -113,6 +116,7 @@ pub fn forward_pack_7( return digits; } impl Pair { + #[inline] pub fn new(x: Ptr, y: Ptr) -> Self { Self { a: Tracked::copy_from({ (x).clone() }), @@ -131,6 +135,7 @@ pub struct Pair { pub b: Tracked, } impl Pair { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { a: Tracked::move_from({ field_ptr!(_a0, a) }), diff --git a/tests/unit/out/refcount/friend.rs b/tests/unit/out/refcount/friend.rs index 170c486c3..9bc62a1c2 100644 --- a/tests/unit/out/refcount/friend.rs +++ b/tests/unit/out/refcount/friend.rs @@ -6,15 +6,19 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; +#[inline] pub fn get_0(v: Ptr) -> i32 { return v.with(|__s| __s.x); } +#[inline] pub fn operator_eq_1(a: Ptr, b: Ptr) -> bool { return ({ a.with(|__s| __s.x) } == { b.with(|__s| __s.x) }); } +#[inline] pub fn scaled_2(v: Ptr, mut k: i32) -> i32 { return ({ v.with(|__s| __s.x) } * { k }); } +#[inline] pub fn scaled_3(v: Ptr, mut k: f64) -> f64 { return ({ (v.with(|__s| __s.x) as f64) } * { k }); } @@ -29,6 +33,7 @@ impl CppEq for V { operator_eq_1(__lhs.clone(), __rhs.clone()) } } +#[inline] pub fn get_4(w: Ptr) -> i32 { return w.with(|__s| __s.x); } @@ -38,6 +43,7 @@ pub struct W_int_ { #[offset(0)] pub x: i32, } +#[inline] pub fn get_5(w: Ptr) -> i64 { return w.with(|__s| __s.x); } diff --git a/tests/unit/out/refcount/function_overloading.rs b/tests/unit/out/refcount/function_overloading.rs index 08f6b35a0..19bf58487 100644 --- a/tests/unit/out/refcount/function_overloading.rs +++ b/tests/unit/out/refcount/function_overloading.rs @@ -71,11 +71,17 @@ pub trait FooImpl { fn method2_6(&self, x: f64, y: f64); } impl FooImpl for Ptr { + #[inline] fn foo_1(&self) {} + #[inline] fn foo_2(&self) {} + #[inline] fn method_3(&self, mut x: i32) {} + #[inline] fn method_4(&self, mut x: i32) {} + #[inline] fn method2_5(&self, mut x: i32, mut y: i32) {} + #[inline] fn method2_6(&self, mut x: f64, mut y: f64) {} } pub fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/refcount/global_init_side_effect.rs b/tests/unit/out/refcount/global_init_side_effect.rs index 41110c2d1..428254a17 100644 --- a/tests/unit/out/refcount/global_init_side_effect.rs +++ b/tests/unit/out/refcount/global_init_side_effect.rs @@ -14,6 +14,7 @@ thread_local!( #[byte_size(1)] pub struct S {} impl S { + #[inline] pub fn new(mut x: i32) -> Self { let __this: S = Self {}; total_0.with(|rc| *rc.borrow_mut() += x); diff --git a/tests/unit/out/refcount/global_non_const_init.rs b/tests/unit/out/refcount/global_non_const_init.rs index 7aa0350ce..9be39261e 100644 --- a/tests/unit/out/refcount/global_non_const_init.rs +++ b/tests/unit/out/refcount/global_non_const_init.rs @@ -12,6 +12,7 @@ pub fn next_0() -> i32 { thread_local!( static counter_1: Value = Rc::new(RefCell::new(0)); ); +#[inline] pub fn marker_2(mut tag: u8) -> u8 { return ((((tag as i32) << 3) | 2) as u8); } @@ -39,9 +40,11 @@ pub struct Ctor { pub v: i32, } impl Ctor { + #[inline] pub fn new_1() -> Self { Self { v: ({ next_0() }) } } + #[inline] pub fn new_2(mut x: i32) -> Self { Self { v: x } } @@ -89,9 +92,11 @@ pub struct Singleton { pub hits: i32, } impl Singleton { + #[inline] pub fn new() -> Self { Self { hits: 0 } } + #[inline] pub fn instance() -> Ptr { return s_15.with(|v| v.as_pointer()); } diff --git a/tests/unit/out/refcount/huffman.rs b/tests/unit/out/refcount/huffman.rs index f5cc1c914..72f9f815a 100644 --- a/tests/unit/out/refcount/huffman.rs +++ b/tests/unit/out/refcount/huffman.rs @@ -61,6 +61,7 @@ pub struct MinHeap { pub alloc: Option>>, } impl MinHeap { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { size: { (*_a0.upgrade().deref()).size }, @@ -304,6 +305,7 @@ pub trait MinHeapImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl MinHeapImpl for Ptr { + #[inline] fn Alloc(&self, mut data: i8, mut freq: i32) -> Ptr { ((*self).with(|__s| __s.alloc.clone()).as_pointer() as Ptr) .offset(((*self).with(|__s| __s.next) as usize) as isize) @@ -316,6 +318,7 @@ impl MinHeapImpl for Ptr { return (((*self).with(|__s| __s.alloc.clone()).as_pointer() as Ptr) .offset((field!((*self), next).with_mut(|__v| __v.postfix_inc()) as usize) as isize)); } + #[inline] fn Heapify(&self, mut idx: i32) { let mut smallest: i32 = idx; let mut left: i32 = ((2 * idx) + 1); @@ -359,6 +362,7 @@ impl MinHeapImpl for Ptr { ({ MinHeapImpl::Heapify(self, smallest) }); } } + #[inline] fn ExtractMin(&self) -> Ptr { let mut out: Ptr = (((*self).with(|__s| __s.arr.clone()).as_pointer() as Ptr>) @@ -374,6 +378,7 @@ impl MinHeapImpl for Ptr { ({ MinHeapImpl::Heapify(self, 0) }); return out; } + #[inline] fn Insert(&self, mut node: Ptr) { field!((*self), size).with_mut(|__v| __v.prefix_inc()); let mut i: i32 = ((*self).with(|__s| __s.size) - 1); @@ -398,6 +403,7 @@ impl MinHeapImpl for Ptr { .offset((i as usize) as isize) .write((node).clone()); } + #[inline] fn Build( &self, data: Ptr>>>, @@ -427,6 +433,7 @@ impl MinHeapImpl for Ptr { i.prefix_dec(); } } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), size).write({ { (*_a0.upgrade().deref()).size } }); field!((*self), capacity).write({ { (*_a0.upgrade().deref()).capacity } }); @@ -445,6 +452,7 @@ pub trait MinHeapNodeImpl { fn IsLeaf(&self) -> bool; } impl MinHeapNodeImpl for Ptr { + #[inline] fn IsLeaf(&self) -> bool { return (((*self).with(|__s| __s.left.clone())).is_null()) && (((*self).with(|__s| __s.right.clone())).is_null()); 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 f1a1e23c6..14dbe5926 100644 --- a/tests/unit/out/refcount/immutable-deref-on-func-call.rs +++ b/tests/unit/out/refcount/immutable-deref-on-func-call.rs @@ -38,6 +38,7 @@ pub trait ItemImpl { fn foo(&self, other: Ptr); } impl ItemImpl for Ptr { + #[inline] fn foo(&self, mut other: Ptr) { field!(other, value).write(10); } diff --git a/tests/unit/out/refcount/implicit_autoref.rs b/tests/unit/out/refcount/implicit_autoref.rs index 4546818fe..afb852bb0 100644 --- a/tests/unit/out/refcount/implicit_autoref.rs +++ b/tests/unit/out/refcount/implicit_autoref.rs @@ -14,6 +14,7 @@ pub struct Holder { pub v: Vec, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { v: field!(_a0, v).with_mut(std::mem::take), @@ -64,6 +65,7 @@ pub trait HolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), v) .as_pointer() diff --git a/tests/unit/out/refcount/in_class_field_initializer.rs b/tests/unit/out/refcount/in_class_field_initializer.rs index 22463a37e..c3f8ce3a1 100644 --- a/tests/unit/out/refcount/in_class_field_initializer.rs +++ b/tests/unit/out/refcount/in_class_field_initializer.rs @@ -54,6 +54,7 @@ pub struct Boxed_int_ { pub tag: i32, } impl Boxed_int_ { + #[inline] pub fn new(mut x: i32, mut t: i32) -> Self { Self { v: x, tag: t } } diff --git a/tests/unit/out/refcount/init_list.rs b/tests/unit/out/refcount/init_list.rs index 46ebadee2..e33c5b5de 100644 --- a/tests/unit/out/refcount/init_list.rs +++ b/tests/unit/out/refcount/init_list.rs @@ -59,6 +59,7 @@ pub trait HolderImpl { fn operator_assign_1(&self, o: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn operator_assign_1(&self, o: Ptr) -> Ptr { field!((*self), p).write({ (*o.upgrade().deref()).clone() }); return (*self).clone(); diff --git a/tests/unit/out/refcount/inline_container_fields.rs b/tests/unit/out/refcount/inline_container_fields.rs index bdb9c6ed7..dd8fb90c9 100644 --- a/tests/unit/out/refcount/inline_container_fields.rs +++ b/tests/unit/out/refcount/inline_container_fields.rs @@ -19,6 +19,7 @@ pub struct Elem { pub coeffs: Vec, } impl Elem { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { id: { (*_a0.upgrade().deref()).id }, @@ -59,6 +60,7 @@ pub struct State { pub rows: Vec>, } impl State { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { count: { (*_a0.upgrade().deref()).count }, @@ -151,6 +153,7 @@ pub struct Counted { pub v: i32, } impl Counted { + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Counted = Self { v: o.with(|__s| __s.v), @@ -158,6 +161,7 @@ impl Counted { (*copies_2.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Counted = Self { v: o.with(|__s| __s.v), @@ -436,11 +440,13 @@ pub trait CountedImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl CountedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); (*copy_assigns_4.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); field!(o, v).write(-1_i32); @@ -452,6 +458,7 @@ pub trait ElemImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl ElemImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), id).write({ { (*_a0.upgrade().deref()).id } }); match ({ ((array_field_ptr!((*self), hist)) as Ptr).to_any() },) { @@ -473,6 +480,7 @@ pub trait StateImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl StateImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field!((*self), count).write({ { (*_a0.upgrade().deref()).count } }); match ({ ((array_field_ptr!((*self), grid)) as Ptr>).to_any() },) { diff --git a/tests/unit/out/refcount/inline_functions.rs b/tests/unit/out/refcount/inline_functions.rs new file mode 100644 index 000000000..03a7e7b17 --- /dev/null +++ b/tests/unit/out/refcount/inline_functions.rs @@ -0,0 +1,109 @@ +extern crate libcc2rs; +use libcc2rs::*; +use std::cell::RefCell; +use std::collections::BTreeMap; +use std::io::prelude::*; +use std::io::{Read, Seek, Write}; +use std::os::fd::AsFd; +use std::rc::{Rc, Weak}; +#[inline] +pub fn inlined_free_0(mut a: i32) -> i32 { + return (a + 1); +} +#[inline] +pub fn inlined_constexpr_free_1(mut a: i32) -> i32 { + return (a + 2); +} +#[inline] +pub fn inlined_declared_free_2(mut a: i32) -> i32 { + return (a + 3); +} +pub fn not_inlined_free_3(mut a: i32) -> i32 { + return (a + 4); +} +pub fn not_inlined_static_free_4(mut a: i32) -> i32 { + return (a + 5); +} +pub trait Base { + fn inlined_override(&self, a: i32) -> i32; + fn not_inlined_override(&self, a: i32) -> i32; +} +#[derive(Clone, Record, ByteRepr, VaArg, FnPtrArg, Default)] +#[byte_size(16)] +pub struct Derived { + #[offset(8)] + v_: i32, +} +impl Derived { + #[inline] + pub fn new(mut v: i32) -> Self { + Self { v_: v } + } + #[inline] + pub fn inlined_static_in_class(mut a: i32) -> i32 { + return (a * 3); + } +} +impl Derived { + pub fn not_inlined_static_out_of_line(mut a: i32) -> i32 { + return (a * 7); + } +} +pub fn main() { + __cpp2rust_init_globals(); + std::process::exit(main_0()); +} +fn main_0() -> i32 { + let d: Value = Rc::new(RefCell::new(Derived::new({ 3 }))); + let b: Ptr = d.as_pointer(); + assert!((({ inlined_free_0(1,) }) == 2)); + assert!((({ inlined_constexpr_free_1(1,) }) == 3)); + assert!((({ inlined_declared_free_2(1,) }) == 4)); + assert!((({ not_inlined_free_3(1,) }) == 5)); + assert!((({ not_inlined_static_free_4(1,) }) == 6)); + assert!(({ (({ (*b.upgrade().deref()).inlined_override(1,) }) == 4) })); + assert!(({ (({ (*b.upgrade().deref()).not_inlined_override(1,) }) == 2) })); + assert!((({ DerivedImpl::inlined_in_class(&d.as_pointer(),) }) == 6)); + assert!((({ Derived::inlined_static_in_class(2,) }) == 6)); + assert!((({ DerivedImpl::inlined_declared_in_class(&d.as_pointer(),) }) == 12)); + assert!((({ DerivedImpl::inlined_defined_out_of_line(&d.as_pointer(),) }) == 15)); + assert!((({ DerivedImpl::not_inlined_out_of_line(&d.as_pointer(),) }) == 18)); + assert!((({ Derived::not_inlined_static_out_of_line(2,) }) == 14)); + return 0; +} +impl Base for Derived { + #[inline] + fn inlined_override(&self, mut a: i32) -> i32 { + return ({ self.v_ } + a); + } + fn not_inlined_override(&self, mut a: i32) -> i32 { + return ({ self.v_ } - a); + } + fn not_inlined_override(&self, mut a: i32) -> i32 { + return ({ self.v_ } - a); + } +} +pub trait DerivedImpl { + fn inlined_in_class(&self) -> i32; + fn inlined_declared_in_class(&self) -> i32; + fn inlined_defined_out_of_line(&self) -> i32; + fn not_inlined_out_of_line(&self) -> i32; +} +impl DerivedImpl for Ptr { + #[inline] + fn inlined_in_class(&self) -> i32 { + return ((*self).with(|__s| __s.v_) * 2); + } + #[inline] + fn inlined_declared_in_class(&self) -> i32 { + return ((*self).with(|__s| __s.v_) * 4); + } + #[inline] + fn inlined_defined_out_of_line(&self) -> i32 { + return ((*self).with(|__s| __s.v_) * 5); + } + fn not_inlined_out_of_line(&self) -> i32 { + return ((*self).with(|__s| __s.v_) * 6); + } +} +pub fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/refcount/kruskal.rs b/tests/unit/out/refcount/kruskal.rs index f3673f57f..294d24591 100644 --- a/tests/unit/out/refcount/kruskal.rs +++ b/tests/unit/out/refcount/kruskal.rs @@ -159,6 +159,7 @@ pub struct DisjointSet { pub n: i32, } impl DisjointSet { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { rank: field!(_a0, rank).with_mut(|__v: &mut Option>>| __v.take()), @@ -179,6 +180,7 @@ pub struct Graph { pub E: i32, } impl Graph { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { edges: field!(_a0, edges).with_mut(|__v: &mut Option>>| __v.take()), @@ -291,6 +293,7 @@ pub trait DisjointSetImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl DisjointSetImpl for Ptr { + #[inline] fn makeSet(&self) { let mut i: i32 = 0; 'loop_: while (i < (*self).with(|__s| __s.n)) { @@ -304,6 +307,7 @@ impl DisjointSetImpl for Ptr { i.postfix_inc(); } } + #[inline] fn find(&self, mut x: i32) -> i32 { if ((((*self).with(|__s| __s.parent.clone()).as_pointer() as Ptr) .offset((x as usize) as isize) @@ -324,6 +328,7 @@ impl DisjointSetImpl for Ptr { .offset((x as usize) as isize) .read()); } + #[inline] fn merge(&self, mut x: i32, mut y: i32) { let mut xset: i32 = ({ DisjointSetImpl::find(self, x) }); let mut yset: i32 = ({ DisjointSetImpl::find(self, y) }); @@ -363,6 +368,7 @@ impl DisjointSetImpl for Ptr { .write(__rhs); } } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), rank) .write(field!(_a0, rank).with_mut(|__v: &mut Option>>| __v.take())); @@ -376,6 +382,7 @@ pub trait GraphImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl GraphImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), edges) .write(field!(_a0, edges).with_mut(|__v: &mut Option>>| __v.take())); diff --git a/tests/unit/out/refcount/lambda_as_field.rs b/tests/unit/out/refcount/lambda_as_field.rs index 35a4be81a..0baeab4d5 100644 --- a/tests/unit/out/refcount/lambda_as_field.rs +++ b/tests/unit/out/refcount/lambda_as_field.rs @@ -74,6 +74,7 @@ pub struct Moving__lambda_at_lambda_as_field_cpp_64_12__ { pub moves: i32, } impl Moving__lambda_at_lambda_as_field_cpp_64_12__ { + #[inline] pub fn new(f: FnPtr i32>) -> Self { let f: Value i32>> = Rc::new(RefCell::new(f)); Self { @@ -81,6 +82,7 @@ impl Moving__lambda_at_lambda_as_field_cpp_64_12__ { moves: 0, } } + #[inline] pub fn move_from(o: Ptr) -> Self { Self { f: (*o.upgrade().deref()).f.move_from(), @@ -237,6 +239,7 @@ pub trait Guard__lambda_at_lambda_as_field_cpp_34_13__Impl { impl Guard__lambda_at_lambda_as_field_cpp_34_13__Impl for Ptr { + #[inline] fn destructor(&self) { ({ (*(*self).upgrade().deref()).f.call() }); } @@ -247,6 +250,7 @@ pub trait Guard__lambda_at_lambda_as_field_cpp_45_13__Impl { impl Guard__lambda_at_lambda_as_field_cpp_45_13__Impl for Ptr { + #[inline] fn destructor(&self) { ({ (*(*self).upgrade().deref()).f.call() }); } @@ -257,6 +261,7 @@ pub trait Holder__lambda_at_lambda_as_field_cpp_39_12__Impl { impl Holder__lambda_at_lambda_as_field_cpp_39_12__Impl for Ptr { + #[inline] fn call(&self, mut x: i32) -> i32 { field!((*self), calls).with_mut(|__v| __v.postfix_inc()); return ({ (*(*self).upgrade().deref()).f.call(x) }); @@ -268,6 +273,7 @@ pub trait Holder__lambda_at_lambda_as_field_cpp_51_12__Impl { impl Holder__lambda_at_lambda_as_field_cpp_51_12__Impl for Ptr { + #[inline] fn call(&self, mut x: i32) -> i32 { field!((*self), calls).with_mut(|__v| __v.postfix_inc()); return ({ (*(*self).upgrade().deref()).f.call(x) }); diff --git a/tests/unit/out/refcount/lambda_capture_copy_ctor.rs b/tests/unit/out/refcount/lambda_capture_copy_ctor.rs index 22d05b243..ce67e941c 100644 --- a/tests/unit/out/refcount/lambda_capture_copy_ctor.rs +++ b/tests/unit/out/refcount/lambda_capture_copy_ctor.rs @@ -15,18 +15,21 @@ pub struct Counted { pub moves: i32, } impl Counted { + #[inline] pub fn new() -> Self { Self { copies: 0, moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { copies: (o.with(|__s| __s.copies) + 1), moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { Self { copies: o.with(|__s| __s.copies), @@ -55,12 +58,15 @@ thread_local!( #[byte_size(1)] pub struct Dropped {} impl Dropped { + #[inline] pub fn new() -> Self { Self {} } + #[inline] pub fn copy_from(_a0: Ptr) -> Self { Self {} } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self {} } @@ -182,6 +188,7 @@ pub trait DroppedImpl { fn destructor(&self); } impl DroppedImpl for Ptr { + #[inline] fn destructor(&self) { (*drops_0.with(Value::clone).borrow_mut()).postfix_inc(); } diff --git a/tests/unit/out/refcount/lambda_capture_star_this.rs b/tests/unit/out/refcount/lambda_capture_star_this.rs index c45e1598a..029c88639 100644 --- a/tests/unit/out/refcount/lambda_capture_star_this.rs +++ b/tests/unit/out/refcount/lambda_capture_star_this.rs @@ -33,9 +33,11 @@ pub trait SImpl { fn mixed(&self, k: i32) -> i32; } impl SImpl for Ptr { + #[inline] fn twice(&self) -> i32 { return ((*self).with(|__s| __s.n) * 2); } + #[inline] fn modify_copy(&self) -> i32 { let f: Value i32>> = Rc::new(RefCell::new(lambda!( { @@ -51,6 +53,7 @@ impl SImpl for Ptr { let mut r: i32 = ({ (*f.borrow()).call() }).clone(); return ((r * 100) + (*self).with(|__s| __s.n)); } + #[inline] fn snapshot(&self) -> i32 { let f: Value i32>> = Rc::new(RefCell::new(lambda!( { @@ -63,6 +66,7 @@ impl SImpl for Ptr { field!((*self), n).write(99); return ({ (*f.borrow()).call() }).clone(); } + #[inline] fn mixed(&self, k: i32) -> i32 { let k: Value = Rc::new(RefCell::new(k)); let f: Value i32>> = Rc::new(RefCell::new(lambda!( diff --git a/tests/unit/out/refcount/lambda_capture_this.rs b/tests/unit/out/refcount/lambda_capture_this.rs index 2c5aa1ff7..c22e0a412 100644 --- a/tests/unit/out/refcount/lambda_capture_this.rs +++ b/tests/unit/out/refcount/lambda_capture_this.rs @@ -35,15 +35,18 @@ pub trait SImpl { fn read_scaled(&self) -> i32; } impl SImpl for Ptr { + #[inline] fn add(&self, mut k: i32) { { let __rhs = k; field!((*self), n).with_mut(|__v| *__v = *__v + __rhs) }; } + #[inline] fn scaled(&self) -> i32 { return ((*self).with(|__s| __s.n) * (*self).with(|__s| __s.step)); } + #[inline] fn bump(&self, mut by: i32) { let inc: Value> = Rc::new(RefCell::new(lambda!( { @@ -59,6 +62,7 @@ impl SImpl for Ptr { ({ (*inc.borrow()).call(by) }); ({ (*inc.borrow()).call(by) }); } + #[inline] fn bump_via_method(&self, mut by: i32) { let inc: Value> = Rc::new(RefCell::new(lambda!( { @@ -70,6 +74,7 @@ impl SImpl for Ptr { ))); ({ (*inc.borrow()).call(by) }); } + #[inline] fn read_scaled(&self) -> i32 { let get: Value i32>> = Rc::new(RefCell::new(lambda!( { diff --git a/tests/unit/out/refcount/lambda_decltype_type.rs b/tests/unit/out/refcount/lambda_decltype_type.rs index 796c9238d..e44c235b2 100644 --- a/tests/unit/out/refcount/lambda_decltype_type.rs +++ b/tests/unit/out/refcount/lambda_decltype_type.rs @@ -128,6 +128,7 @@ pub trait Sorted__lambda_at_lambda_decltype_type_cpp_19_23__Impl { impl Sorted__lambda_at_lambda_decltype_type_cpp_19_23__Impl for Ptr { + #[inline] fn insert(&self, mut v: i32) { let mut i: i32 = (*self).with(|__s| __s.size); 'loop_: while (i > 0) @@ -149,6 +150,7 @@ pub trait Sorted__lambda_at_lambda_decltype_type_cpp_22_18__Impl { impl Sorted__lambda_at_lambda_decltype_type_cpp_22_18__Impl for Ptr { + #[inline] fn insert(&self, mut v: i32) { let mut i: i32 = (*self).with(|__s| __s.size); 'loop_: while (i > 0) diff --git a/tests/unit/out/refcount/lambda_move_only_capture.rs b/tests/unit/out/refcount/lambda_move_only_capture.rs index a453ce8c8..0aab1408b 100644 --- a/tests/unit/out/refcount/lambda_move_only_capture.rs +++ b/tests/unit/out/refcount/lambda_move_only_capture.rs @@ -15,9 +15,11 @@ pub struct Owner { pub p: Ptr, } impl Owner { + #[inline] pub fn new(mut v: i32) -> Self { Self { p: Ptr::alloc(v) } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Owner = Self { p: o.with(|__s| __s.p.clone()), @@ -79,9 +81,11 @@ pub trait OwnerImpl { fn take(&self) -> FnPtr i32>; } impl OwnerImpl for Ptr { + #[inline] fn destructor(&self) { (*self).with(|__s| __s.p.clone()).delete(); } + #[inline] fn take(&self) -> FnPtr i32> { return lambda!( { diff --git a/tests/unit/out/refcount/lambda_nested.rs b/tests/unit/out/refcount/lambda_nested.rs index 0a4399dc9..40fdbf206 100644 --- a/tests/unit/out/refcount/lambda_nested.rs +++ b/tests/unit/out/refcount/lambda_nested.rs @@ -47,6 +47,7 @@ pub trait SImpl { fn nested_this(&self) -> i32; } impl SImpl for Ptr { + #[inline] fn nested_this(&self) -> i32 { let outer: Value i32>> = Rc::new(RefCell::new(lambda!( { diff --git a/tests/unit/out/refcount/libc_struct_without_default.rs b/tests/unit/out/refcount/libc_struct_without_default.rs index b4b69c6f6..8759ce3e4 100644 --- a/tests/unit/out/refcount/libc_struct_without_default.rs +++ b/tests/unit/out/refcount/libc_struct_without_default.rs @@ -17,6 +17,7 @@ pub struct UserDefined { pub v: Vec, } impl UserDefined { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { a: (0..1) @@ -88,6 +89,7 @@ pub trait UserDefinedImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl UserDefinedImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { for __i in 0..1 { &field_ref!((*self), a) diff --git a/tests/unit/out/refcount/linked_list.rs b/tests/unit/out/refcount/linked_list.rs index 87fd304f1..ffbd128c4 100644 --- a/tests/unit/out/refcount/linked_list.rs +++ b/tests/unit/out/refcount/linked_list.rs @@ -141,6 +141,7 @@ pub trait NodeImpl { fn SetNext(&self, next: Ptr); } impl NodeImpl for Ptr { + #[inline] fn SetNext(&self, mut next: Ptr) { field!((*self), next).write((next).clone()); } diff --git a/tests/unit/out/refcount/map.rs b/tests/unit/out/refcount/map.rs index fd2480e79..c4b9e360a 100644 --- a/tests/unit/out/refcount/map.rs +++ b/tests/unit/out/refcount/map.rs @@ -21,9 +21,11 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub fn new_1() -> Self { Self { x: 0, y: 0 } } + #[inline] pub fn new_2(mut x: i32, mut y: i32) -> Self { Self { x: x, y: y } } diff --git a/tests/unit/out/refcount/map_key_copy_ctor.rs b/tests/unit/out/refcount/map_key_copy_ctor.rs index 17de5bfa0..e1e67b358 100644 --- a/tests/unit/out/refcount/map_key_copy_ctor.rs +++ b/tests/unit/out/refcount/map_key_copy_ctor.rs @@ -23,9 +23,11 @@ pub struct Key { pub k: i32, } impl Key { + #[inline] pub fn new(mut k: i32) -> Self { Self { k: k } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Key = Self { k: o.with(|__s| __s.k), @@ -33,6 +35,7 @@ impl Key { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Key = Self { k: o.with(|__s| __s.k), @@ -271,6 +274,7 @@ pub trait KeyImpl { fn operator_lt(&self, o: Ptr) -> bool; } impl KeyImpl for Ptr { + #[inline] fn operator_lt(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.k) } < { o.with(|__s| __s.k) }); } diff --git a/tests/unit/out/refcount/map_key_identity.rs b/tests/unit/out/refcount/map_key_identity.rs index 81461c53c..352eba832 100644 --- a/tests/unit/out/refcount/map_key_identity.rs +++ b/tests/unit/out/refcount/map_key_identity.rs @@ -40,6 +40,7 @@ pub struct Mapped { pub value: i32, } impl Mapped { + #[inline] pub fn new() -> Self { let __this: Mapped = Self { value: 0 }; (*default_constructions_0.with(Value::clone).borrow_mut()).prefix_inc(); diff --git a/tests/unit/out/refcount/max.rs b/tests/unit/out/refcount/max.rs index 05fdedd96..ef0319920 100644 --- a/tests/unit/out/refcount/max.rs +++ b/tests/unit/out/refcount/max.rs @@ -28,9 +28,11 @@ pub struct Bag { pub n: i32, } impl Bag { + #[inline] pub fn new(mut n: i32) -> Self { Self { n: n } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Bag = Self { n: o.with(|__s| __s.n), @@ -214,6 +216,7 @@ pub trait BagImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl BagImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), n).write({ _a0.with(|__s| __s.n) }); return (*self).clone(); diff --git a/tests/unit/out/refcount/move_assign.rs b/tests/unit/out/refcount/move_assign.rs index 67f6ae550..1dbdc1e06 100644 --- a/tests/unit/out/refcount/move_assign.rs +++ b/tests/unit/out/refcount/move_assign.rs @@ -14,9 +14,11 @@ pub struct MoveOnly { pub v: i32, } impl MoveOnly { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: MoveOnly = Self { v: o.with(|__s| __s.v), @@ -32,6 +34,7 @@ pub struct ConstMoveAssign { pub mark: i32, } impl ConstMoveAssign { + #[inline] pub fn new() -> Self { Self { mark: 0 } } @@ -110,10 +113,12 @@ pub trait ConstMoveAssignImpl { fn operator_assign_3(&self, o: Ptr) -> Ptr; } impl ConstMoveAssignImpl for Ptr { + #[inline] fn operator_assign_2(&self, o: Ptr) -> Ptr { field!((*self), mark).write({ (o.with(|__s| __s.mark) + 1) }); return (*self).clone(); } + #[inline] fn operator_assign_3(&self, o: Ptr) -> Ptr { field!((*self), mark).write({ (o.with(|__s| __s.mark) + 10) }); return (*self).clone(); @@ -123,6 +128,7 @@ pub trait MoveOnlyImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl MoveOnlyImpl for Ptr { + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { if ((*self) == (o)) { return (*self).clone(); diff --git a/tests/unit/out/refcount/move_ctor.rs b/tests/unit/out/refcount/move_ctor.rs index d1022aa2b..7ba20bd35 100644 --- a/tests/unit/out/refcount/move_ctor.rs +++ b/tests/unit/out/refcount/move_ctor.rs @@ -14,9 +14,11 @@ pub struct MoveOnly { pub v: i32, } impl MoveOnly { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: MoveOnly = Self { v: o.with(|__s| __s.v), @@ -32,14 +34,17 @@ pub struct ConstMove { pub mark: i32, } impl ConstMove { + #[inline] pub fn new() -> Self { Self { mark: 0 } } + #[inline] pub fn new_1(o: Ptr) -> Self { Self { mark: (o.with(|__s| __s.mark) + 1), } } + #[inline] pub fn new_2(o: Ptr) -> Self { Self { mark: (o.with(|__s| __s.mark) + 10), @@ -63,6 +68,7 @@ pub struct ThrowingMove { pub moves: i32, } impl ThrowingMove { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -70,6 +76,7 @@ impl ThrowingMove { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -77,6 +84,7 @@ impl ThrowingMove { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: ThrowingMove = Self { v: o.with(|__s| __s.v), @@ -109,6 +117,7 @@ pub struct NoexceptMove { pub moves: i32, } impl NoexceptMove { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v, @@ -116,6 +125,7 @@ impl NoexceptMove { moves: 0, } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -123,6 +133,7 @@ impl NoexceptMove { moves: o.with(|__s| __s.moves), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: NoexceptMove = Self { v: o.with(|__s| __s.v), diff --git a/tests/unit/out/refcount/move_this.rs b/tests/unit/out/refcount/move_this.rs index 97ccfd8b3..4d5789528 100644 --- a/tests/unit/out/refcount/move_this.rs +++ b/tests/unit/out/refcount/move_this.rs @@ -14,14 +14,17 @@ pub struct Chain { pub v: i32, } impl Chain { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { Self { v: (o.with(|__s| __s.v) + 100), } } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Chain = Self { v: (o.with(|__s| __s.v) + 1), @@ -79,6 +82,7 @@ pub trait ChainImpl { fn self_(&self) -> Ptr; } impl ChainImpl for Ptr { + #[inline] fn add_4(&self, mut n: i32) -> Ptr { { let __rhs = n; @@ -86,6 +90,7 @@ impl ChainImpl for Ptr { }; return (*self).clone(); } + #[inline] fn add_5(&self, mut n: i32) -> Ptr { { let __rhs = n; @@ -93,12 +98,15 @@ impl ChainImpl for Ptr { }; return (*self).clone(); } + #[inline] fn take(&self) -> Chain { return Chain::move_from({ (*self).clone() }); } + #[inline] fn copy(&self) -> Chain { return Chain::copy_from({ (*self).clone() }); } + #[inline] fn self_(&self) -> Ptr { return (*self).clone(); } diff --git a/tests/unit/out/refcount/nttp_distinct_specializations.rs b/tests/unit/out/refcount/nttp_distinct_specializations.rs index c96a166f8..d4a0782b7 100644 --- a/tests/unit/out/refcount/nttp_distinct_specializations.rs +++ b/tests/unit/out/refcount/nttp_distinct_specializations.rs @@ -55,6 +55,7 @@ pub trait S_1_Impl { fn get(&self) -> i32; } impl S_1_Impl for Ptr { + #[inline] fn get(&self) -> i32 { return ((*self).with(|__s| __s.v) * 1); } @@ -63,6 +64,7 @@ pub trait S_2_Impl { fn get(&self) -> i32; } impl S_2_Impl for Ptr { + #[inline] fn get(&self) -> i32 { return ((*self).with(|__s| __s.v) - (*self).with(|__s| __s.w)); } @@ -71,6 +73,7 @@ pub trait S_3_Impl { fn get(&self) -> i32; } impl S_3_Impl for Ptr { + #[inline] fn get(&self) -> i32 { return ((*self).with(|__s| __s.v) * 3); } diff --git a/tests/unit/out/refcount/operator_arithmetic_member.rs b/tests/unit/out/refcount/operator_arithmetic_member.rs index 5ad3e6ab3..5f9569359 100644 --- a/tests/unit/out/refcount/operator_arithmetic_member.rs +++ b/tests/unit/out/refcount/operator_arithmetic_member.rs @@ -65,54 +65,65 @@ pub trait SImpl { fn operator_post_dec_11(&self, _a0: i32) -> S; } impl SImpl for Ptr { + #[inline] fn operator_add_1(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } + { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_sub_2(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } - { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_mul(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } * { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_div(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } / { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_rem(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } % { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_pos_6(&self) -> S { return S { v: (*self).with(|__s| __s.v), }; } + #[inline] fn operator_neg_7(&self) -> S { return S { v: -(*self).with(|__s| __s.v), }; } + #[inline] fn operator_inc_8(&self) -> Ptr { field!((*self), v).with_mut(|__v| __v.prefix_inc()); return (*self).clone(); } + #[inline] fn operator_post_inc_9(&self, mut _a0: i32) -> S { let mut old: S = (*(*self).upgrade().deref()).clone(); field!((*self), v).with_mut(|__v| __v.prefix_inc()); return old; } + #[inline] fn operator_dec_10(&self) -> Ptr { field!((*self), v).with_mut(|__v| __v.prefix_dec()); return (*self).clone(); } + #[inline] fn operator_post_dec_11(&self, mut _a0: i32) -> S { let mut old: S = (*(*self).upgrade().deref()).clone(); field!((*self), v).with_mut(|__v| __v.prefix_dec()); diff --git a/tests/unit/out/refcount/operator_bitwise_member.rs b/tests/unit/out/refcount/operator_bitwise_member.rs index c9c93e4f6..171910f4c 100644 --- a/tests/unit/out/refcount/operator_bitwise_member.rs +++ b/tests/unit/out/refcount/operator_bitwise_member.rs @@ -36,31 +36,37 @@ pub trait SImpl { fn operator_shr(&self, n: i32) -> S; } impl SImpl for Ptr { + #[inline] fn operator_bitnot(&self) -> S { return S { v: !(*self).with(|__s| __s.v), }; } + #[inline] fn operator_bitand(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } & { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_bitor(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } | { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_bitxor(&self, o: Ptr) -> S { return S { v: ({ (*self).with(|__s| __s.v) } ^ { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_shl(&self, mut n: i32) -> S { return S { v: ((*self).with(|__s| __s.v) << n), }; } + #[inline] fn operator_shr(&self, mut n: i32) -> S { return S { v: ((*self).with(|__s| __s.v) >> n), diff --git a/tests/unit/out/refcount/operator_comparison_defaulted.rs b/tests/unit/out/refcount/operator_comparison_defaulted.rs index ec9c88e83..bef981181 100644 --- a/tests/unit/out/refcount/operator_comparison_defaulted.rs +++ b/tests/unit/out/refcount/operator_comparison_defaulted.rs @@ -242,9 +242,11 @@ pub trait BothImpl { fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering; } impl BothImpl for Ptr { + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.a) } == { _a0.with(|__s| __s.a) }); } + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -263,6 +265,7 @@ pub trait CmpImpl { fn operator_eq(&self, _a0: Ptr) -> bool; } impl CmpImpl for Ptr { + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -284,6 +287,7 @@ impl CmpImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.a) } == { _a0.with(|__s| __s.a) }) && ({ (*self).with(|__s| __s.b) } == { _a0.with(|__s| __s.b) }); @@ -293,6 +297,7 @@ pub trait EqImpl { fn operator_eq(&self, _a0: Ptr) -> bool; } impl EqImpl for Ptr { + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.a) } == { _a0.with(|__s| __s.a) }) && ({ (*self).with(|__s| __s.b) } == { _a0.with(|__s| __s.b) }); @@ -303,6 +308,7 @@ pub trait InnerImpl { fn operator_eq(&self, _a0: Ptr) -> bool; } impl InnerImpl for Ptr { + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -315,6 +321,7 @@ impl InnerImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.x) } == { _a0.with(|__s| __s.x) }); } @@ -323,6 +330,7 @@ pub trait OrdOnlyImpl { fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering; } impl OrdOnlyImpl for Ptr { + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -341,6 +349,7 @@ pub trait OuterImpl { fn operator_eq(&self, _a0: Ptr) -> bool; } impl OuterImpl for Ptr { + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new( @@ -364,6 +373,7 @@ impl OuterImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ let _arg0: Ptr = field_ptr!(_a0, i); @@ -376,6 +386,7 @@ pub trait PtrMemberImpl { fn operator_eq(&self, _a0: Ptr) -> bool; } impl PtrMemberImpl for Ptr { + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -388,6 +399,7 @@ impl PtrMemberImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.p.clone()) } == { _a0.with(|__s| __s.p.clone()) }); } @@ -400,15 +412,18 @@ pub trait SecondaryImpl { fn operator_ge(&self, _a0: Ptr) -> bool; } impl SecondaryImpl for Ptr { + #[inline] fn operator_eq(&self, _a0: Ptr) -> bool { return ({ (*self).with(|__s| __s.a) } == { _a0.with(|__s| __s.a) }); } + #[inline] fn operator_ne(&self, _a0: Ptr) -> bool { return !({ let _arg0: Ptr = (_a0).clone(); SecondaryImpl::operator_eq(&(*self), _arg0) }); } + #[inline] fn operator_cmp(&self, _a0: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -421,12 +436,14 @@ impl SecondaryImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_lt(&self, _a0: Ptr) -> bool { return ({ let _arg0: Ptr = (_a0).clone(); SecondaryImpl::operator_cmp(&(*self), _arg0) }) == std::cmp::Ordering::Less; } + #[inline] fn operator_ge(&self, _a0: Ptr) -> bool { return ({ let _arg0: Ptr = (_a0).clone(); diff --git a/tests/unit/out/refcount/operator_comparison_member.rs b/tests/unit/out/refcount/operator_comparison_member.rs index a15bcacfa..a9d70a49f 100644 --- a/tests/unit/out/refcount/operator_comparison_member.rs +++ b/tests/unit/out/refcount/operator_comparison_member.rs @@ -50,24 +50,31 @@ pub trait SImpl { fn operator_lt_7(&self, o: i32) -> bool; } impl SImpl for Ptr { + #[inline] fn operator_eq(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }); } + #[inline] fn operator_ne(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } != { o.with(|__s| __s.v) }); } + #[inline] fn operator_lt_3(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } < { o.with(|__s| __s.v) }); } + #[inline] fn operator_gt(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } > { o.with(|__s| __s.v) }); } + #[inline] fn operator_le(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } <= { o.with(|__s| __s.v) }); } + #[inline] fn operator_ge(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } >= { o.with(|__s| __s.v) }); } + #[inline] fn operator_lt_7(&self, mut o: i32) -> bool { return ((*self).with(|__s| __s.v) < o); } diff --git a/tests/unit/out/refcount/operator_comparison_mixed.rs b/tests/unit/out/refcount/operator_comparison_mixed.rs index 0e0020441..39bc577ce 100644 --- a/tests/unit/out/refcount/operator_comparison_mixed.rs +++ b/tests/unit/out/refcount/operator_comparison_mixed.rs @@ -75,21 +75,27 @@ pub trait SImpl { fn operator_ge(&self, o: Ptr) -> bool; } impl SImpl for Ptr { + #[inline] fn operator_eq(&self, mut o: i32) -> bool { return ((*self).with(|__s| __s.v) == o); } + #[inline] fn operator_ne(&self, mut o: i32) -> bool { return ((*self).with(|__s| __s.v) != o); } + #[inline] fn operator_lt(&self, mut o: i32) -> bool { return ((*self).with(|__s| __s.v) < o); } + #[inline] fn operator_gt(&self, mut o: f64) -> bool { return (((*self).with(|__s| __s.v) as f64) > o); } + #[inline] fn operator_le(&self, mut o: i64) -> bool { return (((*self).with(|__s| __s.v) as i64) <= o); } + #[inline] fn operator_ge(&self, mut o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } >= { (((o.read()) as i32) - (('0' as i8) as i32)) }); } diff --git a/tests/unit/out/refcount/operator_comparison_nonbool.rs b/tests/unit/out/refcount/operator_comparison_nonbool.rs index 027a81f33..3a467fef5 100644 --- a/tests/unit/out/refcount/operator_comparison_nonbool.rs +++ b/tests/unit/out/refcount/operator_comparison_nonbool.rs @@ -76,6 +76,7 @@ pub struct MyBool { pub value: bool, } impl MyBool { + #[inline] pub fn new(mut v: bool) -> Self { Self { value: v } } @@ -116,6 +117,7 @@ pub struct RefBool { pub value: bool, } impl RefBool { + #[inline] pub fn new(mut v: bool) -> Self { Self { value: v } } @@ -323,6 +325,7 @@ pub trait CustomImpl { fn operator_cmp(&self, o: Ptr) -> Result; } impl CustomImpl for Ptr { + #[inline] fn operator_cmp(&self, o: Ptr) -> Result { return Result { r: ({ (*self).with(|__s| __s.v) } - { o.with(|__s| __s.v) }), @@ -335,11 +338,13 @@ pub trait MixedImpl { fn operator_eq(&self, o: Ptr) -> i32; } impl MixedImpl for Ptr { + #[inline] fn operator_cmp(&self, o: Ptr) -> Result { return Result { r: ({ (*self).with(|__s| __s.v) } - { o.with(|__s| __s.v) }), }; } + #[inline] fn operator_lt(&self, o: Ptr) -> i32 { return if ({ (*self).with(|__s| __s.v) } < { o.with(|__s| __s.v) }) { 8 @@ -347,6 +352,7 @@ impl MixedImpl for Ptr { 0 }; } + #[inline] fn operator_eq(&self, o: Ptr) -> i32 { return if ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }) { 9 @@ -359,6 +365,7 @@ pub trait MyBoolImpl { fn to_bool(&self) -> bool; } impl MyBoolImpl for Ptr { + #[inline] fn to_bool(&self) -> bool { return (*self).with(|__s| __s.value); } @@ -367,6 +374,7 @@ pub trait RefBoolImpl { fn to_bool(&self) -> bool; } impl RefBoolImpl for Ptr { + #[inline] fn to_bool(&self) -> bool { return (*self).with(|__s| __s.value); } @@ -375,6 +383,7 @@ pub trait RefIntImpl { fn operator_eq(&self, _a0: Ptr) -> Ptr; } impl RefIntImpl for Ptr { + #[inline] fn operator_eq(&self, _a0: Ptr) -> Ptr { return ref_true_8.with(|v| v.as_pointer()); } diff --git a/tests/unit/out/refcount/operator_comparison_noncopyable.rs b/tests/unit/out/refcount/operator_comparison_noncopyable.rs index d45af15f2..f954ce7a3 100644 --- a/tests/unit/out/refcount/operator_comparison_noncopyable.rs +++ b/tests/unit/out/refcount/operator_comparison_noncopyable.rs @@ -6,9 +6,11 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; +#[inline] pub fn operator_eq_0(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.data_) } == { y.with(|__s| __s.data_) }); } +#[inline] pub fn operator_lt_1(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.data_) } < { y.with(|__s| __s.data_) }); } @@ -20,9 +22,11 @@ pub struct S { data_: i32, } impl S { + #[inline] pub fn new(mut data: i32) -> Self { Self { data_: data } } + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data_: { (*_a0.upgrade().deref()).data_ }, diff --git a/tests/unit/out/refcount/operator_compound_assignment_member.rs b/tests/unit/out/refcount/operator_compound_assignment_member.rs index 5724a8ec5..1a2971bf4 100644 --- a/tests/unit/out/refcount/operator_compound_assignment_member.rs +++ b/tests/unit/out/refcount/operator_compound_assignment_member.rs @@ -72,30 +72,37 @@ pub trait SImpl { fn operator_shr_assign(&self, n: i32) -> Ptr; } impl SImpl for Ptr { + #[inline] fn operator_assign_1(&self, mut n: u32) -> Ptr { field!((*self), v).write(n); return (*self).clone(); } + #[inline] fn operator_add_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ ((*self).with(|__s| __s.v)).wrapping_add(o.with(|__s| __s.v)) }); return (*self).clone(); } + #[inline] fn operator_sub_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ ((*self).with(|__s| __s.v)).wrapping_sub(o.with(|__s| __s.v)) }); return (*self).clone(); } + #[inline] fn operator_mul_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ ((*self).with(|__s| __s.v)).wrapping_mul(o.with(|__s| __s.v)) }); return (*self).clone(); } + #[inline] fn operator_div_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ ((*self).with(|__s| __s.v)).wrapping_div(o.with(|__s| __s.v)) }); return (*self).clone(); } + #[inline] fn operator_rem_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ ((*self).with(|__s| __s.v)).wrapping_rem(o.with(|__s| __s.v)) }); return (*self).clone(); } + #[inline] fn operator_bitand_assign(&self, o: Ptr) -> Ptr { { let __rhs = { o.with(|__s| __s.v) }; @@ -103,6 +110,7 @@ impl SImpl for Ptr { }; return (*self).clone(); } + #[inline] fn operator_bitor_assign(&self, o: Ptr) -> Ptr { { let __rhs = { o.with(|__s| __s.v) }; @@ -110,6 +118,7 @@ impl SImpl for Ptr { }; return (*self).clone(); } + #[inline] fn operator_bitxor_assign(&self, o: Ptr) -> Ptr { { let __rhs = { o.with(|__s| __s.v) }; @@ -117,6 +126,7 @@ impl SImpl for Ptr { }; return (*self).clone(); } + #[inline] fn operator_shl_assign(&self, mut n: i32) -> Ptr { { let __rhs = n; @@ -124,6 +134,7 @@ impl SImpl for Ptr { }; return (*self).clone(); } + #[inline] fn operator_shr_assign(&self, mut n: i32) -> Ptr { { let __rhs = n; diff --git a/tests/unit/out/refcount/operator_friend.rs b/tests/unit/out/refcount/operator_friend.rs index 4b05441ee..47e663921 100644 --- a/tests/unit/out/refcount/operator_friend.rs +++ b/tests/unit/out/refcount/operator_friend.rs @@ -6,6 +6,7 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; +#[inline] pub fn operator_eq_0(_a0: Ptr, _a1: Ptr) -> bool { return ({ _a0.with(|__s| __s.a) } == { _a1.with(|__s| __s.a) }) && ({ _a0.with(|__s| __s.b) } == { _a1.with(|__s| __s.b) }); @@ -23,6 +24,7 @@ impl CppEq for Defaulted { operator_eq_0(__lhs.clone(), __rhs.clone()) } } +#[inline] pub fn operator_cmp_1(_a0: Ptr, _a1: Ptr) -> std::cmp::Ordering { { let cmp: Value = Rc::new(RefCell::new(std::cmp::Ord::cmp( @@ -35,6 +37,7 @@ pub fn operator_cmp_1(_a0: Ptr, _a1: Ptr) -> std::cm } return std::cmp::Ordering::Equal; } +#[inline] pub fn operator_eq_2(_a0: Ptr, _a1: Ptr) -> bool { return ({ _a0.with(|__s| __s.a) } == { _a1.with(|__s| __s.a) }); } @@ -54,12 +57,15 @@ impl CppEq for DefaultedOrd { operator_eq_2(__lhs.clone(), __rhs.clone()) } } +#[inline] pub fn operator_eq_3(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.a) } == { y.with(|__s| __s.a) }); } +#[inline] pub fn operator_lt_4(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.a) } < { y.with(|__s| __s.a) }); } +#[inline] pub fn operator_add_5(x: Ptr, y: Ptr) -> Inline { return Inline { a: ({ x.with(|__s| __s.a) } + { y.with(|__s| __s.a) }), @@ -102,12 +108,15 @@ pub fn operator_ne_7(x: Ptr, y: Ptr) -> bool { operator_eq_6(_x, _y) }); } +#[inline] pub fn operator_eq_8(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.v) } == { y.with(|__s| __s.v) }); } +#[inline] pub fn operator_lt_9(x: Ptr, y: Ptr) -> bool { return ({ x.with(|__s| __s.v) } < { y.with(|__s| __s.v) }); } +#[inline] pub fn operator_eq_10(x: Ptr, y: Ptr) -> bool { return ({ (x.with(|__s| __s.v) as i64) } == { y.with(|__s| __s.v) }); } @@ -133,6 +142,7 @@ pub struct Tmpl_long_ { #[offset(0)] pub v: i64, } +#[inline] pub fn operator_eq_11(_a0: Ptr, _a1: Ptr) -> bool { return ({ _a0.with(|__s| __s.v) } == { _a1.with(|__s| __s.v) }); } diff --git a/tests/unit/out/refcount/operator_less_than.rs b/tests/unit/out/refcount/operator_less_than.rs index 8760c0875..3e73697d9 100644 --- a/tests/unit/out/refcount/operator_less_than.rs +++ b/tests/unit/out/refcount/operator_less_than.rs @@ -39,6 +39,7 @@ pub trait PairImpl { fn operator_lt(&self, other: Ptr) -> bool; } impl PairImpl for Ptr { + #[inline] fn operator_lt(&self, other: Ptr) -> bool { return ({ (*self).with(|__s| __s.x) } < { other.with(|__s| __s.x) }) || (({ (*self).with(|__s| __s.x) } == { other.with(|__s| __s.x) }) diff --git a/tests/unit/out/refcount/operator_logical_member.rs b/tests/unit/out/refcount/operator_logical_member.rs index 94ae1312e..13084b1b2 100644 --- a/tests/unit/out/refcount/operator_logical_member.rs +++ b/tests/unit/out/refcount/operator_logical_member.rs @@ -43,12 +43,15 @@ pub trait SImpl { fn operator_or(&self, o: Ptr) -> bool; } impl SImpl for Ptr { + #[inline] fn operator_not(&self) -> bool { return ((*self).with(|__s| __s.v) == 0); } + #[inline] fn operator_and(&self, o: Ptr) -> bool { return ((*self).with(|__s| __s.v) != 0) && (o.with(|__s| __s.v) != 0); } + #[inline] fn operator_or(&self, o: Ptr) -> bool { return ((*self).with(|__s| __s.v) != 0) || (o.with(|__s| __s.v) != 0); } diff --git a/tests/unit/out/refcount/operator_member_pointer_member.rs b/tests/unit/out/refcount/operator_member_pointer_member.rs index fd8f3eedb..87b6071c9 100644 --- a/tests/unit/out/refcount/operator_member_pointer_member.rs +++ b/tests/unit/out/refcount/operator_member_pointer_member.rs @@ -16,6 +16,7 @@ pub struct Inner { #[byte_size(1)] pub struct Table {} impl Table { + #[inline] pub fn operator_index(mut i: i32) -> Ptr { return (table_0.with(|v| v.as_pointer()) as Ptr).offset(i); } @@ -85,18 +86,23 @@ pub trait SImpl { fn operator_addr(&self) -> Ptr; } impl SImpl for Ptr { + #[inline] fn operator_index_1(&self, mut i: i32) -> Ptr { return (array_field_ptr!((*self), data) as Ptr).offset((i) as isize); } + #[inline] fn operator_index_2(&self, mut i: i32) -> Ptr { return (array_field_ptr!((*self), data) as Ptr).offset((i) as isize); } + #[inline] fn operator_deref(&self) -> Ptr { return field_ptr!((*self), inner); } + #[inline] fn operator_arrow(&self) -> Ptr { return (field_ptr!((*self), inner)); } + #[inline] fn operator_addr(&self) -> Ptr { return ((array_field_ptr!((*self), data) as Ptr).offset((0) as isize)); } diff --git a/tests/unit/out/refcount/operator_other_member.rs b/tests/unit/out/refcount/operator_other_member.rs index 07a49e8da..993a9c519 100644 --- a/tests/unit/out/refcount/operator_other_member.rs +++ b/tests/unit/out/refcount/operator_other_member.rs @@ -10,6 +10,7 @@ use std::rc::{Rc, Weak}; #[byte_size(1)] pub struct Static {} impl Static { + #[inline] pub fn operator_call(mut a: i32, mut b: i32) -> i32 { return (a * b); } @@ -61,23 +62,29 @@ pub trait SImpl { fn to_bool(&self) -> bool; } impl SImpl for Ptr { + #[inline] fn operator_call_1(&self) -> i32 { return (*self).with(|__s| __s.v); } + #[inline] fn operator_call_2(&self, mut a: i32) -> i32 { return ((*self).with(|__s| __s.v) + a); } + #[inline] fn operator_call_3(&self, mut a: i32, mut b: i32) -> i32 { return (((*self).with(|__s| __s.v) + a) + b); } + #[inline] fn operator_comma(&self, o: Ptr) -> S { return S { v: ({ ((*self).with(|__s| __s.v) * 10) } + { o.with(|__s| __s.v) }), }; } + #[inline] fn to_i32(&self) -> i32 { return (*self).with(|__s| __s.v); } + #[inline] fn to_bool(&self) -> bool { return ((*self).with(|__s| __s.v) != 0); } diff --git a/tests/unit/out/refcount/operator_overloads.rs b/tests/unit/out/refcount/operator_overloads.rs index ef7abc129..85d95ffbe 100644 --- a/tests/unit/out/refcount/operator_overloads.rs +++ b/tests/unit/out/refcount/operator_overloads.rs @@ -91,6 +91,7 @@ pub trait SImpl { fn operator_mul_7(&self, o: i32) -> i32; } impl SImpl for Ptr { + #[inline] fn operator_eq_1(&self, mut o: i32) -> i32 { return if ((*self).with(|__s| __s.v) == o) { 1 @@ -98,6 +99,7 @@ impl SImpl for Ptr { 0 }; } + #[inline] fn operator_eq_2(&self, mut o: i64) -> i32 { return if (((*self).with(|__s| __s.v) as i64) == o) { 2 @@ -105,6 +107,7 @@ impl SImpl for Ptr { 0 }; } + #[inline] fn operator_eq_3(&self, mut o: f64) -> i32 { return if (((*self).with(|__s| __s.v) as f64) == o) { 3 @@ -112,15 +115,19 @@ impl SImpl for Ptr { 0 }; } + #[inline] fn operator_add(&self, o: Ptr) -> i32 { return ({ (*self).with(|__s| __s.v) } + { o.with(|__s| __s.v) }); } + #[inline] fn operator_sub(&self, mut o: S) -> i32 { return ((*self).with(|__s| __s.v) - o.v); } + #[inline] fn operator_mul_6(&self, o: Ptr) -> i32 { return ({ (*self).with(|__s| __s.v) } * { o.with(|__s| __s.v) }); } + #[inline] fn operator_mul_7(&self, mut o: i32) -> i32 { return (((*self).with(|__s| __s.v) * o) + 1); } diff --git a/tests/unit/out/refcount/operator_qualifiers.rs b/tests/unit/out/refcount/operator_qualifiers.rs index 1602e7ac0..2ccb69f69 100644 --- a/tests/unit/out/refcount/operator_qualifiers.rs +++ b/tests/unit/out/refcount/operator_qualifiers.rs @@ -48,30 +48,39 @@ pub trait SImpl { fn operator_index_9(&self, i: i32) -> i32; } impl SImpl for Ptr { + #[inline] fn operator_add_1(&self, mut a: i32) -> i32 { return ((*self).with(|__s| __s.v) + a); } + #[inline] fn operator_add_2(&self, mut a: i32) -> i32 { return (((*self).with(|__s| __s.v) + a) + 1); } + #[inline] fn operator_add_3(&self, mut a: i32) -> i32 { return (((*self).with(|__s| __s.v) + a) + 2); } + #[inline] fn operator_sub_4(&self, mut a: i32) -> i32 { return ((*self).with(|__s| __s.v) - a); } + #[inline] fn operator_sub_5(&self, mut a: i32) -> i32 { return (((*self).with(|__s| __s.v) - a) - 1); } + #[inline] fn operator_mul_6(&self, mut a: i32) -> i32 { return ((*self).with(|__s| __s.v) * a); } + #[inline] fn operator_mul_7(&self, mut a: i32) -> i32 { return (((*self).with(|__s| __s.v) * a) * 2); } + #[inline] fn operator_index_8(&self, mut i: i32) -> i32 { return ((*self).with(|__s| __s.v) + i); } + #[inline] fn operator_index_9(&self, mut i: i32) -> i32 { return (((*self).with(|__s| __s.v) + i) + 100); } diff --git a/tests/unit/out/refcount/operator_three_way.rs b/tests/unit/out/refcount/operator_three_way.rs index 7392069d0..42806cb77 100644 --- a/tests/unit/out/refcount/operator_three_way.rs +++ b/tests/unit/out/refcount/operator_three_way.rs @@ -52,6 +52,7 @@ pub trait SImpl { fn operator_eq(&self, o: Ptr) -> bool; } impl SImpl for Ptr { + #[inline] fn operator_cmp(&self, o: Ptr) -> std::cmp::Ordering { if ({ (*self).with(|__s| __s.v) } < { o.with(|__s| __s.v) }) { return std::cmp::Ordering::Less; @@ -61,6 +62,7 @@ impl SImpl for Ptr { } return std::cmp::Ordering::Equal; } + #[inline] fn operator_eq(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }); } diff --git a/tests/unit/out/refcount/operator_traits.rs b/tests/unit/out/refcount/operator_traits.rs index 8a276ef68..80ac50bcb 100644 --- a/tests/unit/out/refcount/operator_traits.rs +++ b/tests/unit/out/refcount/operator_traits.rs @@ -239,9 +239,11 @@ pub trait CmpImpl { fn operator_eq(&self, o: Ptr) -> bool; } impl CmpImpl for Ptr { + #[inline] fn operator_cmp(&self, o: Ptr) -> std::cmp::Ordering { return std::cmp::Ord::cmp(&((*self).with(|__s| __s.v)), &(o.with(|__s| __s.v))); } + #[inline] fn operator_eq(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }); } @@ -250,6 +252,7 @@ pub trait EqImpl { fn operator_eq(&self, o: Ptr) -> bool; } impl EqImpl for Ptr { + #[inline] fn operator_eq(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } == { o.with(|__s| __s.v) }); } @@ -258,6 +261,7 @@ pub trait LtImpl { fn operator_lt(&self, o: Ptr) -> bool; } impl LtImpl for Ptr { + #[inline] fn operator_lt(&self, o: Ptr) -> bool { return ({ (*self).with(|__s| __s.v) } < { o.with(|__s| __s.v) }); } diff --git a/tests/unit/out/refcount/overload_mangling.rs b/tests/unit/out/refcount/overload_mangling.rs index a93ee5bf2..b6428427b 100644 --- a/tests/unit/out/refcount/overload_mangling.rs +++ b/tests/unit/out/refcount/overload_mangling.rs @@ -136,15 +136,19 @@ pub trait Access_S_Impl { fn ref_4(&self, r: Ptr) -> i32; } impl Access_S_Impl for Ptr { + #[inline] fn get_1(&self, mut p: Ptr) -> i32 { return p.with(|__s| __s.base); } + #[inline] fn get_2(&self, mut p: Ptr) -> i32 { return (p.with(|__s| __s.base) + 1); } + #[inline] fn ref_3(&self, r: Ptr) -> i32 { return (r.with(|__s| __s.base) + 2); } + #[inline] fn ref_4(&self, r: Ptr) -> i32 { return (r.with(|__s| __s.base) + 3); } @@ -181,39 +185,49 @@ pub trait SImpl { fn count_3_int_long(&self, x: i32) -> i32; } impl SImpl for Ptr { + #[inline] fn plain_4(&self, mut x: i32) -> i32 { return ((*self).with(|__s| __s.base) + x); } + #[inline] fn plain_5(&self, mut x: i64) -> i32 { return (((*self).with(|__s| __s.base) + (x as i32)) + 1); } + #[inline] fn take_6(&self, x: Ptr) -> i32 { return (({ (*self).with(|__s| __s.base) } + { (x.read()) }) + 1); } + #[inline] fn take_7(&self, x: Ptr) -> i32 { return (({ (*self).with(|__s| __s.base) } + { (x.read()) }) + 2); } + #[inline] fn pick_8(&self, p: (Value, Value)) -> i32 { let p: Value<(Value, Value)> = Rc::new(RefCell::new(p)); return ((*self).with(|__s| __s.base) + (*(*p.borrow()).0.borrow())); } + #[inline] fn pick_9(&self, p: (Value, Value)) -> i32 { let p: Value<(Value, Value)> = Rc::new(RefCell::new(p)); return ((*self).with(|__s| __s.base) + ((*(*p.borrow()).1.borrow()) as i32)); } + #[inline] fn apply_10(&self, mut f: FnPtr)>, x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); ({ f.call((x.as_pointer())) }); return ((*self).with(|__s| __s.base) + (*x.borrow())); } + #[inline] fn apply_11(&self, mut f: FnPtr, i32)>, x: i32) -> i32 { let x: Value = Rc::new(RefCell::new(x)); ({ f.call((x.as_pointer()), 10) }); return ((*self).with(|__s| __s.base) + (*x.borrow())); } + #[inline] fn apply_12(&self, mut f: FnPtr i32>, mut x: i32) -> i32 { return ({ (*self).with(|__s| __s.base) } + { ({ f.call(x) }) }); } + #[inline] fn combine_13( &self, p: Ptr<(Value, Value)>, @@ -229,6 +243,7 @@ impl SImpl for Ptr { } + { ({ f.call((q.read())) }) }) } + { (n as i32) }); } + #[inline] fn combine_14( &self, p: Ptr<(Value, Value)>, @@ -244,21 +259,27 @@ impl SImpl for Ptr { return ({ ({ (*self).with(|__s| __s.base) } + { (*(*p.upgrade().deref()).0.borrow()) }) } + { (q.read()) }); } + #[inline] fn width_1_char(&self, mut x: i32) -> i32 { return ((*self).with(|__s| __s.base) + (x * (::std::mem::size_of::() as i32))); } + #[inline] fn width_1_int(&self, mut x: i32) -> i32 { return ((*self).with(|__s| __s.base) + (x * (::std::mem::size_of::() as i32))); } + #[inline] fn scale_2_2(&self, mut x: i32) -> i32 { return ((*self).with(|__s| __s.base) + (x * 2)); } + #[inline] fn scale_2_3(&self, mut x: i32) -> i32 { return ((*self).with(|__s| __s.base) + (x * 3)); } + #[inline] fn count_3(&self, mut x: i32) -> i32 { return (((*self).with(|__s| __s.base) + x) + (0 as i32)); } + #[inline] fn count_3_int_long(&self, mut x: i32) -> i32 { return (((*self).with(|__s| __s.base) + x) + (2 as i32)); } diff --git a/tests/unit/out/refcount/pair_converting_construction.rs b/tests/unit/out/refcount/pair_converting_construction.rs index ef1ad3758..ff4ad94bd 100644 --- a/tests/unit/out/refcount/pair_converting_construction.rs +++ b/tests/unit/out/refcount/pair_converting_construction.rs @@ -14,6 +14,7 @@ pub struct Celsius { pub degrees: i32, } impl Celsius { + #[inline] pub fn new(mut d: i32) -> Self { Self { degrees: d } } @@ -33,6 +34,7 @@ pub struct Label { pub id: i32, } impl Label { + #[inline] pub fn new(c: Ptr) -> Self { Self { id: c.with(|__s| __s.degrees), @@ -50,12 +52,14 @@ pub struct Owner { pub copied: i32, } impl Owner { + #[inline] pub fn new_1(c: Ptr) -> Self { Self { taken: 0, copied: c.with(|__s| __s.degrees), } } + #[inline] pub fn new_2(c: Ptr) -> Self { Self { taken: c.with(|__s| __s.degrees), @@ -71,6 +75,7 @@ pub struct Holder { pub value: i32, } impl Holder { + #[inline] pub fn new(mut c: Celsius) -> Self { Self { value: c.degrees } } @@ -83,6 +88,7 @@ pub struct Fallback { pub value: i32, } impl Fallback { + #[inline] pub fn new(v: Option) -> Self { let mut v: i32 = v.unwrap_or_else(|| -1_i32); Self { value: v } @@ -107,6 +113,7 @@ pub struct Observer { pub seen: i32, } impl Observer { + #[inline] pub fn new(c: Ptr) -> Self { let __this: Observer = Self { seen: c.with(|__s| __s.hits), @@ -116,6 +123,7 @@ impl Observer { } } impl Tag { + #[inline] pub fn new(u: Ptr) -> Self { Self { code: (u.with(|__s| __s.degrees) + 100), @@ -137,6 +145,7 @@ pub struct Name { pub len: i32, } impl Name { + #[inline] pub fn new(mut s: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { len: 0 })); let this: Ptr = __this.as_pointer(); @@ -337,6 +346,7 @@ pub trait MetersImpl { fn to_i32(&self) -> i32; } impl MetersImpl for Ptr { + #[inline] fn to_i32(&self) -> i32 { return (*self).with(|__s| __s.value); } diff --git a/tests/unit/out/refcount/pointers.rs b/tests/unit/out/refcount/pointers.rs index 28963a112..306df9431 100644 --- a/tests/unit/out/refcount/pointers.rs +++ b/tests/unit/out/refcount/pointers.rs @@ -54,15 +54,19 @@ pub trait TestImpl { fn update(&self, x: i32, y: i32); } impl TestImpl for Ptr { + #[inline] fn inc(&self) { field!((*self), x).with_mut(|__v| __v.postfix_inc()); } + #[inline] fn dec(&self) { field!((*self), x).with_mut(|__v| __v.postfix_dec()); } + #[inline] fn as_ptr(&self) -> Ptr { return (field_ptr!((*self), x)); } + #[inline] fn update(&self, mut x: i32, mut y: i32) { field!((*self), x).write((x + y)); } diff --git a/tests/unit/out/refcount/polymorphism.rs b/tests/unit/out/refcount/polymorphism.rs index 3446482e1..0884a6c72 100644 --- a/tests/unit/out/refcount/polymorphism.rs +++ b/tests/unit/out/refcount/polymorphism.rs @@ -30,11 +30,13 @@ fn main_0() -> i32 { return 0; } impl Animal for Cat { + #[inline] fn bark(&self) -> bool { return false; } } impl Animal for Dog { + #[inline] fn bark(&self) -> bool { return true; } @@ -43,6 +45,7 @@ pub trait CatImpl { fn meow(&self) -> bool; } impl CatImpl for Ptr { + #[inline] fn meow(&self) -> bool { return true; } diff --git a/tests/unit/out/refcount/push_emplace_back.rs b/tests/unit/out/refcount/push_emplace_back.rs index df86452b0..24206aa57 100644 --- a/tests/unit/out/refcount/push_emplace_back.rs +++ b/tests/unit/out/refcount/push_emplace_back.rs @@ -33,6 +33,7 @@ pub struct JPEGData { pub app_data: Vec>, } impl JPEGData { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { com_data: field!(_a0, com_data).with_mut(std::mem::take), @@ -125,18 +126,21 @@ pub struct Pair { pub second: i32, } impl Pair { + #[inline] pub fn new_2() -> Self { Self { first: -1_i32, second: -1_i32, } } + #[inline] pub fn new_1(mut a: i32) -> Self { Self { first: a, second: 0, } } + #[inline] pub fn new_3(mut a: i32, mut b: i32) -> Self { Self { first: a, @@ -295,6 +299,7 @@ pub trait JPEGDataImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl JPEGDataImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), com_data) .as_pointer() diff --git a/tests/unit/out/refcount/random.rs b/tests/unit/out/refcount/random.rs index a1249740f..ff8229ee4 100644 --- a/tests/unit/out/refcount/random.rs +++ b/tests/unit/out/refcount/random.rs @@ -239,6 +239,7 @@ pub trait PairImpl { fn as_ptr(&self) -> Ptr; } impl PairImpl for Ptr { + #[inline] fn method(&self) { field!((*self), x).with_mut(|__v| __v.postfix_inc()); field!((*self), y).with_mut(|__v| __v.prefix_inc()); @@ -248,12 +249,15 @@ impl PairImpl for Ptr { field!((*self), pair).write(Ptr::::null()); array_elem!((*self), ap, 0).write(Ptr::::null()); } + #[inline] fn as_val(&self) -> i32 { return (*self).with(|__s| __s.x); } + #[inline] fn as_ref(&self) -> Ptr { return field_ptr!((*self), x); } + #[inline] fn as_ptr(&self) -> Ptr { return (field_ptr!((*self), x)); } diff --git a/tests/unit/out/refcount/rule_of_five.rs b/tests/unit/out/refcount/rule_of_five.rs index 4757b13d4..f58f2c7d3 100644 --- a/tests/unit/out/refcount/rule_of_five.rs +++ b/tests/unit/out/refcount/rule_of_five.rs @@ -28,6 +28,7 @@ pub struct Buffer { pub size: i32, } impl Buffer { + #[inline] pub fn new(mut size: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: (0..4).map(|_| 0_i32).collect::>(), @@ -42,6 +43,7 @@ impl Buffer { (*alive_0.with(Value::clone).borrow_mut()).prefix_inc(); Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: (0..4).map(|_| 0_i32).collect::>(), @@ -57,6 +59,7 @@ impl Buffer { (*copies_1.with(Value::clone).borrow_mut()).prefix_inc(); Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: (0..4).map(|_| 0_i32).collect::>(), @@ -164,9 +167,11 @@ pub trait BufferImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl BufferImpl for Ptr { + #[inline] fn destructor(&self) { (*alive_0.with(Value::clone).borrow_mut()).prefix_dec(); } + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { if ((*self) == (o)) { return (*self).clone(); @@ -180,6 +185,7 @@ impl BufferImpl for Ptr { (*copies_1.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { if ((*self) == (o)) { return (*self).clone(); diff --git a/tests/unit/out/refcount/rule_of_three.rs b/tests/unit/out/refcount/rule_of_three.rs index e11b2c905..5ae960dce 100644 --- a/tests/unit/out/refcount/rule_of_three.rs +++ b/tests/unit/out/refcount/rule_of_three.rs @@ -23,6 +23,7 @@ pub struct Buffer { pub size: i32, } impl Buffer { + #[inline] pub fn new(mut size: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: (0..4).map(|_| 0_i32).collect::>(), @@ -37,6 +38,7 @@ impl Buffer { (*alive_0.with(Value::clone).borrow_mut()).prefix_inc(); Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { data: (0..4).map(|_| 0_i32).collect::>(), @@ -135,9 +137,11 @@ pub trait BufferImpl { fn copy_assign(&self, o: Ptr) -> Ptr; } impl BufferImpl for Ptr { + #[inline] fn destructor(&self) { (*alive_0.with(Value::clone).borrow_mut()).prefix_dec(); } + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { if ((*self) == (o)) { return (*self).clone(); diff --git a/tests/unit/out/refcount/rvalue_rule_arg_move.rs b/tests/unit/out/refcount/rvalue_rule_arg_move.rs index 03c54d12f..6bd9531ad 100644 --- a/tests/unit/out/refcount/rvalue_rule_arg_move.rs +++ b/tests/unit/out/refcount/rvalue_rule_arg_move.rs @@ -20,9 +20,11 @@ pub struct Elem { pub v: i32, } impl Elem { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Elem = Self { v: o.with(|__s| __s.v), @@ -30,6 +32,7 @@ impl Elem { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Elem = Self { v: o.with(|__s| __s.v), @@ -87,6 +90,7 @@ pub trait ElemImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl ElemImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), v).write({ _a0.with(|__s| __s.v) }); return (*self).clone(); diff --git a/tests/unit/out/refcount/rvalue_struct.rs b/tests/unit/out/refcount/rvalue_struct.rs index d84622f7b..2f9d3903f 100644 --- a/tests/unit/out/refcount/rvalue_struct.rs +++ b/tests/unit/out/refcount/rvalue_struct.rs @@ -15,6 +15,7 @@ pub struct S { pub b: i32, } impl S { + #[inline] pub fn new(mut a: i32, mut b: i32) -> Self { Self { a: a, b: b } } diff --git a/tests/unit/out/refcount/size_t_template_param.rs b/tests/unit/out/refcount/size_t_template_param.rs index c16e334a4..5b0f672be 100644 --- a/tests/unit/out/refcount/size_t_template_param.rs +++ b/tests/unit/out/refcount/size_t_template_param.rs @@ -18,6 +18,7 @@ pub struct PtrCtor_unsigned_long_ { pub v: u64, } impl PtrCtor_unsigned_long_ { + #[inline] pub fn new(mut p: Ptr) -> Self { Self { v: (elem!(p, 1).read()), @@ -32,6 +33,7 @@ pub struct RefCtor_unsigned_long_ { pub v: u64, } impl RefCtor_unsigned_long_ { + #[inline] pub fn new(x: Ptr) -> Self { Self { v: (x.read()).wrapping_add(1_u64), diff --git a/tests/unit/out/refcount/sort_no_copy.rs b/tests/unit/out/refcount/sort_no_copy.rs index 0080ee811..5a121cbbf 100644 --- a/tests/unit/out/refcount/sort_no_copy.rs +++ b/tests/unit/out/refcount/sort_no_copy.rs @@ -17,12 +17,15 @@ pub struct Tracked { pub v: i32, } impl Tracked { + #[inline] pub fn new_2() -> Self { Self { v: 0 } } + #[inline] pub fn new_1(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), @@ -30,6 +33,7 @@ impl Tracked { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -72,6 +76,7 @@ pub struct Bag { pub items: Vec, } impl Bag { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { items: field!(_a0, items).with_mut(std::mem::take), @@ -411,6 +416,7 @@ pub trait BagImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl BagImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), items) .as_pointer() @@ -423,11 +429,13 @@ pub trait TrackedImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl TrackedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); return (*self).clone(); diff --git a/tests/unit/out/refcount/static_local.rs b/tests/unit/out/refcount/static_local.rs index f02237312..35afe92a3 100644 --- a/tests/unit/out/refcount/static_local.rs +++ b/tests/unit/out/refcount/static_local.rs @@ -50,6 +50,7 @@ pub trait S_8Impl { fn get(&self) -> i32; } impl S_8Impl for Ptr { + #[inline] fn get(&self) -> i32 { return (*x_7.with(Value::clone).borrow_mut()).prefix_inc(); } diff --git a/tests/unit/out/refcount/static_var_in_class.rs b/tests/unit/out/refcount/static_var_in_class.rs index 297de7059..7ed71fb69 100644 --- a/tests/unit/out/refcount/static_var_in_class.rs +++ b/tests/unit/out/refcount/static_var_in_class.rs @@ -21,6 +21,7 @@ pub const anon_3_kValue: anon_3 = 3; #[byte_size(1)] pub struct S {} impl S { + #[inline] pub fn f() -> i32 { return counter_2.with(|rc| *rc.borrow()); } @@ -55,6 +56,7 @@ pub trait CImpl { fn get(&self) -> i32; } impl CImpl for Ptr { + #[inline] fn get(&self) -> i32 { return inner_const_0.with(|rc| *rc.borrow()); } diff --git a/tests/unit/out/refcount/stdcopy.rs b/tests/unit/out/refcount/stdcopy.rs index 9d5a18afb..235eeaeb0 100644 --- a/tests/unit/out/refcount/stdcopy.rs +++ b/tests/unit/out/refcount/stdcopy.rs @@ -14,6 +14,7 @@ pub struct Degrees { pub value: i32, } impl Degrees { + #[inline] pub fn new(mut v: i32) -> Self { Self { value: v } } diff --git a/tests/unit/out/refcount/struct_ctor.rs b/tests/unit/out/refcount/struct_ctor.rs index a7527c667..27253a5c6 100644 --- a/tests/unit/out/refcount/struct_ctor.rs +++ b/tests/unit/out/refcount/struct_ctor.rs @@ -15,6 +15,7 @@ pub struct StructWithCtor { x2_: i32, } impl StructWithCtor { + #[inline] pub fn new(mut x1: i32, mut x2: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { x1_: x1, x2_: x2 })); let this: Ptr = __this.as_pointer(); @@ -34,6 +35,7 @@ pub struct Value_ { pub v: i32, } impl Value_ { + #[inline] pub fn new(mut u: i32) -> Self { Self { v: u } } @@ -49,6 +51,7 @@ pub struct Ptr_ { pub v2: Value_, } impl Ptr_ { + #[inline] pub fn new() -> Self { Self { v1: Value_::new({ 11 }), @@ -84,9 +87,11 @@ pub trait StructWithCtorImpl { fn x2(&self) -> Ptr; } impl StructWithCtorImpl for Ptr { + #[inline] fn x1(&self) -> Ptr { return field_ptr!((*self), x1_); } + #[inline] fn x2(&self) -> Ptr { return field_ptr!((*self), x2_); } diff --git a/tests/unit/out/refcount/struct_default_ctor.rs b/tests/unit/out/refcount/struct_default_ctor.rs index d36612ba6..87eeb7ad0 100644 --- a/tests/unit/out/refcount/struct_default_ctor.rs +++ b/tests/unit/out/refcount/struct_default_ctor.rs @@ -15,6 +15,7 @@ pub struct S { pub b: bool, } impl S { + #[inline] pub fn new() -> Self { Self { a: 11, b: true } } diff --git a/tests/unit/out/refcount/structured_binding_copy_ctor.rs b/tests/unit/out/refcount/structured_binding_copy_ctor.rs index 37cf08250..35a8f6e59 100644 --- a/tests/unit/out/refcount/structured_binding_copy_ctor.rs +++ b/tests/unit/out/refcount/structured_binding_copy_ctor.rs @@ -18,9 +18,11 @@ pub struct Counted { pub y: i32, } impl Counted { + #[inline] pub fn new(mut x: i32, mut y: i32) -> Self { Self { x: x, y: y } } + #[inline] pub fn copy_from(other: Ptr) -> Self { let __this: Counted = Self { x: (other.with(|__s| __s.x) * 2), @@ -69,6 +71,7 @@ pub trait CountedImpl { fn copy_assign(&self, _a0: Ptr) -> Ptr; } impl CountedImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { field!((*self), x).write({ _a0.with(|__s| __s.x) }); field!((*self), y).write({ _a0.with(|__s| __s.y) }); diff --git a/tests/unit/out/refcount/structured_binding_element_ctor.rs b/tests/unit/out/refcount/structured_binding_element_ctor.rs index 12b315c40..f247e33b4 100644 --- a/tests/unit/out/refcount/structured_binding_element_ctor.rs +++ b/tests/unit/out/refcount/structured_binding_element_ctor.rs @@ -20,9 +20,11 @@ pub struct Elem { pub v: i32, } impl Elem { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(other: Ptr) -> Self { let __this: Elem = Self { v: (other.with(|__s| __s.v) + 100), @@ -30,6 +32,7 @@ impl Elem { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(other: Ptr) -> Self { let __this: Elem = Self { v: (other.with(|__s| __s.v) + 1000), @@ -56,6 +59,7 @@ pub struct Two { pub b: Elem, } impl Two { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { a: Elem::move_from({ field_ptr!(_a0, a) }), diff --git a/tests/unit/out/refcount/structured_binding_move_ctor.rs b/tests/unit/out/refcount/structured_binding_move_ctor.rs index 3e000b0c4..511f03e6e 100644 --- a/tests/unit/out/refcount/structured_binding_move_ctor.rs +++ b/tests/unit/out/refcount/structured_binding_move_ctor.rs @@ -21,9 +21,11 @@ pub struct Movable { pub y: i32, } impl Movable { + #[inline] pub fn new(mut x: i32, mut y: i32) -> Self { Self { x: x, y: y } } + #[inline] pub fn copy_from(other: Ptr) -> Self { let __this: Movable = Self { x: other.with(|__s| __s.x), @@ -32,6 +34,7 @@ impl Movable { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(other: Ptr) -> Self { let __this: Movable = Self { x: other.with(|__s| __s.x), @@ -63,6 +66,7 @@ pub struct Holder { pub ys: Vec, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { xs: field!(_a0, xs).with_mut(std::mem::take), @@ -102,12 +106,14 @@ pub trait HolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn extract(&self) -> Holder { return Holder { xs: field!((*self), xs).with_mut(std::mem::take), ys: field!((*self), ys).with_mut(std::mem::take), }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), xs) .as_pointer() diff --git a/tests/unit/out/refcount/swap_map_no_copy.rs b/tests/unit/out/refcount/swap_map_no_copy.rs index c0475c16f..1aa1fc1e7 100644 --- a/tests/unit/out/refcount/swap_map_no_copy.rs +++ b/tests/unit/out/refcount/swap_map_no_copy.rs @@ -17,12 +17,15 @@ pub struct Tracked { pub v: i32, } impl Tracked { + #[inline] pub fn new_2() -> Self { Self { v: 0 } } + #[inline] pub fn new_1(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Tracked = Self { v: o.with(|__s| __s.v), @@ -30,6 +33,7 @@ impl Tracked { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { Self { v: o.with(|__s| __s.v), @@ -58,6 +62,7 @@ pub struct Pair { pub y: Tracked, } impl Pair { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { x: Tracked::move_from({ field_ptr!(_a0, x) }), @@ -76,6 +81,7 @@ pub struct Arrays { pub b: Box<[Tracked]>, } impl Arrays { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { a: Box::new(std::array::from_fn::<_, 2, _>(|__i: usize| { @@ -115,9 +121,11 @@ pub struct CopyOnly { pub v: i32, } impl CopyOnly { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: CopyOnly = Self { v: o.with(|__s| __s.v), @@ -170,9 +178,11 @@ pub struct Moved { pub v: i32, } impl Moved { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } + #[inline] pub fn copy_from(o: Ptr) -> Self { let __this: Moved = Self { v: o.with(|__s| __s.v), @@ -180,6 +190,7 @@ impl Moved { (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); __this } + #[inline] pub fn move_from(o: Ptr) -> Self { let __this: Moved = Self { v: o.with(|__s| __s.v), @@ -208,6 +219,7 @@ pub struct MovedPair { pub y: Moved, } impl MovedPair { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { x: Moved::move_from({ field_ptr!(_a0, x) }), @@ -240,6 +252,7 @@ pub struct Owner { pub p: Option>, } impl Owner { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { p: field!(_a0, p).with_mut(|__v: &mut Option>| __v.take()), @@ -627,6 +640,7 @@ pub trait ArraysImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl ArraysImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { let mut __i0: usize = 0_usize; 'loop_: while (__i0 != 2_usize) { @@ -654,6 +668,7 @@ impl ArraysImpl for Ptr { } return (*self).clone(); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { let mut __i0: usize = 0_usize; 'loop_: while (__i0 != 2_usize) { @@ -687,9 +702,11 @@ pub trait CopyOnlyImpl { fn copy_assign(&self, o: Ptr) -> Ptr; } impl CopyOnlyImpl for Ptr { + #[inline] fn destructor(&self) { (*copy_only_dtors_2.with(Value::clone).borrow_mut()).prefix_inc(); } + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); (*copy_only_copies_1.with(Value::clone).borrow_mut()).prefix_inc(); @@ -701,6 +718,7 @@ pub trait CopyOnlyPairImpl { fn destructor(&self); } impl CopyOnlyPairImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, x); @@ -723,17 +741,20 @@ pub trait MovedImpl { fn destructor(&self); } impl MovedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); field!(o, v).write(-1_i32); (*move_assigns_4.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn destructor(&self) { (*moved_dtors_5.with(Value::clone).borrow_mut()).prefix_inc(); } @@ -744,6 +765,7 @@ pub trait MovedPairImpl { fn destructor(&self); } impl MovedPairImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, x); @@ -755,6 +777,7 @@ impl MovedPairImpl for Ptr { }); return (*self).clone(); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, x); @@ -775,6 +798,7 @@ pub trait OwnerImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl OwnerImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), p) .write(field!(_a0, p).with_mut(|__v: &mut Option>| __v.take())); @@ -786,6 +810,7 @@ pub trait PairImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl PairImpl for Ptr { + #[inline] fn copy_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, x); @@ -797,6 +822,7 @@ impl PairImpl for Ptr { }); return (*self).clone(); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { ({ let _o: Ptr = field_ptr!(_a0, x); @@ -814,11 +840,13 @@ pub trait TrackedImpl { fn move_assign(&self, o: Ptr) -> Ptr; } impl TrackedImpl for Ptr { + #[inline] fn copy_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); (*copies_0.with(Value::clone).borrow_mut()).prefix_inc(); return (*self).clone(); } + #[inline] fn move_assign(&self, o: Ptr) -> Ptr { field!((*self), v).write({ o.with(|__s| __s.v) }); return (*self).clone(); diff --git a/tests/unit/out/refcount/template_default_arg.rs b/tests/unit/out/refcount/template_default_arg.rs index 239584b9e..683569e9c 100644 --- a/tests/unit/out/refcount/template_default_arg.rs +++ b/tests/unit/out/refcount/template_default_arg.rs @@ -14,9 +14,11 @@ pub struct A { pub v: i32, } impl A { + #[inline] pub fn new_2() -> Self { Self { v: 1 } } + #[inline] pub fn new_1(mut v: i32) -> Self { Self { v: v } } @@ -33,6 +35,7 @@ pub struct B { pub v: i32, } impl B { + #[inline] pub fn new() -> Self { Self { v: 2 } } @@ -50,6 +53,7 @@ pub struct NoDefault { pub v: i32, } impl NoDefault { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } @@ -77,6 +81,7 @@ pub struct S_NoDefault_ { pub v: i32, } impl S_NoDefault_ { + #[inline] pub fn new(mut v: i32) -> Self { Self { v: v } } @@ -100,6 +105,7 @@ pub trait S_NoDefault_Impl { fn get(&self, t: NoDefault) -> i32; } impl S_NoDefault_Impl for Ptr { + #[inline] fn get(&self, mut t: NoDefault) -> i32 { return ((*self).with(|__s| __s.v) + t.v); } diff --git a/tests/unit/out/refcount/this.rs b/tests/unit/out/refcount/this.rs index 2bcd4ed71..3490bb355 100644 --- a/tests/unit/out/refcount/this.rs +++ b/tests/unit/out/refcount/this.rs @@ -17,12 +17,14 @@ pub struct S { pub self__: Ptr, } impl S { + #[inline] pub fn new_1(mut a: i32) -> Self { Self { a_: a, self__: Ptr::::null(), } } + #[inline] pub fn new_2(mut a: i32, mut other: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { a_: a, @@ -36,6 +38,7 @@ impl S { } Rc::try_unwrap(__this).ok().unwrap().into_inner() } + #[inline] pub fn new_3(mut a: i32, mut other: Ptr) -> Self { let __this: Value = Rc::new(RefCell::new(Self { a_: a, @@ -59,6 +62,7 @@ pub struct D { pub a_: i32, } impl D { + #[inline] pub fn new(mut a: i32) -> Self { let __this: Value = Rc::new(RefCell::new(Self { a_: a })); let this: Ptr = __this.as_pointer(); @@ -160,43 +164,56 @@ pub trait SImpl { fn copy_if_different(&self, other: Ptr) -> bool; } impl SImpl for Ptr { + #[inline] fn returns_this_reference(&self) -> Ptr { return (*self).clone(); } + #[inline] fn returns_this_pointer(&self) -> Ptr { return (*self).clone(); } + #[inline] fn inc(&self) -> Ptr { field!((*self), a_).with_mut(|__v| __v.postfix_inc()); return (*self).clone(); } + #[inline] fn set_from_this(&self) { field!((*self), a_).write({ ((*self).with(|__s| __s.a_) + 1) }); } + #[inline] fn get(&self) -> i32 { return (*self).with(|__s| __s.a_); } + #[inline] fn twice(&self) -> i32 { return (({ SImpl::get(self) }) * 2); } + #[inline] fn link(&self) { field!((*self), self__).write((*self).clone()); } + #[inline] fn bump_me(&self) { ({ bump_0((*self).clone()) }); } + #[inline] fn cref(&self) -> Ptr { return (*self).clone(); } + #[inline] fn is(&self, mut o: Ptr) -> bool { return (o == (*self)); } + #[inline] fn destroy(&self) { (*self).delete(); } + #[inline] fn reset(&self) { (*self).write(S::new_1({ 0 })); } + #[inline] fn copy_if_different_const(&self, mut other: Ptr) -> bool { if ((*self) == other) { return false; @@ -205,6 +222,7 @@ impl SImpl for Ptr { field!((*self), self__).write({ other.with(|__s| __s.self__.clone()) }); return true; } + #[inline] fn copy_if_different(&self, mut other: Ptr) -> bool { if ((*self) == other) { return false; diff --git a/tests/unit/out/refcount/typedef-anon-struct.rs b/tests/unit/out/refcount/typedef-anon-struct.rs index 9f15e0569..27dff14ae 100644 --- a/tests/unit/out/refcount/typedef-anon-struct.rs +++ b/tests/unit/out/refcount/typedef-anon-struct.rs @@ -22,6 +22,7 @@ pub struct Outer { pub runs: Vec, } impl Outer { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { runs: field!(_a0, runs).with_mut(std::mem::take), @@ -50,6 +51,7 @@ pub trait OuterImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl OuterImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), runs) .as_pointer() diff --git a/tests/unit/out/refcount/unboxed_locals.rs b/tests/unit/out/refcount/unboxed_locals.rs index 4c43ba355..bbcbd23c8 100644 --- a/tests/unit/out/refcount/unboxed_locals.rs +++ b/tests/unit/out/refcount/unboxed_locals.rs @@ -165,6 +165,7 @@ fn main_0() -> i32 { return 0; } impl Shape for Square { + #[inline] fn scale(&mut self, mut factor: i32) -> i32 { return (factor * { self.side }); } diff --git a/tests/unit/out/refcount/unboxed_records.rs b/tests/unit/out/refcount/unboxed_records.rs index f3c5a7425..7e3e2b9a0 100644 --- a/tests/unit/out/refcount/unboxed_records.rs +++ b/tests/unit/out/refcount/unboxed_records.rs @@ -124,6 +124,7 @@ pub trait CounterImpl { fn inc(&self); } impl CounterImpl for Ptr { + #[inline] fn inc(&self) { field!((*self), n).with_mut(|__v| __v.prefix_inc()); } diff --git a/tests/unit/out/refcount/unique_ptr.rs b/tests/unit/out/refcount/unique_ptr.rs index 7f01e7612..6ac077052 100644 --- a/tests/unit/out/refcount/unique_ptr.rs +++ b/tests/unit/out/refcount/unique_ptr.rs @@ -14,6 +14,7 @@ pub struct SafePointer { pub ptr: Option>, } impl SafePointer { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { ptr: field!(_a0, ptr).with_mut(|__v: &mut Option>| __v.take()), @@ -243,12 +244,14 @@ pub trait SafePointerImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl SafePointerImpl for Ptr { + #[inline] fn inc(&self) { (*self) .with(|__s| __s.ptr.clone()) .as_pointer() .with_mut(|__v| __v.prefix_inc()); } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), ptr) .write(field!(_a0, ptr).with_mut(|__v: &mut Option>| __v.take())); diff --git a/tests/unit/out/refcount/unique_ptr_const_deref.rs b/tests/unit/out/refcount/unique_ptr_const_deref.rs index 2b200c118..0df743e63 100644 --- a/tests/unit/out/refcount/unique_ptr_const_deref.rs +++ b/tests/unit/out/refcount/unique_ptr_const_deref.rs @@ -14,6 +14,7 @@ pub struct Holder { pub val: Option>, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { val: field!(_a0, val).with_mut(|__v: &mut Option>| __v.take()), @@ -41,6 +42,7 @@ pub trait HolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), val) .write(field!(_a0, val).with_mut(|__v: &mut Option>| __v.take())); diff --git a/tests/unit/out/refcount/unique_ptr_field_reset.rs b/tests/unit/out/refcount/unique_ptr_field_reset.rs index 38dc658a2..cb5c145aa 100644 --- a/tests/unit/out/refcount/unique_ptr_field_reset.rs +++ b/tests/unit/out/refcount/unique_ptr_field_reset.rs @@ -22,6 +22,7 @@ pub struct Holder { pub n: i32, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(|__v: &mut Option>| __v.take()), @@ -71,12 +72,14 @@ pub trait HolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn set(&self, mut p: Ptr) { { let _p: Ptr<_> = (p).clone(); field_ptr!((*self), data).write(_p.to_owned_opt()) }; } + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), data) .write(field!(_a0, data).with_mut(|__v: &mut Option>| __v.take())); diff --git a/tests/unit/out/refcount/unique_ptr_nested.rs b/tests/unit/out/refcount/unique_ptr_nested.rs index 0d1d975a7..05addf1f9 100644 --- a/tests/unit/out/refcount/unique_ptr_nested.rs +++ b/tests/unit/out/refcount/unique_ptr_nested.rs @@ -22,6 +22,7 @@ pub struct Outer { pub inner: Option>, } impl Outer { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { inner: field!(_a0, inner).with_mut(|__v: &mut Option>| __v.take()), @@ -60,6 +61,7 @@ pub trait OuterImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl OuterImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), inner) .write(field!(_a0, inner).with_mut(|__v: &mut Option>| __v.take())); diff --git a/tests/unit/out/refcount/va_list_field.rs b/tests/unit/out/refcount/va_list_field.rs index c4d5f74f7..93b390d6b 100644 --- a/tests/unit/out/refcount/va_list_field.rs +++ b/tests/unit/out/refcount/va_list_field.rs @@ -32,6 +32,7 @@ pub struct Guard_1 { pub active: bool, } impl Guard_1 { + #[inline] pub fn new(val: Ptr>) -> Self { Self { ap: (val).clone(), @@ -75,6 +76,7 @@ pub trait Guard_1Impl { fn destructor(&self); } impl Guard_1Impl for Ptr { + #[inline] fn destructor(&self) { if (*self).with(|__s| __s.active) {} } diff --git a/tests/unit/out/refcount/vector_iter_range_ctor.rs b/tests/unit/out/refcount/vector_iter_range_ctor.rs index d5ee3ba59..77589483a 100644 --- a/tests/unit/out/refcount/vector_iter_range_ctor.rs +++ b/tests/unit/out/refcount/vector_iter_range_ctor.rs @@ -14,6 +14,7 @@ pub struct Degrees { pub value: i32, } impl Degrees { + #[inline] pub fn new(mut v: i32) -> Self { Self { value: v } } @@ -232,6 +233,7 @@ pub trait ReadingImpl { fn to_i64(&self) -> i64; } impl ReadingImpl for Ptr { + #[inline] fn to_i64(&self) -> i64 { return (((*self).with(|__s| __s.raw_) as i64) * 10_i64); } diff --git a/tests/unit/out/refcount/vector_subscript_direct.rs b/tests/unit/out/refcount/vector_subscript_direct.rs index ecce8b7d1..746c9d556 100644 --- a/tests/unit/out/refcount/vector_subscript_direct.rs +++ b/tests/unit/out/refcount/vector_subscript_direct.rs @@ -25,6 +25,7 @@ pub struct Holder { pub points: Vec, } impl Holder { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { values: field!(_a0, values).with_mut(std::mem::take), @@ -146,6 +147,7 @@ pub trait HolderImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl HolderImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), values) .as_pointer() @@ -160,6 +162,7 @@ pub trait PointImpl { fn sum(&self) -> i32; } impl PointImpl for Ptr { + #[inline] fn sum(&self) -> i32 { return ((*self).with(|__s| __s.x) + (*self).with(|__s| __s.y)); } diff --git a/tests/unit/out/refcount/vector_with_allocator.rs b/tests/unit/out/refcount/vector_with_allocator.rs index 9f3f91356..995ceaf9b 100644 --- a/tests/unit/out/refcount/vector_with_allocator.rs +++ b/tests/unit/out/refcount/vector_with_allocator.rs @@ -319,9 +319,11 @@ pub trait TestAllocator_double_Impl { fn deallocate(&self, p: Ptr, _a1: usize); } impl TestAllocator_double_Impl for Ptr { + #[inline] fn allocate(&self, mut n: usize) -> Ptr { return Ptr::alloc_array((0..n).map(|_| 0_f64).collect::>()); } + #[inline] fn deallocate(&self, mut p: Ptr, mut _a1: usize) { p.delete(); } @@ -331,9 +333,11 @@ pub trait TestAllocator_int_Impl { fn deallocate(&self, p: Ptr, _a1: usize); } impl TestAllocator_int_Impl for Ptr { + #[inline] fn allocate(&self, mut n: usize) -> Ptr { return Ptr::alloc_array((0..n).map(|_| 0_i32).collect::>()); } + #[inline] fn deallocate(&self, mut p: Ptr, mut _a1: usize) { p.delete(); } diff --git a/tests/unit/out/refcount/void_cast.rs b/tests/unit/out/refcount/void_cast.rs index ddb7dd089..45b32143a 100644 --- a/tests/unit/out/refcount/void_cast.rs +++ b/tests/unit/out/refcount/void_cast.rs @@ -17,6 +17,7 @@ pub struct NonTrivial { pub data: Vec, } impl NonTrivial { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { data: field!(_a0, data).with_mut(std::mem::take), @@ -50,6 +51,7 @@ pub struct NonCopyable { pub value: Option>, } impl NonCopyable { + #[inline] pub fn move_from(_a0: Ptr) -> Self { Self { value: field!(_a0, value).with_mut(|__v: &mut Option>| __v.take()), @@ -136,6 +138,7 @@ pub trait NonCopyableImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl NonCopyableImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ptr!((*self), value) .write(field!(_a0, value).with_mut(|__v: &mut Option>| __v.take())); @@ -146,6 +149,7 @@ pub trait NonTrivialImpl { fn move_assign(&self, _a0: Ptr) -> Ptr; } impl NonTrivialImpl for Ptr { + #[inline] fn move_assign(&self, _a0: Ptr) -> Ptr { field_ref!((*self), data) .as_pointer() diff --git a/tests/unit/out/refcount/wide_char.rs b/tests/unit/out/refcount/wide_char.rs index 74ac016d6..ab24e5c00 100644 --- a/tests/unit/out/refcount/wide_char.rs +++ b/tests/unit/out/refcount/wide_char.rs @@ -6,38 +6,48 @@ use std::io::prelude::*; use std::io::{Read, Seek, Write}; use std::os::fd::AsFd; use std::rc::{Rc, Weak}; +#[inline] pub fn get_0(s: Ptr) -> Ptr { let s: Value> = Rc::new(RefCell::new(s)); return (*s.borrow()).clone(); } +#[inline] pub fn get_1(s: Ptr) -> Ptr { let s: Value> = Rc::new(RefCell::new(s)); return (*s.borrow()).clone(); } +#[inline] pub fn get_2(s: Ptr) -> Ptr { let s: Value> = Rc::new(RefCell::new(s)); return (*s.borrow()).clone(); } +#[inline] pub fn get_3(s: Ptr) -> Ptr { let s: Value> = Rc::new(RefCell::new(s)); return (*s.borrow()).clone(); } +#[inline] pub fn get_4(s: Ptr) -> Ptr { let s: Value> = Rc::new(RefCell::new(s)); return (*s.borrow()).clone(); } +#[inline] pub fn second_5(s: Ptr) -> i8 { return (elem!((s), 1).read()); } +#[inline] pub fn second_6(s: Ptr) -> i32 { return (elem!((s), 1).read()); } +#[inline] pub fn second_7(s: Ptr) -> u8 { return (elem!((s), 1).read()); } +#[inline] pub fn second_8(s: Ptr) -> u16 { return (elem!((s), 1).read()); } +#[inline] pub fn second_9(s: Ptr) -> u32 { return (elem!((s), 1).read()); } diff --git a/tests/unit/out/unsafe/05_new.rs b/tests/unit/out/unsafe/05_new.rs index 5df21a1f4..cd234b1aa 100644 --- a/tests/unit/out/unsafe/05_new.rs +++ b/tests/unit/out/unsafe/05_new.rs @@ -13,6 +13,7 @@ pub struct A {} #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct D {} impl D { + #[inline] pub unsafe fn operator_call(&self, mut ptr: *const A) { { let __p = ptr; diff --git a/tests/unit/out/unsafe/10_struct.rs b/tests/unit/out/unsafe/10_struct.rs index 1d782298c..28e9b6165 100644 --- a/tests/unit/out/unsafe/10_struct.rs +++ b/tests/unit/out/unsafe/10_struct.rs @@ -19,6 +19,7 @@ pub struct Graph { pub adj: *mut *mut GraphNode, } impl Graph { + #[inline] pub unsafe fn push(&self, mut src: u32, mut dst: u32) { (*self.adj.offset((src) as isize)) = (Box::leak(Box::new(GraphNode { dst: dst, @@ -36,6 +37,7 @@ pub struct Partial { pub p: *mut i32, } impl Partial { + #[inline] pub unsafe fn new_1(mut q: *mut i32) -> Self { let mut this = Self { p: q }; this diff --git a/tests/unit/out/unsafe/any.rs b/tests/unit/out/unsafe/any.rs index abdb000c8..8daa548fd 100644 --- a/tests/unit/out/unsafe/any.rs +++ b/tests/unit/out/unsafe/any.rs @@ -13,6 +13,7 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub unsafe fn new(mut x: i32, mut y: i32) -> Self { let mut this = Self { x: x, y: y }; this diff --git a/tests/unit/out/unsafe/array_of_noncopy_struct.rs b/tests/unit/out/unsafe/array_of_noncopy_struct.rs index 9116e683c..80c1fab4d 100644 --- a/tests/unit/out/unsafe/array_of_noncopy_struct.rs +++ b/tests/unit/out/unsafe/array_of_noncopy_struct.rs @@ -13,6 +13,7 @@ pub struct NonCopy { pub tag: i32, } impl NonCopy { + #[inline] pub unsafe fn move_from(_a0: *mut NonCopy) -> Self { let mut this = Self { data: std::mem::take(&mut (*_a0).data), @@ -20,6 +21,7 @@ impl NonCopy { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut NonCopy) -> *mut NonCopy { self.data = std::mem::take(&mut (*_a0).data); self.tag = (*_a0).tag; diff --git a/tests/unit/out/unsafe/as_const.rs b/tests/unit/out/unsafe/as_const.rs index bd9a50173..a2858e0e2 100644 --- a/tests/unit/out/unsafe/as_const.rs +++ b/tests/unit/out/unsafe/as_const.rs @@ -15,15 +15,19 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn f_1(&mut self) -> Overload { return Overload_kMutableOverload; } + #[inline] pub unsafe fn f_2(&self) -> Overload { return Overload_kConstOverload; } + #[inline] pub unsafe fn value_ref_3(&mut self) -> *mut i32 { return &mut self.v; } + #[inline] pub unsafe fn value_ref_4(&self) -> *const i32 { return &self.v; } diff --git a/tests/unit/out/unsafe/class.rs b/tests/unit/out/unsafe/class.rs index 7e754eb5a..29872ab6a 100644 --- a/tests/unit/out/unsafe/class.rs +++ b/tests/unit/out/unsafe/class.rs @@ -13,19 +13,24 @@ pub struct Pair { pub second: i32, } impl Pair { + #[inline] pub unsafe fn NOP(&mut self) {} + #[inline] pub unsafe fn GetFirst(&self) -> i32 { return self.first; } + #[inline] pub unsafe fn GetSecond(&self) -> i32 { return self.second; } + #[inline] pub unsafe fn Set(&mut self, field: *mut i32, mut new_val: i32) -> i32 { (unsafe { Pair::NOP(self) }); let mut old_val: i32 = (*field); (*field) = new_val; return old_val; } + #[inline] pub unsafe fn SetFirst(&mut self, mut new_first: i32) -> i32 { return ((unsafe { Pair::GetFirst(self) }) + (unsafe { @@ -33,6 +38,7 @@ impl Pair { Pair::Set(self, _field, new_first) })); } + #[inline] pub unsafe fn SetSecond(&mut self, mut new_second: i32) -> i32 { return ((unsafe { Pair::GetSecond(self) }) + (unsafe { @@ -48,6 +54,7 @@ pub struct Route { pub cost: f64, } impl Route { + #[inline] pub unsafe fn SetCost(&mut self, mut new_cost: f64) -> f64 { let mut old_cost: f64 = self.cost; self.cost = new_cost; @@ -61,10 +68,12 @@ pub struct Counter { pub calls: i32, } impl Counter { + #[inline] pub unsafe fn Get(&self) -> i32 { (*(&raw const self.calls).cast_mut()).prefix_inc(); return self.v; } + #[inline] pub unsafe fn operator_eq(&self, o: *const Counter) -> bool { (*(&raw const self.calls).cast_mut()).prefix_inc(); return ((self.v) == ((*o).v)); @@ -82,10 +91,12 @@ pub struct Tally { pub calls: i32, } impl Tally { + #[inline] pub unsafe fn SameNameBetweenConstAndNonConst_1(&mut self) -> i32 { self.calls += 1; return 1; } + #[inline] pub unsafe fn SameNameBetweenConstAndNonConst_2(&self) -> i32 { (*(&raw const self.calls).cast_mut()) += 10; return 2; diff --git a/tests/unit/out/unsafe/class_template_lazy_member.rs b/tests/unit/out/unsafe/class_template_lazy_member.rs index 7a332b272..2a7a3347f 100644 --- a/tests/unit/out/unsafe/class_template_lazy_member.rs +++ b/tests/unit/out/unsafe/class_template_lazy_member.rs @@ -17,6 +17,7 @@ pub struct Box_int_ { pub val: i32, } impl Box_int_ { + #[inline] pub unsafe fn twice(&mut self) -> i32 { return ((self.val) + (self.val)); } @@ -27,6 +28,7 @@ pub struct Box_Point_ { pub val: Point, } impl Box_Point_ { + #[inline] pub unsafe fn get(&mut self) -> Point { return self.val; } @@ -37,6 +39,7 @@ pub struct Deduced_int_ { pub val: i32, } impl Deduced_int_ { + #[inline] pub unsafe fn twice(&mut self) -> i32 { return ((self.val) + (self.val)); } @@ -47,6 +50,7 @@ pub struct Deduced_Point_ { pub val: Point, } impl Deduced_Point_ { + #[inline] pub unsafe fn get(&mut self) -> Point { return self.val; } diff --git a/tests/unit/out/unsafe/class_templates.rs b/tests/unit/out/unsafe/class_templates.rs index 791305b1e..6cea48643 100644 --- a/tests/unit/out/unsafe/class_templates.rs +++ b/tests/unit/out/unsafe/class_templates.rs @@ -12,31 +12,38 @@ pub struct MyContainer_int_ { vec_: Vec, } impl MyContainer_int_ { + #[inline] pub unsafe fn empty(&self) -> bool { return self.vec_.is_empty(); } + #[inline] pub unsafe fn size(&self) -> usize { return self.vec_.len(); } + #[inline] pub unsafe fn back_4(&mut self) -> *mut i32 { return ((self.vec_).last_mut().unwrap()); } + #[inline] pub unsafe fn pop_back(&mut self) { self.vec_.pop(); return; } + #[inline] pub unsafe fn push_back(&mut self, item: *const i32) { { let a0_clone = (*item).clone(); self.vec_.push(a0_clone) }; } + #[inline] pub unsafe fn move_from(_a0: *mut MyContainer_int_) -> Self { let mut this = Self { vec_: std::mem::take(&mut (*_a0).vec_), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut MyContainer_int_) -> *mut MyContainer_int_ { self.vec_ = std::mem::take(&mut (*_a0).vec_); return &mut (*(self as *mut MyContainer_int_)); @@ -48,31 +55,38 @@ pub struct MyContainer_char_ { vec_: Vec, } impl MyContainer_char_ { + #[inline] pub unsafe fn empty(&self) -> bool { return self.vec_.is_empty(); } + #[inline] pub unsafe fn size(&self) -> usize { return self.vec_.len(); } + #[inline] pub unsafe fn back_4(&mut self) -> *mut libc::c_char { return ((self.vec_).last_mut().unwrap()); } + #[inline] pub unsafe fn pop_back(&mut self) { self.vec_.pop(); return; } + #[inline] pub unsafe fn push_back(&mut self, item: *const libc::c_char) { { let a0_clone = (*item).clone(); self.vec_.push(a0_clone) }; } + #[inline] pub unsafe fn move_from(_a0: *mut MyContainer_char_) -> Self { let mut this = Self { vec_: std::mem::take(&mut (*_a0).vec_), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut MyContainer_char_) -> *mut MyContainer_char_ { self.vec_ = std::mem::take(&mut (*_a0).vec_); return &mut (*(self as *mut MyContainer_char_)); @@ -84,31 +98,38 @@ pub struct MyContainer_float_ { vec_: Vec, } impl MyContainer_float_ { + #[inline] pub unsafe fn empty(&self) -> bool { return self.vec_.is_empty(); } + #[inline] pub unsafe fn size(&self) -> usize { return self.vec_.len(); } + #[inline] pub unsafe fn back_4(&mut self) -> *mut f32 { return ((self.vec_).last_mut().unwrap()); } + #[inline] pub unsafe fn pop_back(&mut self) { self.vec_.pop(); return; } + #[inline] pub unsafe fn push_back(&mut self, item: *const f32) { { let a0_clone = (*item).clone(); self.vec_.push(a0_clone) }; } + #[inline] pub unsafe fn move_from(_a0: *mut MyContainer_float_) -> Self { let mut this = Self { vec_: std::mem::take(&mut (*_a0).vec_), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut MyContainer_float_) -> *mut MyContainer_float_ { self.vec_ = std::mem::take(&mut (*_a0).vec_); return &mut (*(self as *mut MyContainer_float_)); @@ -160,6 +181,7 @@ pub struct Outer_int__Inner_int_ { pub u: i32, } impl Outer_int__Inner_int_ { + #[inline] pub unsafe fn sum(&self) -> i32 { return ((self.t as i32) + (self.u as i32)); } @@ -170,6 +192,7 @@ pub struct Outer_int_ { pub v: i32, } impl Outer_int_ { + #[inline] pub unsafe fn with(&self, mut n: i32) -> Outer_int__Inner_int_ { return Outer_int__Inner_int_ { t: self.v, u: n }; } @@ -181,6 +204,7 @@ pub struct Outer_long__Inner_int_ { pub u: i32, } impl Outer_long__Inner_int_ { + #[inline] pub unsafe fn sum(&self) -> i32 { return ((self.t as i32) + (self.u as i32)); } @@ -192,6 +216,7 @@ pub struct Outer_long__Inner_char_ { pub u: libc::c_char, } impl Outer_long__Inner_char_ { + #[inline] pub unsafe fn sum(&self) -> i32 { return ((self.t as i32) + (self.u as i32)); } @@ -202,6 +227,7 @@ pub struct Outer_long_ { pub v: i64, } impl Outer_long_ { + #[inline] pub unsafe fn with(&self, mut n: i32) -> Outer_long__Inner_int_ { return Outer_long__Inner_int_ { t: self.v, u: n }; } diff --git a/tests/unit/out/unsafe/complex_function.rs b/tests/unit/out/unsafe/complex_function.rs index d9481c572..dcc1fb9ad 100644 --- a/tests/unit/out/unsafe/complex_function.rs +++ b/tests/unit/out/unsafe/complex_function.rs @@ -26,6 +26,7 @@ pub struct X2 { pub v: *mut X1, } impl X2 { + #[inline] pub unsafe fn get(&mut self) -> *mut X1 { return self.v; } @@ -36,6 +37,7 @@ pub struct X3 { pub v: *mut X2, } impl X3 { + #[inline] pub unsafe fn get(&mut self) -> *mut X2 { return self.v; } @@ -46,6 +48,7 @@ pub struct X4 { pub v: X3, } impl X4 { + #[inline] pub unsafe fn get(&mut self) -> *mut X3 { return &mut self.v; } diff --git a/tests/unit/out/unsafe/concepts.rs b/tests/unit/out/unsafe/concepts.rs index 7481c2060..6e6c3b83e 100644 --- a/tests/unit/out/unsafe/concepts.rs +++ b/tests/unit/out/unsafe/concepts.rs @@ -15,6 +15,7 @@ const _: () = assert!( #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Sized {} impl Sized { + #[inline] pub unsafe fn size(&mut self) -> i32 { return 4; } diff --git a/tests/unit/out/unsafe/constexpr_function.rs b/tests/unit/out/unsafe/constexpr_function.rs index e6c6abdcf..acc49c6cd 100644 --- a/tests/unit/out/unsafe/constexpr_function.rs +++ b/tests/unit/out/unsafe/constexpr_function.rs @@ -9,15 +9,18 @@ use std::rc::Rc; pub unsafe fn runtime_only_0(mut x: i32) -> i32 { return ((x) * (2)); } +#[inline] pub unsafe fn first_1(mut p: *const i32) -> i32 { return (*p); } +#[inline] pub unsafe fn scaled_2(mut x: i32) -> i32 { if ((x) < (0)) { return (unsafe { runtime_only_0(-x) }); } return x; } +#[inline] pub unsafe fn half_3(mut x: f64) -> f64 { return ((x) / (2_f64)); } @@ -27,18 +30,22 @@ pub struct Flag { pub v: i32, } impl Flag { + #[inline] pub unsafe fn to_bool(&self) -> bool { return ((self.v) != (0)); } } +#[inline] pub unsafe fn use_4(mut f: Flag) -> i32 { assert!((unsafe { Flag::to_bool(&f,) })); return f.v; } +#[inline] pub unsafe fn checked_5(mut x: i32) -> i32 { assert!(((x) > (0))); return ((x) + (1)); } +#[inline] pub unsafe fn in_constant_context_6() -> bool { {} return ((unsafe { runtime_only_0(1) }) == (0)); @@ -50,6 +57,7 @@ pub struct P { pub v: i32, } impl P { + #[inline] pub unsafe fn get(&self) -> i32 { return self.v; } diff --git a/tests/unit/out/unsafe/constructor.rs b/tests/unit/out/unsafe/constructor.rs index 7ec124cf6..2a46321f5 100644 --- a/tests/unit/out/unsafe/constructor.rs +++ b/tests/unit/out/unsafe/constructor.rs @@ -14,12 +14,15 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn const_method(&self) -> i32 { return ((self.v) * (2)); } + #[inline] pub unsafe fn mut_method(&mut self) { self.v += 1; } + #[inline] pub unsafe fn new(mut init: i32) -> Self { let mut this = Self { v: init }; (unsafe { S::mut_method(&mut this) }); @@ -27,6 +30,7 @@ impl S { (unsafe { S::const_method(&mut this) }); this } + #[inline] pub unsafe fn destructor(&mut self) { (unsafe { S::mut_method(self) }); (*std::cell::LazyCell::force_mut(&mut *&raw mut total_0)) += @@ -41,15 +45,18 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub unsafe fn new_2(mut x: i32, mut y: i32) -> Self { let mut this = Self { x: x, y: y }; this } + #[inline] pub unsafe fn new_1(mut v: i32) -> Self { let mut this = Point::new_2({ v }, { ((v) + (1)) }); this.y *= 10; this } + #[inline] pub unsafe fn new_3() -> Self { let mut this = Point::new_1({ 4 }); this.x += 100; diff --git a/tests/unit/out/unsafe/container_element_receiver.rs b/tests/unit/out/unsafe/container_element_receiver.rs index aa7e2c05f..bf7f97caa 100644 --- a/tests/unit/out/unsafe/container_element_receiver.rs +++ b/tests/unit/out/unsafe/container_element_receiver.rs @@ -13,6 +13,7 @@ pub struct Holder { pub vec_: Vec, } impl Holder { + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { ref_: (*_a0).ref_, diff --git a/tests/unit/out/unsafe/container_field_addr.rs b/tests/unit/out/unsafe/container_field_addr.rs index 238a1e211..db54aed46 100644 --- a/tests/unit/out/unsafe/container_field_addr.rs +++ b/tests/unit/out/unsafe/container_field_addr.rs @@ -13,6 +13,7 @@ pub struct S { pub v: Vec, } impl S { + #[inline] pub unsafe fn move_from(_a0: *mut S) -> Self { let mut this = Self { tag: (*_a0).tag, @@ -20,6 +21,7 @@ impl S { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut S) -> *mut S { self.tag = (*_a0).tag; self.v = std::mem::take(&mut (*_a0).v); diff --git a/tests/unit/out/unsafe/conversion_operator_same_translation.rs b/tests/unit/out/unsafe/conversion_operator_same_translation.rs index a34276f7c..1554529d8 100644 --- a/tests/unit/out/unsafe/conversion_operator_same_translation.rs +++ b/tests/unit/out/unsafe/conversion_operator_same_translation.rs @@ -14,9 +14,11 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn to_libcc_char(&self) -> libc::c_char { return (self.v as libc::c_char); } + #[inline] pub unsafe fn to_u8(&self) -> u8 { return (((self.v) + (1)) as u8); } @@ -28,9 +30,11 @@ pub struct T { pub v: i32, } impl T { + #[inline] pub unsafe fn to_i64_1(&self) -> i64 { return (self.v as i64); } + #[inline] pub unsafe fn to_i64_2(&self) -> i64 { return (((self.v) + (1)) as i64); } diff --git a/tests/unit/out/unsafe/copy_assign.rs b/tests/unit/out/unsafe/copy_assign.rs index bfe7c75a8..4ef2449e9 100644 --- a/tests/unit/out/unsafe/copy_assign.rs +++ b/tests/unit/out/unsafe/copy_assign.rs @@ -14,10 +14,12 @@ pub struct Partial { pub keep: i32, } impl Partial { + #[inline] pub unsafe fn new(mut v: i32, mut keep: i32) -> Self { let mut this = Self { v: v, keep: keep }; this } + #[inline] pub unsafe fn copy_from(o: *const Partial) -> Self { let mut this = Self { v: (*o).v, @@ -25,6 +27,7 @@ impl Partial { }; this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Partial) -> *mut Partial { if (((self as *mut Partial).cast_const()) == (o)) { return &mut (*(self as *mut Partial)); @@ -45,14 +48,17 @@ pub struct NonConstAssign { pub mark: i32, } impl NonConstAssign { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { mark: 0 }; this } + #[inline] pub unsafe fn operator_assign_2(&mut self, o: *mut NonConstAssign) -> *mut NonConstAssign { self.mark = (((*o).mark) + (1)); return &mut (*(self as *mut NonConstAssign)); } + #[inline] pub unsafe fn operator_assign_3(&mut self, o: *const NonConstAssign) -> *mut NonConstAssign { self.mark = (((*o).mark) + (10)); return &mut (*(self as *mut NonConstAssign)); @@ -69,10 +75,12 @@ pub struct RefQualified { pub mark: i32, } impl RefQualified { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { mark: 0 }; this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const RefQualified) -> *mut RefQualified { self.mark = (((*o).mark) + (1)); return &mut (*(self as *mut RefQualified)); @@ -90,6 +98,7 @@ pub struct Holder { pub arr: [Partial; 2], } impl Holder { + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Holder) -> *mut Holder { (unsafe { let _o: *const Partial = &(*_a0).p; @@ -114,15 +123,18 @@ pub struct CopyCounted { pub v: i32, } impl CopyCounted { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const CopyCounted) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_1)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const CopyCounted) -> *mut CopyCounted { self.v = (*_a0).v; return &mut (*(self as *mut CopyCounted)); @@ -140,6 +152,7 @@ pub struct HasCopyCounted { pub arr: [CopyCounted; 2], } impl HasCopyCounted { + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const HasCopyCounted) -> *mut HasCopyCounted { (unsafe { let _arg0: *const CopyCounted = &(*_a0).c; diff --git a/tests/unit/out/unsafe/copy_ctor.rs b/tests/unit/out/unsafe/copy_ctor.rs index 8a2ab7292..c81e21e0a 100644 --- a/tests/unit/out/unsafe/copy_ctor.rs +++ b/tests/unit/out/unsafe/copy_ctor.rs @@ -14,15 +14,18 @@ pub struct Counted { pub v: i32, } impl Counted { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Counted) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Counted) -> *mut Counted { self.v = (*_a0).v; return &mut (*(self as *mut Counted)); @@ -39,22 +42,26 @@ pub struct NonConst { pub mark: i32, } impl NonConst { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { mark: 0 }; this } + #[inline] pub unsafe fn new_1(o: *mut NonConst) -> Self { let mut this = Self { mark: (((*o).mark) + (1)), }; this } + #[inline] pub unsafe fn new_2(o: *const NonConst) -> Self { let mut this = Self { mark: (((*o).mark) + (10)), }; this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const NonConst) -> *mut NonConst { self.mark = (*_a0).mark; return &mut (*(self as *mut NonConst)); @@ -77,15 +84,18 @@ pub struct Ignored { pub v: i32, } impl Ignored { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(_a0: *const Ignored) -> Self { let mut this = Self { v: -1_i32 }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Ignored) -> *mut Ignored { self.v = (*_a0).v; return &mut (*(self as *mut Ignored)); @@ -103,6 +113,7 @@ pub struct Holder { pub arr: [Counted; 2], } impl Holder { + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Holder) -> *mut Holder { (unsafe { let _arg0: *const Counted = &(*_a0).c; @@ -129,14 +140,17 @@ pub struct Box_int_ { pub val: i32, } impl Box_int_ { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { val: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Box_int_) -> Self { let mut this = Self { val: (*o).val }; this } + #[inline] pub unsafe fn move_from(_a0: *mut Box_int_) -> Self { let mut this = Self { val: (*_a0).val }; this @@ -153,6 +167,7 @@ pub struct Owner { pub box_: Box_int_, } impl Owner { + #[inline] pub unsafe fn move_from(_a0: *mut Owner) -> Self { let mut this = Self { box_: Box_int_::move_from({ &mut (*_a0).box_ }), @@ -167,6 +182,7 @@ pub struct OutOfLine { pub v: i32, } impl OutOfLine { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this @@ -178,6 +194,7 @@ impl OutOfLine { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const OutOfLine) -> *mut OutOfLine { self.v = (*_a0).v; return &mut (*(self as *mut OutOfLine)); @@ -195,11 +212,13 @@ pub struct Tracked { pub copied_from: i32, } impl Tracked { + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { copied_from: 0 }; (*(&raw const (*o).copied_from).cast_mut()).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Tracked) -> *mut Tracked { (*(&raw const (*o).copied_from).cast_mut()).prefix_inc(); return &mut (*(self as *mut Tracked)); diff --git a/tests/unit/out/unsafe/copy_move_defaulted.rs b/tests/unit/out/unsafe/copy_move_defaulted.rs index 3842b2c79..6b270f7d0 100644 --- a/tests/unit/out/unsafe/copy_move_defaulted.rs +++ b/tests/unit/out/unsafe/copy_move_defaulted.rs @@ -20,6 +20,7 @@ pub struct Explicit { pub arr: [i32; 2], } impl Explicit { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -28,6 +29,7 @@ impl Explicit { }; this } + #[inline] pub unsafe fn destructor(&mut self) {} } #[repr(C)] @@ -46,15 +48,18 @@ pub struct DefaultCopyUserMove { pub v: i32, } impl DefaultCopyUserMove { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn move_from(o: *mut DefaultCopyUserMove) -> Self { let mut this = Self { v: (*o).v }; (*o).v = 0; this } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut DefaultCopyUserMove) -> *mut DefaultCopyUserMove { self.v = (*o).v; (*o).v = 0; @@ -70,20 +75,24 @@ pub struct UserCopyDefaultMove { pub v: i32, } impl UserCopyDefaultMove { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const UserCopyDefaultMove) -> Self { let mut this = Self { v: (((*o).v) + (100)), }; this } + #[inline] pub unsafe fn move_from(_a0: *mut UserCopyDefaultMove) -> Self { let mut this = Self { v: (*_a0).v }; this } + #[inline] pub unsafe fn copy_assign( &mut self, o: *const UserCopyDefaultMove, @@ -91,6 +100,7 @@ impl UserCopyDefaultMove { self.v = (((*o).v) + (100)); return &mut (*(self as *mut UserCopyDefaultMove)); } + #[inline] pub unsafe fn move_assign( &mut self, _a0: *mut UserCopyDefaultMove, @@ -114,6 +124,7 @@ pub struct Buffer { pub arr: [i32; 2], } impl Buffer { + #[inline] pub unsafe fn new(mut n: i32) -> Self { let mut this = Self { data: vec![n; (n as usize) as usize], @@ -127,6 +138,7 @@ impl Buffer { }; this } + #[inline] pub unsafe fn move_from(_a0: *mut Buffer) -> Self { let mut this = Self { data: std::mem::take(&mut (*_a0).data), @@ -136,6 +148,7 @@ impl Buffer { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Buffer) -> *mut Buffer { self.data = std::mem::take(&mut (*_a0).data); self.rows = std::mem::take(&mut (*_a0).rows); @@ -163,6 +176,7 @@ pub struct Owner { pub p: Option>, } impl Owner { + #[inline] pub unsafe fn move_from(_a0: *mut Owner) -> Self { let mut this = Self { data: std::mem::take(&mut (*_a0).data), @@ -172,6 +186,7 @@ impl Owner { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Owner) -> *mut Owner { self.data = std::mem::take(&mut (*_a0).data); self.n = (*_a0).n; @@ -196,12 +211,14 @@ pub struct Copyable { pub data: Vec, } impl Copyable { + #[inline] pub unsafe fn move_from(_a0: *mut Copyable) -> Self { let mut this = Self { data: std::mem::take(&mut (*_a0).data), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Copyable) -> *mut Copyable { self.data = std::mem::take(&mut (*_a0).data); return &mut (*(self as *mut Copyable)); @@ -216,6 +233,7 @@ pub struct Holder { pub p: Option>, } impl Holder { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { inner: Inner { x: v }, @@ -224,6 +242,7 @@ impl Holder { }; this } + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { inner: (*_a0).inner, @@ -232,6 +251,7 @@ impl Holder { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.inner = (*_a0).inner; self.e = ((*_a0).e).clone(); diff --git a/tests/unit/out/unsafe/copy_move_deleted.rs b/tests/unit/out/unsafe/copy_move_deleted.rs index 025f47297..1b384d9f9 100644 --- a/tests/unit/out/unsafe/copy_move_deleted.rs +++ b/tests/unit/out/unsafe/copy_move_deleted.rs @@ -13,15 +13,18 @@ pub struct NoCopy { pub v: i32, } impl NoCopy { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn move_from(o: *mut NoCopy) -> Self { let mut this = Self { v: (*o).v }; (*o).v = 0; this } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut NoCopy) -> *mut NoCopy { self.v = (*o).v; (*o).v = 0; @@ -34,15 +37,18 @@ pub struct PrivateCopy { pub v: i32, } impl PrivateCopy { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { v: 0 }; this } + #[inline] pub unsafe fn move_from(o: *mut PrivateCopy) -> Self { let mut this = Self { v: (*o).v }; (*o).v = 0; this } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut PrivateCopy) -> *mut PrivateCopy { self.v = (*o).v; (*o).v = 0; @@ -60,6 +66,7 @@ pub struct Immovable { pub v: i32, } impl Immovable { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { v: 0 }; this @@ -77,6 +84,7 @@ pub struct Container { pub tag: i32, } impl Container { + #[inline] pub unsafe fn move_from(_a0: *mut Container) -> Self { let mut this = Self { inner: NoCopy::move_from({ &mut (*_a0).inner }), @@ -84,6 +92,7 @@ impl Container { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Container) -> *mut Container { (unsafe { let _o: *mut NoCopy = &mut (*_a0).inner; @@ -99,12 +108,14 @@ pub struct VecHolder { pub items: Vec, } impl VecHolder { + #[inline] pub unsafe fn move_from(_a0: *mut VecHolder) -> Self { let mut this = Self { items: std::mem::take(&mut (*_a0).items), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut VecHolder) -> *mut VecHolder { self.items = std::mem::take(&mut (*_a0).items); return &mut (*(self as *mut VecHolder)); diff --git a/tests/unit/out/unsafe/default_function_arguments.rs b/tests/unit/out/unsafe/default_function_arguments.rs index cbf7612ed..5ede6ad96 100644 --- a/tests/unit/out/unsafe/default_function_arguments.rs +++ b/tests/unit/out/unsafe/default_function_arguments.rs @@ -21,6 +21,7 @@ pub struct Bar { pub v: i32, } impl Bar { + #[inline] pub unsafe fn new(mut v: Option) -> Self { let mut v: i32 = v.unwrap_or_else(|| unsafe { 1 }); let mut this = Self { v: v }; @@ -67,6 +68,7 @@ pub struct Holder_int_ { pub v: i32, } impl Holder_int_ { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this diff --git a/tests/unit/out/unsafe/destructor.rs b/tests/unit/out/unsafe/destructor.rs index a6eb6b3c9..51acbef1e 100644 --- a/tests/unit/out/unsafe/destructor.rs +++ b/tests/unit/out/unsafe/destructor.rs @@ -11,6 +11,7 @@ pub static mut global_0: std::cell::LazyCell = std::cell::LazyCell::new(|| #[derive(Clone, VaArg, FnPtrArg, DestructorUnsafe, Default)] pub struct S {} impl S { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)).postfix_inc(); } @@ -63,6 +64,7 @@ pub struct EmptyBody { pub s: S, } impl EmptyBody { + #[inline] pub unsafe fn destructor(&mut self) { S::destructor(&mut self.s); } @@ -73,6 +75,7 @@ pub struct Templated_char_ { pub v: libc::c_char, } impl Templated_char_ { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)) = (((*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)) as usize) @@ -85,6 +88,7 @@ pub struct Templated_int_ { pub v: i32, } impl Templated_int_ { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)) = (((*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)) as usize) @@ -97,6 +101,7 @@ pub struct Copied { pub v: i32, } impl Copied { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut global_0)).postfix_inc(); } @@ -110,6 +115,7 @@ pub struct Tagged { pub tag: i32, } impl Tagged { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut order_1)) [((*std::cell::LazyCell::force_mut(&mut *&raw mut order_count_2)).postfix_inc()) diff --git a/tests/unit/out/unsafe/destructor_params.rs b/tests/unit/out/unsafe/destructor_params.rs index aaa25230c..81a3e3b0d 100644 --- a/tests/unit/out/unsafe/destructor_params.rs +++ b/tests/unit/out/unsafe/destructor_params.rs @@ -14,6 +14,7 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut destroyed_0)).postfix_inc(); (*std::cell::LazyCell::force_mut(&mut *&raw mut last_1)) = self.v; @@ -33,10 +34,12 @@ pub struct Holder { pub v: i32, } impl Holder { + #[inline] pub unsafe fn new(mut s: S) -> Self { let mut this = Self { v: s.v }; this } + #[inline] pub unsafe fn add(&self, mut s: S) -> i32 { return ((self.v) + (s.v)); } diff --git a/tests/unit/out/unsafe/destructor_temporaries.rs b/tests/unit/out/unsafe/destructor_temporaries.rs index cf72e57f4..1f21dc285 100644 --- a/tests/unit/out/unsafe/destructor_temporaries.rs +++ b/tests/unit/out/unsafe/destructor_temporaries.rs @@ -14,10 +14,12 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut destroyed_0)).postfix_inc(); (*std::cell::LazyCell::force_mut(&mut *&raw mut last_1)) = self.v; } + #[inline] pub unsafe fn get(&self) -> i32 { return self.v; } diff --git a/tests/unit/out/unsafe/doubly_linked_list.rs b/tests/unit/out/unsafe/doubly_linked_list.rs index cb9165046..3698ceea2 100644 --- a/tests/unit/out/unsafe/doubly_linked_list.rs +++ b/tests/unit/out/unsafe/doubly_linked_list.rs @@ -14,9 +14,11 @@ pub struct Node { pub prev: *mut Node, } impl Node { + #[inline] pub unsafe fn SetNext(&mut self, mut n: *mut Node) { self.next = n; } + #[inline] pub unsafe fn SetPrev(&mut self, mut p: *mut Node) { self.prev = p; } diff --git a/tests/unit/out/unsafe/exprs.rs b/tests/unit/out/unsafe/exprs.rs index 2dc06ca08..460ad969d 100644 --- a/tests/unit/out/unsafe/exprs.rs +++ b/tests/unit/out/unsafe/exprs.rs @@ -18,9 +18,11 @@ pub struct Y { pub p: *mut X, } impl Y { + #[inline] pub unsafe fn foo(&mut self) -> *mut X { return &mut self.x; } + #[inline] pub unsafe fn ptr(&mut self) -> *mut X { return (&mut self.x as *mut X); } diff --git a/tests/unit/out/unsafe/field_method_receiver.rs b/tests/unit/out/unsafe/field_method_receiver.rs index af399d571..fb14a344c 100644 --- a/tests/unit/out/unsafe/field_method_receiver.rs +++ b/tests/unit/out/unsafe/field_method_receiver.rs @@ -12,15 +12,19 @@ pub struct Counter { pub n: i32, } impl Counter { + #[inline] pub unsafe fn get(&self) -> i32 { return self.n; } + #[inline] pub unsafe fn add(&mut self, mut k: i32) { self.n += k; } + #[inline] pub unsafe fn self_(&mut self) -> *mut Counter { return (self as *mut Counter); } + #[inline] pub unsafe fn take(&mut self, mut other: *mut Counter) { self.n += (*other).n; (*other).n = 0; @@ -35,12 +39,14 @@ pub struct S { pub v: Vec, } impl S { + #[inline] pub unsafe fn bump(&mut self) { (unsafe { let _k: i32 = self.tag; Counter::add(&mut self.c, _k) }); } + #[inline] pub unsafe fn move_from(_a0: *mut S) -> Self { let mut this = Self { tag: (*_a0).tag, @@ -50,6 +56,7 @@ impl S { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut S) -> *mut S { self.tag = (*_a0).tag; self.c = (*_a0).c; diff --git a/tests/unit/out/unsafe/field_pointers.rs b/tests/unit/out/unsafe/field_pointers.rs index 75ba1f868..c852d4462 100644 --- a/tests/unit/out/unsafe/field_pointers.rs +++ b/tests/unit/out/unsafe/field_pointers.rs @@ -29,18 +29,22 @@ pub struct Outer { pub buf: [i32; 4], } impl Outer { + #[inline] pub unsafe fn next(&mut self) -> i32 { return self.buf[(self.x.postfix_inc()) as usize]; } + #[inline] pub unsafe fn sum(&self) -> i32 { return ((self.x) + (self.inner.a)); } + #[inline] pub unsafe fn push(&mut self, mut k: i32) { { let __a1 = ((k) + (self.x)); self.v.push(__a1) }; } + #[inline] pub unsafe fn move_from(_a0: *mut Outer) -> Self { let mut this = Self { x: (*_a0).x, @@ -52,6 +56,7 @@ impl Outer { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Outer) -> *mut Outer { self.x = (*_a0).x; self.inner = (*_a0).inner; diff --git a/tests/unit/out/unsafe/fn_ptr.rs b/tests/unit/out/unsafe/fn_ptr.rs index 1ef79431b..c6c6ab6da 100644 --- a/tests/unit/out/unsafe/fn_ptr.rs +++ b/tests/unit/out/unsafe/fn_ptr.rs @@ -38,6 +38,7 @@ pub struct HashHolder_unsigned_long__ptr__bool__ { pub h: Option u64>, } impl HashHolder_unsigned_long__ptr__bool__ { + #[inline] pub unsafe fn new(h: *const Option u64>) -> Self { let mut this = Self { h: (*h) }; this diff --git a/tests/unit/out/unsafe/fn_ptr_struct.rs b/tests/unit/out/unsafe/fn_ptr_struct.rs index d09ca754a..64e05f6bd 100644 --- a/tests/unit/out/unsafe/fn_ptr_struct.rs +++ b/tests/unit/out/unsafe/fn_ptr_struct.rs @@ -22,12 +22,15 @@ pub unsafe fn negate_1(mut x: i32) -> i32 { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct S {} impl S { + #[inline] pub unsafe fn pick_1(mut x: i32) -> i32 { return ((x) + (1)); } + #[inline] pub unsafe fn pick_2(mut x: i64) -> i32 { return ((x as i32) + (2)); } + #[inline] pub unsafe fn solo(mut x: i32) -> i32 { return ((x) + (3)); } @@ -39,15 +42,18 @@ pub struct MoveOnly { pub data_: i32, } impl MoveOnly { + #[inline] pub unsafe fn new(mut data: i32) -> Self { let mut this = Self { data_: data }; this } + #[inline] pub unsafe fn move_from(x: *mut MoveOnly) -> Self { let mut this = Self { data_: (*x).data_ }; (*x).data_ = 0; this } + #[inline] pub unsafe fn get(&self) -> i32 { return self.data_; } diff --git a/tests/unit/out/unsafe/fn_ref.rs b/tests/unit/out/unsafe/fn_ref.rs index 9f591019f..3c92abe97 100644 --- a/tests/unit/out/unsafe/fn_ref.rs +++ b/tests/unit/out/unsafe/fn_ref.rs @@ -27,6 +27,7 @@ pub struct Holder { pub f: Option i32>, } impl Holder { + #[inline] pub unsafe fn run(&self, mut x: i32) -> i32 { return (unsafe { (self.f).unwrap()(x) }); } diff --git a/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs b/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs index 429b2ff90..8af83444e 100644 --- a/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs +++ b/tests/unit/out/unsafe/foreach_disjoint_field_borrow.rs @@ -13,6 +13,7 @@ pub struct S { pub a: i32, } impl S { + #[inline] pub unsafe fn move_from(_a0: *mut S) -> Self { let mut this = Self { v: std::mem::take(&mut (*_a0).v), @@ -20,6 +21,7 @@ impl S { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut S) -> *mut S { self.v = std::mem::take(&mut (*_a0).v); self.a = (*_a0).a; diff --git a/tests/unit/out/unsafe/forward_basic.rs b/tests/unit/out/unsafe/forward_basic.rs index 8f4450a91..e7e3dcdb1 100644 --- a/tests/unit/out/unsafe/forward_basic.rs +++ b/tests/unit/out/unsafe/forward_basic.rs @@ -18,6 +18,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -26,6 +27,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -34,6 +36,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -56,6 +59,7 @@ pub unsafe fn chosen_overload_1(_a0: *mut Tracked) -> Overload { return Overload_kRvalueOverload; } impl Holder { + #[inline] pub unsafe fn new_1(x: *mut Tracked) -> Self { let mut this = Self { t: Tracked::copy_from({ x }), @@ -64,6 +68,7 @@ impl Holder { } } impl Holder { + #[inline] pub unsafe fn new_2(x: *mut Tracked) -> Self { let mut this = Self { t: Tracked::move_from({ x }), @@ -79,6 +84,7 @@ pub struct Holder { pub t: Tracked, } impl Holder { + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { t: Tracked::move_from({ &mut (*_a0).t }), diff --git a/tests/unit/out/unsafe/forward_decltype.rs b/tests/unit/out/unsafe/forward_decltype.rs index 52854756d..9c0c9c548 100644 --- a/tests/unit/out/unsafe/forward_decltype.rs +++ b/tests/unit/out/unsafe/forward_decltype.rs @@ -18,6 +18,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -26,6 +27,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -34,6 +36,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v, diff --git a/tests/unit/out/unsafe/forward_explicit.rs b/tests/unit/out/unsafe/forward_explicit.rs index 50ff75776..d97bbd001 100644 --- a/tests/unit/out/unsafe/forward_explicit.rs +++ b/tests/unit/out/unsafe/forward_explicit.rs @@ -20,6 +20,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -28,6 +29,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -36,6 +38,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v, diff --git a/tests/unit/out/unsafe/forward_pack.rs b/tests/unit/out/unsafe/forward_pack.rs index 04e30c282..a31eb42f8 100644 --- a/tests/unit/out/unsafe/forward_pack.rs +++ b/tests/unit/out/unsafe/forward_pack.rs @@ -20,6 +20,7 @@ pub struct Tracked { pub moves: i32, } impl Tracked { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -28,6 +29,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -36,6 +38,7 @@ impl Tracked { }; this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v, @@ -98,6 +101,7 @@ pub unsafe fn forward_pack_7( return digits; } impl Pair { + #[inline] pub unsafe fn new(x: *mut Tracked, y: *mut Tracked) -> Self { let mut this = Self { a: Tracked::copy_from({ x }), @@ -113,6 +117,7 @@ pub struct Pair { pub b: Tracked, } impl Pair { + #[inline] pub unsafe fn move_from(_a0: *mut Pair) -> Self { let mut this = Self { a: Tracked::move_from({ &mut (*_a0).a }), diff --git a/tests/unit/out/unsafe/friend.rs b/tests/unit/out/unsafe/friend.rs index c1acdfeb1..6c9fc8a87 100644 --- a/tests/unit/out/unsafe/friend.rs +++ b/tests/unit/out/unsafe/friend.rs @@ -6,15 +6,19 @@ use std::collections::BTreeMap; use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; +#[inline] pub unsafe fn get_0(v: *const V) -> i32 { return (*v).x; } +#[inline] pub unsafe fn operator_eq_1(a: *const V, b: *const V) -> bool { return (((*a).x) == ((*b).x)); } +#[inline] pub unsafe fn scaled_2(v: *const V, mut k: i32) -> i32 { return (((*v).x) * (k)); } +#[inline] pub unsafe fn scaled_3(v: *const V, mut k: f64) -> f64 { return (((*v).x as f64) * (k)); } @@ -29,6 +33,7 @@ impl std::cmp::PartialEq for V { } } impl std::cmp::Eq for V {} +#[inline] pub unsafe fn get_4(w: *const W_int_) -> i32 { return (*w).x; } @@ -37,6 +42,7 @@ pub unsafe fn get_4(w: *const W_int_) -> i32 { pub struct W_int_ { pub x: i32, } +#[inline] pub unsafe fn get_5(w: *const W_long_) -> i64 { return (*w).x; } diff --git a/tests/unit/out/unsafe/function_overloading.rs b/tests/unit/out/unsafe/function_overloading.rs index 84a1b10f2..55918cace 100644 --- a/tests/unit/out/unsafe/function_overloading.rs +++ b/tests/unit/out/unsafe/function_overloading.rs @@ -25,11 +25,17 @@ pub unsafe fn bar_4(x: *mut i32) -> i32 { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Foo {} impl Foo { + #[inline] pub unsafe fn foo_1(&self) {} + #[inline] pub unsafe fn foo_2(&mut self) {} + #[inline] pub unsafe fn method_3(&mut self, mut x: i32) {} + #[inline] pub unsafe fn method_4(&self, mut x: i32) {} + #[inline] pub unsafe fn method2_5(&self, mut x: i32, mut y: i32) {} + #[inline] pub unsafe fn method2_6(&self, mut x: f64, mut y: f64) {} } pub unsafe fn func_5(mut x: i32) -> i32 { diff --git a/tests/unit/out/unsafe/global_init_side_effect.rs b/tests/unit/out/unsafe/global_init_side_effect.rs index 8a82f9361..eab80659b 100644 --- a/tests/unit/out/unsafe/global_init_side_effect.rs +++ b/tests/unit/out/unsafe/global_init_side_effect.rs @@ -12,6 +12,7 @@ pub static mut total_0: std::cell::LazyCell = std::cell::LazyCell::new(|| u #[cpp_from(i32, new, value)] pub struct S {} impl S { + #[inline] pub unsafe fn new(mut x: i32) -> Self { let mut this = Self {}; (*std::cell::LazyCell::force_mut(&mut *&raw mut total_0)) += x; diff --git a/tests/unit/out/unsafe/global_non_const_init.rs b/tests/unit/out/unsafe/global_non_const_init.rs index 2479407cb..f273ccffe 100644 --- a/tests/unit/out/unsafe/global_non_const_init.rs +++ b/tests/unit/out/unsafe/global_non_const_init.rs @@ -10,6 +10,7 @@ pub unsafe fn next_0() -> i32 { return (*std::cell::LazyCell::force_mut(&mut *&raw mut counter_1)).prefix_inc(); } static mut counter_1: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { 0 }); +#[inline] pub unsafe fn marker_2(mut tag: u8) -> u8 { return ((((tag as i32) << (3)) | (2)) as u8); } @@ -33,12 +34,14 @@ pub struct Ctor { pub v: i32, } impl Ctor { + #[inline] pub unsafe fn new_1() -> Self { let mut this = Self { v: (unsafe { next_0() }), }; this } + #[inline] pub unsafe fn new_2(mut x: i32) -> Self { let mut this = Self { v: x }; this @@ -82,10 +85,12 @@ pub struct Singleton { pub hits: i32, } impl Singleton { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { hits: 0 }; this } + #[inline] pub unsafe fn instance() -> *mut Singleton { return &mut (*std::cell::LazyCell::force_mut(&mut *&raw mut s_15)); } diff --git a/tests/unit/out/unsafe/huffman.rs b/tests/unit/out/unsafe/huffman.rs index cae71fccc..3d4f429c9 100644 --- a/tests/unit/out/unsafe/huffman.rs +++ b/tests/unit/out/unsafe/huffman.rs @@ -15,6 +15,7 @@ pub struct MinHeapNode { pub right: *mut MinHeapNode, } impl MinHeapNode { + #[inline] pub unsafe fn IsLeaf(&self) -> bool { return ((self.left).is_null()) && ((self.right).is_null()); } @@ -49,6 +50,7 @@ pub struct MinHeap { pub alloc: Option>, } impl MinHeap { + #[inline] pub unsafe fn Alloc(&mut self, mut data: libc::c_char, mut freq: i32) -> *mut MinHeapNode { (*self .alloc @@ -66,6 +68,7 @@ impl MinHeap { .map_or(::std::ptr::null_mut(), |s| s.as_ptr() as *mut MinHeapNode) .add((self.next.postfix_inc() as usize))) as *mut MinHeapNode); } + #[inline] pub unsafe fn Heapify(&mut self, mut idx: i32) { let mut smallest: i32 = idx; let mut left: i32 = (((2) * (idx)) + (1)); @@ -131,6 +134,7 @@ impl MinHeap { (unsafe { MinHeap::Heapify(self, smallest) }); } } + #[inline] pub unsafe fn ExtractMin(&mut self) -> *mut MinHeapNode { let mut out: *mut MinHeapNode = (*self .arr @@ -156,6 +160,7 @@ impl MinHeap { (unsafe { MinHeap::Heapify(self, 0) }); return out; } + #[inline] pub unsafe fn Insert(&mut self, mut node: *mut MinHeapNode) { self.size.prefix_inc(); let mut i: i32 = ((self.size) - (1)); @@ -193,6 +198,7 @@ impl MinHeap { }) .add((i as usize))) = node; } + #[inline] pub unsafe fn Build( &mut self, data: *mut Option>, @@ -226,6 +232,7 @@ impl MinHeap { i.prefix_dec(); } } + #[inline] pub unsafe fn move_from(_a0: *mut MinHeap) -> Self { let mut this = Self { size: (*_a0).size, @@ -236,6 +243,7 @@ impl MinHeap { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut MinHeap) -> *mut MinHeap { self.size = (*_a0).size; self.capacity = (*_a0).capacity; 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 d6e2c0f14..b7d343aed 100644 --- a/tests/unit/out/unsafe/immutable-deref-on-func-call.rs +++ b/tests/unit/out/unsafe/immutable-deref-on-func-call.rs @@ -12,6 +12,7 @@ pub struct Item { pub value: i32, } impl Item { + #[inline] pub unsafe fn foo(&mut self, mut other: *mut Item) { (*other).value = 10; } diff --git a/tests/unit/out/unsafe/implicit_autoref.rs b/tests/unit/out/unsafe/implicit_autoref.rs index fe77baed4..bb40345d7 100644 --- a/tests/unit/out/unsafe/implicit_autoref.rs +++ b/tests/unit/out/unsafe/implicit_autoref.rs @@ -12,12 +12,14 @@ pub struct Holder { pub v: Vec, } impl Holder { + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { v: std::mem::take(&mut (*_a0).v), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.v = std::mem::take(&mut (*_a0).v); return &mut (*(self as *mut Holder)); diff --git a/tests/unit/out/unsafe/in_class_field_initializer.rs b/tests/unit/out/unsafe/in_class_field_initializer.rs index 7a87ba211..876c78396 100644 --- a/tests/unit/out/unsafe/in_class_field_initializer.rs +++ b/tests/unit/out/unsafe/in_class_field_initializer.rs @@ -44,6 +44,7 @@ pub struct Boxed_int_ { pub tag: i32, } impl Boxed_int_ { + #[inline] pub unsafe fn new(mut x: i32, mut t: i32) -> Self { let mut this = Self { v: x, tag: t }; this diff --git a/tests/unit/out/unsafe/init_list.rs b/tests/unit/out/unsafe/init_list.rs index 5c7a064f5..fd1360a4d 100644 --- a/tests/unit/out/unsafe/init_list.rs +++ b/tests/unit/out/unsafe/init_list.rs @@ -19,6 +19,7 @@ pub struct Holder { pub p: Pair, } impl Holder { + #[inline] pub unsafe fn operator_assign_1(&mut self, o: *mut Pair) -> *mut Holder { self.p = (*o); return &mut (*(self as *mut Holder)); diff --git a/tests/unit/out/unsafe/inline_container_fields.rs b/tests/unit/out/unsafe/inline_container_fields.rs index d90a7bc54..f61c07bbb 100644 --- a/tests/unit/out/unsafe/inline_container_fields.rs +++ b/tests/unit/out/unsafe/inline_container_fields.rs @@ -14,6 +14,7 @@ pub struct Elem { pub coeffs: Vec, } impl Elem { + #[inline] pub unsafe fn move_from(_a0: *mut Elem) -> Self { let mut this = Self { id: (*_a0).id, @@ -22,6 +23,7 @@ impl Elem { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Elem) -> *mut Elem { self.id = (*_a0).id; match ( @@ -49,6 +51,7 @@ pub struct State { pub rows: Vec>, } impl State { + #[inline] pub unsafe fn move_from(_a0: *mut State) -> Self { let mut this = Self { count: (*_a0).count, @@ -61,6 +64,7 @@ impl State { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut State) -> *mut State { self.count = (*_a0).count; match ( @@ -146,22 +150,26 @@ pub struct Counted { pub v: i32, } impl Counted { + #[inline] pub unsafe fn copy_from(o: *const Counted) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_2)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Counted) -> Self { let mut this = Self { v: (*o).v }; (*o).v = -1_i32; (*std::cell::LazyCell::force_mut(&mut *&raw mut moves_3)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Counted) -> *mut Counted { self.v = (*o).v; (*std::cell::LazyCell::force_mut(&mut *&raw mut copy_assigns_4)).prefix_inc(); return &mut (*(self as *mut Counted)); } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut Counted) -> *mut Counted { self.v = (*o).v; (*o).v = -1_i32; diff --git a/tests/unit/out/unsafe/inline_functions.rs b/tests/unit/out/unsafe/inline_functions.rs new file mode 100644 index 000000000..a5c9c292e --- /dev/null +++ b/tests/unit/out/unsafe/inline_functions.rs @@ -0,0 +1,109 @@ +extern crate libc; +use libc::*; +extern crate libcc2rs; +use libcc2rs::*; +use std::collections::BTreeMap; +use std::io::{Read, Seek, Write}; +use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; +use std::rc::Rc; +#[inline] +pub unsafe fn inlined_free_0(mut a: i32) -> i32 { + return ((a) + (1)); +} +#[inline] +pub unsafe fn inlined_constexpr_free_1(mut a: i32) -> i32 { + return ((a) + (2)); +} +#[inline] +pub unsafe fn inlined_declared_free_2(mut a: i32) -> i32 { + return ((a) + (3)); +} +pub unsafe fn not_inlined_free_3(mut a: i32) -> i32 { + return ((a) + (4)); +} +pub unsafe fn not_inlined_static_free_4(mut a: i32) -> i32 { + return ((a) + (5)); +} +pub unsafe trait Base { + unsafe fn inlined_override(&self, a: i32) -> i32; + unsafe fn not_inlined_override(&self, a: i32) -> i32; +} +#[repr(C)] +#[derive(Copy, Clone, VaArg, FnPtrArg, Default)] +pub struct Derived { + v_: i32, +} +impl Derived { + #[inline] + pub unsafe fn new(mut v: i32) -> Self { + let mut this = Self { v_: v }; + this + } + #[inline] + pub unsafe fn inlined_in_class(&self) -> i32 { + return ((self.v_) * (2)); + } + #[inline] + pub unsafe fn inlined_static_in_class(mut a: i32) -> i32 { + return ((a) * (3)); + } +} +impl Derived { + #[inline] + pub unsafe fn inlined_declared_in_class(&self) -> i32 { + return ((self.v_) * (4)); + } +} +impl Derived { + #[inline] + pub unsafe fn inlined_defined_out_of_line(&self) -> i32 { + return ((self.v_) * (5)); + } +} +impl Derived { + pub unsafe fn not_inlined_out_of_line(&self) -> i32 { + return ((self.v_) * (6)); + } +} +impl Derived { + pub unsafe fn not_inlined_static_out_of_line(mut a: i32) -> i32 { + return ((a) * (7)); + } +} +pub fn main() { + unsafe { + __cpp2rust_init_globals(); + std::process::exit(main_0() as i32); + } +} +unsafe fn main_0() -> i32 { + let mut d: Derived = Derived::new({ 3 }); + let b: *const Base = &d; + assert!(((unsafe { inlined_free_0(1,) }) == (2))); + assert!(((unsafe { inlined_constexpr_free_1(1,) }) == (3))); + assert!(((unsafe { inlined_declared_free_2(1,) }) == (4))); + assert!(((unsafe { not_inlined_free_3(1,) }) == (5))); + assert!(((unsafe { not_inlined_static_free_4(1,) }) == (6))); + assert!(((unsafe { (*b).inlined_override(1,) }) == (4))); + assert!(((unsafe { (*b).not_inlined_override(1,) }) == (2))); + assert!(((unsafe { Derived::inlined_in_class(&d,) }) == (6))); + assert!(((unsafe { Derived::inlined_static_in_class(2,) }) == (6))); + assert!(((unsafe { Derived::inlined_declared_in_class(&d,) }) == (12))); + assert!(((unsafe { Derived::inlined_defined_out_of_line(&d,) }) == (15))); + assert!(((unsafe { Derived::not_inlined_out_of_line(&d,) }) == (18))); + assert!(((unsafe { Derived::not_inlined_static_out_of_line(2,) }) == (14))); + return 0; +} +unsafe impl Base for Derived { + #[inline] + unsafe fn inlined_override(&self, a: i32) -> i32 { + return ((self.v_) + (a)); + } + unsafe fn not_inlined_override(&self, a: i32) -> i32 { + return ((self.v_) - (a)); + } + unsafe fn not_inlined_override(&self, a: i32) -> i32 { + return ((self.v_) - (a)); + } +} +pub unsafe fn __cpp2rust_init_globals() {} diff --git a/tests/unit/out/unsafe/kruskal.rs b/tests/unit/out/unsafe/kruskal.rs index 08fe65ade..a4935872d 100644 --- a/tests/unit/out/unsafe/kruskal.rs +++ b/tests/unit/out/unsafe/kruskal.rs @@ -182,6 +182,7 @@ pub struct DisjointSet { pub n: i32, } impl DisjointSet { + #[inline] pub unsafe fn makeSet(&mut self) { let mut i: i32 = 0; 'loop_: while ((i) < (self.n)) { @@ -198,6 +199,7 @@ impl DisjointSet { i.postfix_inc(); } } + #[inline] pub unsafe fn find(&mut self, mut x: i32) -> i32 { if ((*self .parent @@ -225,6 +227,7 @@ impl DisjointSet { .map_or(::std::ptr::null_mut(), |s| s.as_ptr() as *mut i32) .add((x as usize))); } + #[inline] pub unsafe fn merge(&mut self, mut x: i32, mut y: i32) { let mut xset: i32 = (unsafe { DisjointSet::find(self, x) }); let mut yset: i32 = (unsafe { DisjointSet::find(self, y) }); @@ -281,6 +284,7 @@ impl DisjointSet { + (1)); } } + #[inline] pub unsafe fn move_from(_a0: *mut DisjointSet) -> Self { let mut this = Self { rank: (*_a0).rank.take(), @@ -289,6 +293,7 @@ impl DisjointSet { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut DisjointSet) -> *mut DisjointSet { self.rank = (*_a0).rank.take(); self.parent = (*_a0).parent.take(); @@ -304,6 +309,7 @@ pub struct Graph { pub E: i32, } impl Graph { + #[inline] pub unsafe fn move_from(_a0: *mut Graph) -> Self { let mut this = Self { edges: (*_a0).edges.take(), @@ -312,6 +318,7 @@ impl Graph { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Graph) -> *mut Graph { self.edges = (*_a0).edges.take(); self.V = (*_a0).V; diff --git a/tests/unit/out/unsafe/lambda_as_field.rs b/tests/unit/out/unsafe/lambda_as_field.rs index ceb03288f..293b92155 100644 --- a/tests/unit/out/unsafe/lambda_as_field.rs +++ b/tests/unit/out/unsafe/lambda_as_field.rs @@ -12,6 +12,7 @@ pub struct Guard__lambda_at_lambda_as_field_cpp_34_13__ { pub f: FnPtr, } impl Guard__lambda_at_lambda_as_field_cpp_34_13__ { + #[inline] pub unsafe fn destructor(&mut self) { (unsafe { self.f.call() }); } @@ -33,6 +34,7 @@ pub struct Guard__lambda_at_lambda_as_field_cpp_45_13__ { pub f: FnPtr, } impl Guard__lambda_at_lambda_as_field_cpp_45_13__ { + #[inline] pub unsafe fn destructor(&mut self) { (unsafe { self.f.call() }); } @@ -44,6 +46,7 @@ pub struct Holder__lambda_at_lambda_as_field_cpp_39_12__ { pub calls: i32, } impl Holder__lambda_at_lambda_as_field_cpp_39_12__ { + #[inline] pub unsafe fn call(&mut self, mut x: i32) -> i32 { self.calls.postfix_inc(); return (unsafe { self.f.call(x) }); @@ -70,6 +73,7 @@ pub struct Holder__lambda_at_lambda_as_field_cpp_51_12__ { pub calls: i32, } impl Holder__lambda_at_lambda_as_field_cpp_51_12__ { + #[inline] pub unsafe fn call(&mut self, mut x: i32) -> i32 { self.calls.postfix_inc(); return (unsafe { self.f.call(x) }); @@ -83,6 +87,7 @@ pub struct Moving__lambda_at_lambda_as_field_cpp_64_12__ { pub moves: i32, } impl Moving__lambda_at_lambda_as_field_cpp_64_12__ { + #[inline] pub unsafe fn new(mut f: FnPtr i32>) -> Self { let mut this = Self { f: f.copy_from(), @@ -90,6 +95,7 @@ impl Moving__lambda_at_lambda_as_field_cpp_64_12__ { }; this } + #[inline] pub unsafe fn move_from(o: *mut Moving__lambda_at_lambda_as_field_cpp_64_12__) -> Self { let mut this = Self { f: (*o).f.move_from(), diff --git a/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs b/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs index c8a093317..0e34d6b79 100644 --- a/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs +++ b/tests/unit/out/unsafe/lambda_capture_copy_ctor.rs @@ -13,6 +13,7 @@ pub struct Counted { pub moves: i32, } impl Counted { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { copies: 0, @@ -20,6 +21,7 @@ impl Counted { }; this } + #[inline] pub unsafe fn copy_from(o: *const Counted) -> Self { let mut this = Self { copies: (((*o).copies) + (1)), @@ -27,6 +29,7 @@ impl Counted { }; this } + #[inline] pub unsafe fn move_from(o: *mut Counted) -> Self { let mut this = Self { copies: (*o).copies, @@ -50,18 +53,22 @@ pub static mut drops_0: std::cell::LazyCell = std::cell::LazyCell::new(|| u #[derive(VaArg, FnPtrArg, MoveCtorUnsafe, DestructorUnsafe)] pub struct Dropped {} impl Dropped { + #[inline] pub unsafe fn new() -> Self { let mut this = Self {}; this } + #[inline] pub unsafe fn copy_from(_a0: *const Dropped) -> Self { let mut this = Self {}; this } + #[inline] pub unsafe fn move_from(_a0: *mut Dropped) -> Self { let mut this = Self {}; this } + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut drops_0)).postfix_inc(); } diff --git a/tests/unit/out/unsafe/lambda_capture_star_this.rs b/tests/unit/out/unsafe/lambda_capture_star_this.rs index c31f5fc68..a0590ae90 100644 --- a/tests/unit/out/unsafe/lambda_capture_star_this.rs +++ b/tests/unit/out/unsafe/lambda_capture_star_this.rs @@ -12,9 +12,11 @@ pub struct S { pub n: i32, } impl S { + #[inline] pub unsafe fn twice(&self) -> i32 { return ((self.n) * (2)); } + #[inline] pub unsafe fn modify_copy(&mut self) -> i32 { let mut f: FnPtr i32> = lambda_unsafe!( { @@ -28,6 +30,7 @@ impl S { let mut r: i32 = (unsafe { f.call() }); return (((r) * (100)) + (self.n)); } + #[inline] pub unsafe fn snapshot(&mut self) -> i32 { let mut f: FnPtr i32> = lambda_unsafe!( { @@ -40,6 +43,7 @@ impl S { self.n = 99; return (unsafe { f.call() }); } + #[inline] pub unsafe fn mixed(&mut self, mut k: i32) -> i32 { let mut f: FnPtr i32> = lambda_unsafe!( { diff --git a/tests/unit/out/unsafe/lambda_capture_this.rs b/tests/unit/out/unsafe/lambda_capture_this.rs index cfa908778..7cf63c0b1 100644 --- a/tests/unit/out/unsafe/lambda_capture_this.rs +++ b/tests/unit/out/unsafe/lambda_capture_this.rs @@ -13,12 +13,15 @@ pub struct S { pub step: i32, } impl S { + #[inline] pub unsafe fn add(&mut self, mut k: i32) { self.n += k; } + #[inline] pub unsafe fn scaled(&self) -> i32 { return ((self.n) * (self.step)); } + #[inline] pub unsafe fn bump(&mut self, mut by: i32) { let mut inc: FnPtr = lambda_unsafe!( { @@ -31,6 +34,7 @@ impl S { (unsafe { inc.call(by) }); (unsafe { inc.call(by) }); } + #[inline] pub unsafe fn bump_via_method(&mut self, mut by: i32) { let mut inc: FnPtr = lambda_unsafe!( { @@ -42,6 +46,7 @@ impl S { ); (unsafe { inc.call(by) }); } + #[inline] pub unsafe fn read_scaled(&self) -> i32 { let mut get: FnPtr i32> = lambda_unsafe!( { diff --git a/tests/unit/out/unsafe/lambda_decltype_type.rs b/tests/unit/out/unsafe/lambda_decltype_type.rs index bd85885c7..e9c358024 100644 --- a/tests/unit/out/unsafe/lambda_decltype_type.rs +++ b/tests/unit/out/unsafe/lambda_decltype_type.rs @@ -14,6 +14,7 @@ pub struct Sorted__lambda_at_lambda_decltype_type_cpp_22_18__ { pub cmp: FnPtr bool>, } impl Sorted__lambda_at_lambda_decltype_type_cpp_22_18__ { + #[inline] pub unsafe fn insert(&mut self, mut v: i32) { let mut i: i32 = self.size; 'loop_: while ((i) > (0)) @@ -52,6 +53,7 @@ pub struct Sorted__lambda_at_lambda_decltype_type_cpp_19_23__ { pub cmp: FnPtr bool>, } impl Sorted__lambda_at_lambda_decltype_type_cpp_19_23__ { + #[inline] pub unsafe fn insert(&mut self, mut v: i32) { let mut i: i32 = self.size; 'loop_: while ((i) > (0)) diff --git a/tests/unit/out/unsafe/lambda_move_only_capture.rs b/tests/unit/out/unsafe/lambda_move_only_capture.rs index edd3c44cb..eaaaad0ce 100644 --- a/tests/unit/out/unsafe/lambda_move_only_capture.rs +++ b/tests/unit/out/unsafe/lambda_move_only_capture.rs @@ -13,17 +13,20 @@ pub struct Owner { pub p: *mut i32, } impl Owner { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { p: (Box::leak(Box::new(v)) as *mut i32), }; this } + #[inline] pub unsafe fn move_from(o: *mut Owner) -> Self { let mut this = Self { p: (*o).p }; (*o).p = std::ptr::null_mut(); this } + #[inline] pub unsafe fn destructor(&mut self) { { let __p = self.p; @@ -32,6 +35,7 @@ impl Owner { } }; } + #[inline] pub unsafe fn take(&mut self) -> FnPtr i32> { return lambda_unsafe!( { diff --git a/tests/unit/out/unsafe/lambda_nested.rs b/tests/unit/out/unsafe/lambda_nested.rs index 3afc6a35e..5715aa5f9 100644 --- a/tests/unit/out/unsafe/lambda_nested.rs +++ b/tests/unit/out/unsafe/lambda_nested.rs @@ -12,6 +12,7 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn nested_this(&mut self) -> i32 { let mut outer: FnPtr i32> = lambda_unsafe!( { diff --git a/tests/unit/out/unsafe/libc_struct_without_default.rs b/tests/unit/out/unsafe/libc_struct_without_default.rs index 3e207dee6..93edb0365 100644 --- a/tests/unit/out/unsafe/libc_struct_without_default.rs +++ b/tests/unit/out/unsafe/libc_struct_without_default.rs @@ -13,6 +13,7 @@ pub struct UserDefined { pub v: Vec, } impl UserDefined { + #[inline] pub unsafe fn move_from(_a0: *mut UserDefined) -> Self { let mut this = Self { a: std::array::from_fn(|__i| (*&mut (&mut (*_a0)).a[__i])), @@ -20,6 +21,7 @@ impl UserDefined { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut UserDefined) -> *mut UserDefined { for __i in 0..1 { *&mut self.a[__i] = (*&mut (&mut (*_a0)).a[__i]); diff --git a/tests/unit/out/unsafe/linked_list.rs b/tests/unit/out/unsafe/linked_list.rs index 24b524b9f..744fcafe0 100644 --- a/tests/unit/out/unsafe/linked_list.rs +++ b/tests/unit/out/unsafe/linked_list.rs @@ -13,6 +13,7 @@ pub struct Node { pub next: *mut Node, } impl Node { + #[inline] pub unsafe fn SetNext(&mut self, mut next: *mut Node) { self.next = next; } diff --git a/tests/unit/out/unsafe/map.rs b/tests/unit/out/unsafe/map.rs index 74c973382..4165d0c7f 100644 --- a/tests/unit/out/unsafe/map.rs +++ b/tests/unit/out/unsafe/map.rs @@ -19,10 +19,12 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub unsafe fn new_1() -> Self { let mut this = Self { x: 0, y: 0 }; this } + #[inline] pub unsafe fn new_2(mut x: i32, mut y: i32) -> Self { let mut this = Self { x: x, y: y }; this diff --git a/tests/unit/out/unsafe/map_key_copy_ctor.rs b/tests/unit/out/unsafe/map_key_copy_ctor.rs index f461dad5c..e81cdab9c 100644 --- a/tests/unit/out/unsafe/map_key_copy_ctor.rs +++ b/tests/unit/out/unsafe/map_key_copy_ctor.rs @@ -16,20 +16,24 @@ pub struct Key { pub k: i32, } impl Key { + #[inline] pub unsafe fn new(mut k: i32) -> Self { let mut this = Self { k: k }; this } + #[inline] pub unsafe fn copy_from(o: *const Key) -> Self { let mut this = Self { k: (*o).k }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Key) -> Self { let mut this = Self { k: (*o).k }; (*std::cell::LazyCell::force_mut(&mut *&raw mut moves_1)).prefix_inc(); this } + #[inline] pub unsafe fn operator_lt(&self, o: *const Key) -> bool { return ((self.k) < ((*o).k)); } diff --git a/tests/unit/out/unsafe/map_key_identity.rs b/tests/unit/out/unsafe/map_key_identity.rs index 46f094ce8..e6fb7b7b9 100644 --- a/tests/unit/out/unsafe/map_key_identity.rs +++ b/tests/unit/out/unsafe/map_key_identity.rs @@ -50,6 +50,7 @@ pub struct Mapped { pub value: i32, } impl Mapped { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { value: 0 }; (*std::cell::LazyCell::force_mut(&mut *&raw mut default_constructions_0)).prefix_inc(); diff --git a/tests/unit/out/unsafe/max.rs b/tests/unit/out/unsafe/max.rs index dd27140f7..807a16082 100644 --- a/tests/unit/out/unsafe/max.rs +++ b/tests/unit/out/unsafe/max.rs @@ -23,15 +23,18 @@ pub struct Bag { pub n: i32, } impl Bag { + #[inline] pub unsafe fn new(mut n: i32) -> Self { let mut this = Self { n: n }; this } + #[inline] pub unsafe fn copy_from(o: *const Bag) -> Self { let mut this = Self { n: (*o).n }; (*std::cell::LazyCell::force_mut(&mut *&raw mut calls_0)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Bag) -> *mut Bag { self.n = (*_a0).n; return &mut (*(self as *mut Bag)); diff --git a/tests/unit/out/unsafe/move_assign.rs b/tests/unit/out/unsafe/move_assign.rs index 156f36d8d..805ddaf83 100644 --- a/tests/unit/out/unsafe/move_assign.rs +++ b/tests/unit/out/unsafe/move_assign.rs @@ -13,15 +13,18 @@ pub struct MoveOnly { pub v: i32, } impl MoveOnly { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn move_from(o: *mut MoveOnly) -> Self { let mut this = Self { v: (*o).v }; (*o).v = 0; this } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut MoveOnly) -> *mut MoveOnly { if ((self as *mut MoveOnly) == (o)) { return &mut (*(self as *mut MoveOnly)); @@ -37,14 +40,17 @@ pub struct ConstMoveAssign { pub mark: i32, } impl ConstMoveAssign { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { mark: 0 }; this } + #[inline] pub unsafe fn operator_assign_2(&mut self, o: *mut ConstMoveAssign) -> *mut ConstMoveAssign { self.mark = (((*o).mark) + (1)); return &mut (*(self as *mut ConstMoveAssign)); } + #[inline] pub unsafe fn operator_assign_3(&mut self, o: *const ConstMoveAssign) -> *mut ConstMoveAssign { self.mark = (((*o).mark) + (10)); return &mut (*(self as *mut ConstMoveAssign)); diff --git a/tests/unit/out/unsafe/move_ctor.rs b/tests/unit/out/unsafe/move_ctor.rs index e31e507e0..3cd71efd2 100644 --- a/tests/unit/out/unsafe/move_ctor.rs +++ b/tests/unit/out/unsafe/move_ctor.rs @@ -13,10 +13,12 @@ pub struct MoveOnly { pub v: i32, } impl MoveOnly { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn move_from(o: *mut MoveOnly) -> Self { let mut this = Self { v: (*o).v }; (*o).v = 0; @@ -29,16 +31,19 @@ pub struct ConstMove { pub mark: i32, } impl ConstMove { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { mark: 0 }; this } + #[inline] pub unsafe fn new_1(o: *mut ConstMove) -> Self { let mut this = Self { mark: (((*o).mark) + (1)), }; this } + #[inline] pub unsafe fn new_2(o: *const ConstMove) -> Self { let mut this = Self { mark: (((*o).mark) + (10)), @@ -60,6 +65,7 @@ pub struct ThrowingMove { pub moves: i32, } impl ThrowingMove { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -68,6 +74,7 @@ impl ThrowingMove { }; this } + #[inline] pub unsafe fn copy_from(o: *const ThrowingMove) -> Self { let mut this = Self { v: (*o).v, @@ -76,6 +83,7 @@ impl ThrowingMove { }; this } + #[inline] pub unsafe fn move_from(o: *mut ThrowingMove) -> Self { let mut this = Self { v: (*o).v, @@ -100,6 +108,7 @@ pub struct NoexceptMove { pub moves: i32, } impl NoexceptMove { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v, @@ -108,6 +117,7 @@ impl NoexceptMove { }; this } + #[inline] pub unsafe fn copy_from(o: *const NoexceptMove) -> Self { let mut this = Self { v: (*o).v, @@ -116,6 +126,7 @@ impl NoexceptMove { }; this } + #[inline] pub unsafe fn move_from(o: *mut NoexceptMove) -> Self { let mut this = Self { v: (*o).v, diff --git a/tests/unit/out/unsafe/move_this.rs b/tests/unit/out/unsafe/move_this.rs index e57b4f493..0d8c42b4d 100644 --- a/tests/unit/out/unsafe/move_this.rs +++ b/tests/unit/out/unsafe/move_this.rs @@ -13,16 +13,19 @@ pub struct Chain { pub v: i32, } impl Chain { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Chain) -> Self { let mut this = Self { v: (((*o).v) + (100)), }; this } + #[inline] pub unsafe fn move_from(o: *mut Chain) -> Self { let mut this = Self { v: (((*o).v) + (1)), @@ -30,20 +33,25 @@ impl Chain { (*o).v = 0; this } + #[inline] pub unsafe fn add_4(&mut self, mut n: i32) -> *mut Chain { self.v += n; return &mut (*(self as *mut Chain)); } + #[inline] pub unsafe fn add_5(&mut self, mut n: i32) -> *mut Chain { self.v += n; return &mut (*(self as *mut Chain)); } + #[inline] pub unsafe fn take(&mut self) -> Chain { return Chain::move_from({ &mut (*(self as *mut Chain)) }); } + #[inline] pub unsafe fn copy(&self) -> Chain { return Chain::copy_from({ &(*(self as *const Chain)) }); } + #[inline] pub unsafe fn self_(&mut self) -> *mut Chain { return &mut (*(self as *mut Chain)); } diff --git a/tests/unit/out/unsafe/nttp_distinct_specializations.rs b/tests/unit/out/unsafe/nttp_distinct_specializations.rs index a7dccd609..2f58eba0a 100644 --- a/tests/unit/out/unsafe/nttp_distinct_specializations.rs +++ b/tests/unit/out/unsafe/nttp_distinct_specializations.rs @@ -13,6 +13,7 @@ pub struct S_2_ { pub w: i32, } impl S_2_ { + #[inline] pub unsafe fn get(&self) -> i32 { return ((self.v) - (self.w)); } @@ -23,6 +24,7 @@ pub struct S_1_ { pub v: i32, } impl S_1_ { + #[inline] pub unsafe fn get(&self) -> i32 { return ((self.v) * (1)); } @@ -33,6 +35,7 @@ pub struct S_3_ { pub v: i32, } impl S_3_ { + #[inline] pub unsafe fn get(&self) -> i32 { return ((self.v) * (3)); } diff --git a/tests/unit/out/unsafe/operator_arithmetic_member.rs b/tests/unit/out/unsafe/operator_arithmetic_member.rs index 8a7c698d3..4b9baa86f 100644 --- a/tests/unit/out/unsafe/operator_arithmetic_member.rs +++ b/tests/unit/out/unsafe/operator_arithmetic_member.rs @@ -12,50 +12,61 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_add_1(&self, o: *const S) -> S { return S { v: ((self.v) + ((*o).v)), }; } + #[inline] pub unsafe fn operator_sub_2(&self, o: *const S) -> S { return S { v: ((self.v) - ((*o).v)), }; } + #[inline] pub unsafe fn operator_mul(&self, o: *const S) -> S { return S { v: ((self.v) * ((*o).v)), }; } + #[inline] pub unsafe fn operator_div(&self, o: *const S) -> S { return S { v: ((self.v) / ((*o).v)), }; } + #[inline] pub unsafe fn operator_rem(&self, o: *const S) -> S { return S { v: ((self.v) % ((*o).v)), }; } + #[inline] pub unsafe fn operator_pos_6(&self) -> S { return S { v: self.v }; } + #[inline] pub unsafe fn operator_neg_7(&self) -> S { return S { v: -self.v }; } + #[inline] pub unsafe fn operator_inc_8(&mut self) -> *mut S { self.v.prefix_inc(); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_post_inc_9(&mut self, mut _a0: i32) -> S { let mut old: S = (*(self as *mut S)); self.v.prefix_inc(); return old; } + #[inline] pub unsafe fn operator_dec_10(&mut self) -> *mut S { self.v.prefix_dec(); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_post_dec_11(&mut self, mut _a0: i32) -> S { let mut old: S = (*(self as *mut S)); self.v.prefix_dec(); diff --git a/tests/unit/out/unsafe/operator_bitwise_member.rs b/tests/unit/out/unsafe/operator_bitwise_member.rs index f4607fa28..fb76e9501 100644 --- a/tests/unit/out/unsafe/operator_bitwise_member.rs +++ b/tests/unit/out/unsafe/operator_bitwise_member.rs @@ -12,29 +12,35 @@ pub struct S { pub v: u32, } impl S { + #[inline] pub unsafe fn operator_bitnot(&self) -> S { return S { v: !self.v }; } + #[inline] pub unsafe fn operator_bitand(&self, o: *const S) -> S { return S { v: ((self.v) & ((*o).v)), }; } + #[inline] pub unsafe fn operator_bitor(&self, o: *const S) -> S { return S { v: ((self.v) | ((*o).v)), }; } + #[inline] pub unsafe fn operator_bitxor(&self, o: *const S) -> S { return S { v: ((self.v) ^ ((*o).v)), }; } + #[inline] pub unsafe fn operator_shl(&self, mut n: i32) -> S { return S { v: ((self.v) << (n)), }; } + #[inline] pub unsafe fn operator_shr(&self, mut n: i32) -> S { return S { v: ((self.v) >> (n)), diff --git a/tests/unit/out/unsafe/operator_comparison_defaulted.rs b/tests/unit/out/unsafe/operator_comparison_defaulted.rs index 552887b49..0aa47a828 100644 --- a/tests/unit/out/unsafe/operator_comparison_defaulted.rs +++ b/tests/unit/out/unsafe/operator_comparison_defaulted.rs @@ -13,6 +13,7 @@ pub struct Eq { pub b: i32, } impl Eq { + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Eq) -> bool { return (((*(self as *const Eq)).a) == ((*_a0).a)) && (((*(self as *const Eq)).b) == ((*_a0).b)); @@ -31,6 +32,7 @@ pub struct Cmp { pub b: i32, } impl Cmp { + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const Cmp) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -48,6 +50,7 @@ impl Cmp { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Cmp) -> bool { return (((*(self as *const Cmp)).a) == ((*_a0).a)) && (((*(self as *const Cmp)).b) == ((*_a0).b)); @@ -75,9 +78,11 @@ pub struct Both { pub a: i32, } impl Both { + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Both) -> bool { return (((*(self as *const Both)).a) == ((*_a0).a)); } + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const Both) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -111,6 +116,7 @@ pub struct OrdOnly { pub a: i32, } impl OrdOnly { + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const OrdOnly) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -144,6 +150,7 @@ pub struct Inner { pub x: i32, } impl Inner { + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const Inner) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -154,6 +161,7 @@ impl Inner { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Inner) -> bool { return (((*(self as *const Inner)).x) == ((*_a0).x)); } @@ -181,6 +189,7 @@ pub struct Outer { pub y: i32, } impl Outer { + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const Outer) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = (unsafe { @@ -200,6 +209,7 @@ impl Outer { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Outer) -> bool { return (unsafe { let _arg0: *const Inner = &(*_a0).i; @@ -229,15 +239,18 @@ pub struct Secondary { pub a: i32, } impl Secondary { + #[inline] pub unsafe fn operator_eq(&self, _a0: *const Secondary) -> bool { return (((*(self as *const Secondary)).a) == ((*_a0).a)); } + #[inline] pub unsafe fn operator_ne(&self, _a0: *const Secondary) -> bool { return !(unsafe { let _arg0: *const Secondary = _a0; Secondary::operator_eq(&(*(self as *const Secondary)), _arg0) }); } + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const Secondary) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -248,12 +261,14 @@ impl Secondary { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_lt(&self, _a0: *const Secondary) -> bool { return (unsafe { let _arg0: *const Secondary = _a0; Secondary::operator_cmp(&(*(self as *const Secondary)), _arg0) }) == std::cmp::Ordering::Less; } + #[inline] pub unsafe fn operator_ge(&self, _a0: *const Secondary) -> bool { return (unsafe { let _arg0: *const Secondary = _a0; @@ -283,6 +298,7 @@ pub struct PtrMember { pub p: *mut i32, } impl PtrMember { + #[inline] pub unsafe fn operator_cmp(&self, _a0: *const PtrMember) -> std::cmp::Ordering { { let mut cmp: std::cmp::Ordering = @@ -293,6 +309,7 @@ impl PtrMember { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_eq(&self, _a0: *const PtrMember) -> bool { return (((*(self as *const PtrMember)).p) == ((*_a0).p)); } diff --git a/tests/unit/out/unsafe/operator_comparison_member.rs b/tests/unit/out/unsafe/operator_comparison_member.rs index f2f0f6624..aef5b2325 100644 --- a/tests/unit/out/unsafe/operator_comparison_member.rs +++ b/tests/unit/out/unsafe/operator_comparison_member.rs @@ -12,24 +12,31 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_eq(&self, o: *const S) -> bool { return ((self.v) == ((*o).v)); } + #[inline] pub unsafe fn operator_ne(&self, o: *const S) -> bool { return ((self.v) != ((*o).v)); } + #[inline] pub unsafe fn operator_lt_3(&self, o: *const S) -> bool { return ((self.v) < ((*o).v)); } + #[inline] pub unsafe fn operator_gt(&self, o: *const S) -> bool { return ((self.v) > ((*o).v)); } + #[inline] pub unsafe fn operator_le(&self, o: *const S) -> bool { return ((self.v) <= ((*o).v)); } + #[inline] pub unsafe fn operator_ge(&self, o: *const S) -> bool { return ((self.v) >= ((*o).v)); } + #[inline] pub unsafe fn operator_lt_7(&self, mut o: i32) -> bool { return ((self.v) < (o)); } diff --git a/tests/unit/out/unsafe/operator_comparison_mixed.rs b/tests/unit/out/unsafe/operator_comparison_mixed.rs index 61971bd1c..8db345381 100644 --- a/tests/unit/out/unsafe/operator_comparison_mixed.rs +++ b/tests/unit/out/unsafe/operator_comparison_mixed.rs @@ -12,21 +12,27 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_eq(&self, mut o: i32) -> bool { return ((self.v) == (o)); } + #[inline] pub unsafe fn operator_ne(&self, mut o: i32) -> bool { return ((self.v) != (o)); } + #[inline] pub unsafe fn operator_lt(&self, mut o: i32) -> bool { return ((self.v) < (o)); } + #[inline] pub unsafe fn operator_gt(&self, mut o: f64) -> bool { return ((self.v as f64) > (o)); } + #[inline] pub unsafe fn operator_le(&self, mut o: i64) -> bool { return ((self.v as i64) <= (o)); } + #[inline] pub unsafe fn operator_ge(&self, mut o: *const libc::c_char) -> bool { return ((self.v) >= (((*o) as i32) - (('0' as libc::c_char) as i32))); } diff --git a/tests/unit/out/unsafe/operator_comparison_nonbool.rs b/tests/unit/out/unsafe/operator_comparison_nonbool.rs index c28a8cf65..51c84327c 100644 --- a/tests/unit/out/unsafe/operator_comparison_nonbool.rs +++ b/tests/unit/out/unsafe/operator_comparison_nonbool.rs @@ -64,6 +64,7 @@ pub struct Custom { pub v: i32, } impl Custom { + #[inline] pub unsafe fn operator_cmp(&self, o: *const Custom) -> Result { return Result { r: ((self.v) - ((*o).v)), @@ -76,14 +77,17 @@ pub struct Mixed { pub v: i32, } impl Mixed { + #[inline] pub unsafe fn operator_cmp(&self, o: *const Mixed) -> Result { return Result { r: ((self.v) - ((*o).v)), }; } + #[inline] pub unsafe fn operator_lt(&self, o: *const Mixed) -> i32 { return if ((self.v) < ((*o).v)) { 8 } else { 0 }; } + #[inline] pub unsafe fn operator_eq(&self, o: *const Mixed) -> i32 { return if ((self.v) == ((*o).v)) { 9 } else { 0 }; } @@ -119,10 +123,12 @@ pub struct MyBool { pub value: bool, } impl MyBool { + #[inline] pub unsafe fn new(mut v: bool) -> Self { let mut this = Self { value: v }; this } + #[inline] pub unsafe fn to_bool(&self) -> bool { return self.value; } @@ -180,10 +186,12 @@ pub struct RefBool { pub value: bool, } impl RefBool { + #[inline] pub unsafe fn new(mut v: bool) -> Self { let mut this = Self { value: v }; this } + #[inline] pub unsafe fn to_bool(&self) -> bool { return self.value; } @@ -196,6 +204,7 @@ pub struct RefInt { pub v: i32, } impl RefInt { + #[inline] pub unsafe fn operator_eq(&self, _a0: *const RefInt) -> *mut RefBool { return &mut (*std::cell::LazyCell::force_mut(&mut *&raw mut ref_true_8)); } diff --git a/tests/unit/out/unsafe/operator_comparison_noncopyable.rs b/tests/unit/out/unsafe/operator_comparison_noncopyable.rs index 8a714d288..cc0191232 100644 --- a/tests/unit/out/unsafe/operator_comparison_noncopyable.rs +++ b/tests/unit/out/unsafe/operator_comparison_noncopyable.rs @@ -6,9 +6,11 @@ use std::collections::BTreeMap; use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; +#[inline] pub unsafe fn operator_eq_0(x: *const S, y: *const S) -> bool { return (((*x).data_) == ((*y).data_)); } +#[inline] pub unsafe fn operator_lt_1(x: *const S, y: *const S) -> bool { return (((*x).data_) < ((*y).data_)); } @@ -19,10 +21,12 @@ pub struct S { data_: i32, } impl S { + #[inline] pub unsafe fn new(mut data: i32) -> Self { let mut this = Self { data_: data }; this } + #[inline] pub unsafe fn move_from(_a0: *mut S) -> Self { let mut this = Self { data_: (*_a0).data_, diff --git a/tests/unit/out/unsafe/operator_compound_assignment_member.rs b/tests/unit/out/unsafe/operator_compound_assignment_member.rs index 832de9e9b..4e56c8f31 100644 --- a/tests/unit/out/unsafe/operator_compound_assignment_member.rs +++ b/tests/unit/out/unsafe/operator_compound_assignment_member.rs @@ -12,46 +12,57 @@ pub struct S { pub v: u32, } impl S { + #[inline] pub unsafe fn operator_assign_1(&mut self, mut n: u32) -> *mut S { self.v = n; return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_add_assign(&mut self, o: *const S) -> *mut S { self.v = (self.v).wrapping_add((*o).v); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_sub_assign(&mut self, o: *const S) -> *mut S { self.v = (self.v).wrapping_sub((*o).v); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_mul_assign(&mut self, o: *const S) -> *mut S { self.v = (self.v).wrapping_mul((*o).v); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_div_assign(&mut self, o: *const S) -> *mut S { self.v = (self.v).wrapping_div((*o).v); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_rem_assign(&mut self, o: *const S) -> *mut S { self.v = (self.v).wrapping_rem((*o).v); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_bitand_assign(&mut self, o: *const S) -> *mut S { self.v &= (*o).v; return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_bitor_assign(&mut self, o: *const S) -> *mut S { self.v |= (*o).v; return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_bitxor_assign(&mut self, o: *const S) -> *mut S { self.v ^= (*o).v; return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_shl_assign(&mut self, mut n: i32) -> *mut S { self.v <<= n; return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn operator_shr_assign(&mut self, mut n: i32) -> *mut S { self.v >>= n; return &mut (*(self as *mut S)); diff --git a/tests/unit/out/unsafe/operator_friend.rs b/tests/unit/out/unsafe/operator_friend.rs index 98c57d3f7..487b7cf4f 100644 --- a/tests/unit/out/unsafe/operator_friend.rs +++ b/tests/unit/out/unsafe/operator_friend.rs @@ -6,6 +6,7 @@ use std::collections::BTreeMap; use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; +#[inline] pub unsafe fn operator_eq_0(_a0: *const Defaulted, _a1: *const Defaulted) -> bool { return (((*_a0).a) == ((*_a1).a)) && (((*_a0).b) == ((*_a1).b)); } @@ -21,6 +22,7 @@ impl std::cmp::PartialEq for Defaulted { } } impl std::cmp::Eq for Defaulted {} +#[inline] pub unsafe fn operator_cmp_1( _a0: *const DefaultedOrd, _a1: *const DefaultedOrd, @@ -33,6 +35,7 @@ pub unsafe fn operator_cmp_1( } return std::cmp::Ordering::Equal; } +#[inline] pub unsafe fn operator_eq_2(_a0: *const DefaultedOrd, _a1: *const DefaultedOrd) -> bool { return (((*_a0).a) == ((*_a1).a)); } @@ -57,12 +60,15 @@ impl std::cmp::PartialEq for DefaultedOrd { } } impl std::cmp::Eq for DefaultedOrd {} +#[inline] pub unsafe fn operator_eq_3(x: *const Inline, y: *const Inline) -> bool { return (((*x).a) == ((*y).a)); } +#[inline] pub unsafe fn operator_lt_4(x: *const Inline, y: *const Inline) -> bool { return (((*x).a) < ((*y).a)); } +#[inline] pub unsafe fn operator_add_5(x: *const Inline, y: *const Inline) -> Inline { return Inline { a: (((*x).a) + ((*y).a)), @@ -118,12 +124,15 @@ pub unsafe fn operator_ne_7(x: *const OutOfLine, y: *const OutOfLine) -> bool { operator_eq_6(_x, _y) }); } +#[inline] pub unsafe fn operator_eq_8(x: *const Tmpl_int_, y: *const Tmpl_int_) -> bool { return (((*x).v) == ((*y).v)); } +#[inline] pub unsafe fn operator_lt_9(x: *const Tmpl_int_, y: *const Tmpl_int_) -> bool { return (((*x).v) < ((*y).v)); } +#[inline] pub unsafe fn operator_eq_10(x: *const Tmpl_int_, y: *const Tmpl_long_) -> bool { return (((*x).v as i64) == ((*y).v)); } @@ -161,6 +170,7 @@ impl std::cmp::Eq for Tmpl_int_ {} pub struct Tmpl_long_ { pub v: i64, } +#[inline] pub unsafe fn operator_eq_11( _a0: *const TmplDefaulted_int_, _a1: *const TmplDefaulted_int_, diff --git a/tests/unit/out/unsafe/operator_less_than.rs b/tests/unit/out/unsafe/operator_less_than.rs index dfaccf1e4..d4c62603f 100644 --- a/tests/unit/out/unsafe/operator_less_than.rs +++ b/tests/unit/out/unsafe/operator_less_than.rs @@ -13,6 +13,7 @@ pub struct Pair { pub y: i32, } impl Pair { + #[inline] pub unsafe fn operator_lt(&mut self, other: *const Pair) -> bool { return ((self.x) < ((*other).x)) || (((self.x) == ((*other).x)) && ((self.y) < ((*other).y))); diff --git a/tests/unit/out/unsafe/operator_logical_member.rs b/tests/unit/out/unsafe/operator_logical_member.rs index 2a853247b..4a6dbe9c5 100644 --- a/tests/unit/out/unsafe/operator_logical_member.rs +++ b/tests/unit/out/unsafe/operator_logical_member.rs @@ -12,12 +12,15 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_not(&self) -> bool { return ((self.v) == (0)); } + #[inline] pub unsafe fn operator_and(&self, o: *const S) -> bool { return ((self.v) != (0)) && (((*o).v) != (0)); } + #[inline] pub unsafe fn operator_or(&self, o: *const S) -> bool { return ((self.v) != (0)) || (((*o).v) != (0)); } diff --git a/tests/unit/out/unsafe/operator_member_pointer_member.rs b/tests/unit/out/unsafe/operator_member_pointer_member.rs index 1b11d628c..0d6cde9d6 100644 --- a/tests/unit/out/unsafe/operator_member_pointer_member.rs +++ b/tests/unit/out/unsafe/operator_member_pointer_member.rs @@ -15,6 +15,7 @@ pub struct Inner { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Table {} impl Table { + #[inline] pub unsafe fn operator_index(mut i: i32) -> *mut i32 { return &mut (*std::cell::LazyCell::force_mut(&mut *&raw mut table_0))[(i) as usize]; } @@ -28,18 +29,23 @@ pub struct S { pub inner: Inner, } impl S { + #[inline] pub unsafe fn operator_index_1(&mut self, mut i: i32) -> *mut i32 { return &mut self.data[(i) as usize]; } + #[inline] pub unsafe fn operator_index_2(&self, mut i: i32) -> *const i32 { return &self.data[(i) as usize]; } + #[inline] pub unsafe fn operator_deref(&mut self) -> *mut Inner { return &mut self.inner; } + #[inline] pub unsafe fn operator_arrow(&mut self) -> *mut Inner { return (&mut self.inner as *mut Inner); } + #[inline] pub unsafe fn operator_addr(&mut self) -> *mut i32 { return (&mut self.data[(0) as usize] as *mut i32); } diff --git a/tests/unit/out/unsafe/operator_other_member.rs b/tests/unit/out/unsafe/operator_other_member.rs index f7232e2e1..4e5d97702 100644 --- a/tests/unit/out/unsafe/operator_other_member.rs +++ b/tests/unit/out/unsafe/operator_other_member.rs @@ -10,6 +10,7 @@ use std::rc::Rc; #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Static {} impl Static { + #[inline] pub unsafe fn operator_call(mut a: i32, mut b: i32) -> i32 { return ((a) * (b)); } @@ -21,23 +22,29 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_call_1(&self) -> i32 { return self.v; } + #[inline] pub unsafe fn operator_call_2(&self, mut a: i32) -> i32 { return ((self.v) + (a)); } + #[inline] pub unsafe fn operator_call_3(&self, mut a: i32, mut b: i32) -> i32 { return (((self.v) + (a)) + (b)); } + #[inline] pub unsafe fn operator_comma(&self, o: *const S) -> S { return S { v: (((self.v) * (10)) + ((*o).v)), }; } + #[inline] pub unsafe fn to_i32(&self) -> i32 { return self.v; } + #[inline] pub unsafe fn to_bool(&self) -> bool { return ((self.v) != (0)); } diff --git a/tests/unit/out/unsafe/operator_overloads.rs b/tests/unit/out/unsafe/operator_overloads.rs index bf5aa7cd8..cfb52b0aa 100644 --- a/tests/unit/out/unsafe/operator_overloads.rs +++ b/tests/unit/out/unsafe/operator_overloads.rs @@ -12,24 +12,31 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_eq_1(&self, mut o: i32) -> i32 { return if ((self.v) == (o)) { 1 } else { 0 }; } + #[inline] pub unsafe fn operator_eq_2(&self, mut o: i64) -> i32 { return if ((self.v as i64) == (o)) { 2 } else { 0 }; } + #[inline] pub unsafe fn operator_eq_3(&self, mut o: f64) -> i32 { return if ((self.v as f64) == (o)) { 3 } else { 0 }; } + #[inline] pub unsafe fn operator_add(&self, o: *const S) -> i32 { return ((self.v) + ((*o).v)); } + #[inline] pub unsafe fn operator_sub(&self, mut o: S) -> i32 { return ((self.v) - (o.v)); } + #[inline] pub unsafe fn operator_mul_6(&self, o: *const S) -> i32 { return ((self.v) * ((*o).v)); } + #[inline] pub unsafe fn operator_mul_7(&self, mut o: i32) -> i32 { return (((self.v) * (o)) + (1)); } diff --git a/tests/unit/out/unsafe/operator_qualifiers.rs b/tests/unit/out/unsafe/operator_qualifiers.rs index cf52c67d9..a9f163af8 100644 --- a/tests/unit/out/unsafe/operator_qualifiers.rs +++ b/tests/unit/out/unsafe/operator_qualifiers.rs @@ -12,30 +12,39 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_add_1(&mut self, mut a: i32) -> i32 { return ((self.v) + (a)); } + #[inline] pub unsafe fn operator_add_2(&self, mut a: i32) -> i32 { return (((self.v) + (a)) + (1)); } + #[inline] pub unsafe fn operator_add_3(&mut self, mut a: i32) -> i32 { return (((self.v) + (a)) + (2)); } + #[inline] pub unsafe fn operator_sub_4(&mut self, mut a: i32) -> i32 { return ((self.v) - (a)); } + #[inline] pub unsafe fn operator_sub_5(&mut self, mut a: i32) -> i32 { return (((self.v) - (a)) - (1)); } + #[inline] pub unsafe fn operator_mul_6(&self, mut a: i32) -> i32 { return ((self.v) * (a)); } + #[inline] pub unsafe fn operator_mul_7(&self, mut a: i32) -> i32 { return (((self.v) * (a)) * (2)); } + #[inline] pub unsafe fn operator_index_8(&mut self, mut i: i32) -> i32 { return ((self.v) + (i)); } + #[inline] pub unsafe fn operator_index_9(&self, mut i: i32) -> i32 { return (((self.v) + (i)) + (100)); } diff --git a/tests/unit/out/unsafe/operator_three_way.rs b/tests/unit/out/unsafe/operator_three_way.rs index b92a6d324..3c2dd79ce 100644 --- a/tests/unit/out/unsafe/operator_three_way.rs +++ b/tests/unit/out/unsafe/operator_three_way.rs @@ -12,6 +12,7 @@ pub struct S { pub v: i32, } impl S { + #[inline] pub unsafe fn operator_cmp(&self, o: *const S) -> std::cmp::Ordering { if ((self.v) < ((*o).v)) { return std::cmp::Ordering::Less; @@ -21,6 +22,7 @@ impl S { } return std::cmp::Ordering::Equal; } + #[inline] pub unsafe fn operator_eq(&self, o: *const S) -> bool { return ((self.v) == ((*o).v)); } diff --git a/tests/unit/out/unsafe/operator_traits.rs b/tests/unit/out/unsafe/operator_traits.rs index b44889ef2..bbf7bb939 100644 --- a/tests/unit/out/unsafe/operator_traits.rs +++ b/tests/unit/out/unsafe/operator_traits.rs @@ -12,6 +12,7 @@ pub struct Lt { pub v: i32, } impl Lt { + #[inline] pub unsafe fn operator_lt(&self, o: *const Lt) -> bool { return ((self.v) < ((*o).v)); } @@ -49,6 +50,7 @@ pub struct Eq { pub v: i32, } impl Eq { + #[inline] pub unsafe fn operator_eq(&self, o: *const Eq) -> bool { return ((self.v) == ((*o).v)); } @@ -65,9 +67,11 @@ pub struct Cmp { pub v: i32, } impl Cmp { + #[inline] pub unsafe fn operator_cmp(&self, o: *const Cmp) -> std::cmp::Ordering { return std::cmp::Ord::cmp(&(self.v), &((*o).v)); } + #[inline] pub unsafe fn operator_eq(&self, o: *const Cmp) -> bool { return ((self.v) == ((*o).v)); } diff --git a/tests/unit/out/unsafe/overload_mangling.rs b/tests/unit/out/unsafe/overload_mangling.rs index 5a2b0d164..bf33ff5f3 100644 --- a/tests/unit/out/unsafe/overload_mangling.rs +++ b/tests/unit/out/unsafe/overload_mangling.rs @@ -19,15 +19,19 @@ pub unsafe fn twice_2(mut n: i32) -> i32 { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Access_S_ {} impl Access_S_ { + #[inline] pub unsafe fn get_1(&mut self, mut p: *mut S) -> i32 { return (*p).base; } + #[inline] pub unsafe fn get_2(&mut self, mut p: *const S) -> i32 { return (((*p).base) + (1)); } + #[inline] pub unsafe fn ref_3(&mut self, r: *mut S) -> i32 { return (((*r).base) + (2)); } + #[inline] pub unsafe fn ref_4(&mut self, r: *const S) -> i32 { return (((*r).base) + (3)); } @@ -38,35 +42,45 @@ pub struct S { pub base: i32, } impl S { + #[inline] pub unsafe fn plain_4(&self, mut x: i32) -> i32 { return ((self.base) + (x)); } + #[inline] pub unsafe fn plain_5(&self, mut x: i64) -> i32 { return (((self.base) + (x as i32)) + (1)); } + #[inline] pub unsafe fn take_6(&self, x: *mut i32) -> i32 { return (((self.base) + (*x)) + (1)); } + #[inline] pub unsafe fn take_7(&self, x: *mut i32) -> i32 { return (((self.base) + (*x)) + (2)); } + #[inline] pub unsafe fn pick_8(&self, mut p: (i32, i32)) -> i32 { return ((self.base) + (p.0)); } + #[inline] pub unsafe fn pick_9(&self, mut p: (i32, i64)) -> i32 { return ((self.base) + (p.1 as i32)); } + #[inline] pub unsafe fn apply_10(&self, mut f: Option, mut x: i32) -> i32 { (unsafe { (f).unwrap()((&mut x as *mut i32)) }); return ((self.base) + (x)); } + #[inline] pub unsafe fn apply_11(&self, mut f: Option, mut x: i32) -> i32 { (unsafe { (f).unwrap()((&mut x as *mut i32), 10) }); return ((self.base) + (x)); } + #[inline] pub unsafe fn apply_12(&self, mut f: Option i32>, mut x: i32) -> i32 { return ((self.base) + (unsafe { (f).unwrap()(x) })); } + #[inline] pub unsafe fn combine_13( &self, p: *const (i32, i64), @@ -76,6 +90,7 @@ impl S { ) -> i32 { return ((((self.base) + ((*p).1 as i32)) + (unsafe { (f).unwrap()((*q)) })) + (n as i32)); } + #[inline] pub unsafe fn combine_14( &self, p: *const (i32, i32), @@ -90,21 +105,27 @@ impl S { }); return (((self.base) + ((*p).0)) + (*q)); } + #[inline] pub unsafe fn width_1_char(&self, mut x: i32) -> i32 { return ((self.base) + ((x) * (::std::mem::size_of::() as i32))); } + #[inline] pub unsafe fn width_1_int(&self, mut x: i32) -> i32 { return ((self.base) + ((x) * (::std::mem::size_of::() as i32))); } + #[inline] pub unsafe fn scale_2_2(&self, mut x: i32) -> i32 { return ((self.base) + ((x) * (2))); } + #[inline] pub unsafe fn scale_2_3(&self, mut x: i32) -> i32 { return ((self.base) + ((x) * (3))); } + #[inline] pub unsafe fn count_3(&self, mut x: i32) -> i32 { return (((self.base) + (x)) + (0 as i32)); } + #[inline] pub unsafe fn count_3_int_long(&self, mut x: i32) -> i32 { return (((self.base) + (x)) + (2 as i32)); } diff --git a/tests/unit/out/unsafe/pair_converting_construction.rs b/tests/unit/out/unsafe/pair_converting_construction.rs index 806bbee6e..d9200d7b8 100644 --- a/tests/unit/out/unsafe/pair_converting_construction.rs +++ b/tests/unit/out/unsafe/pair_converting_construction.rs @@ -13,6 +13,7 @@ pub struct Celsius { pub degrees: i32, } impl Celsius { + #[inline] pub unsafe fn new(mut d: i32) -> Self { let mut this = Self { degrees: d }; this @@ -25,6 +26,7 @@ pub struct Meters { pub value: i32, } impl Meters { + #[inline] pub unsafe fn to_i32(&self) -> i32 { return self.value; } @@ -36,6 +38,7 @@ pub struct Label { pub id: i32, } impl Label { + #[inline] pub unsafe fn new(c: *const Celsius) -> Self { let mut this = Self { id: (*c).degrees }; this @@ -50,6 +53,7 @@ pub struct Owner { pub copied: i32, } impl Owner { + #[inline] pub unsafe fn new_1(c: *const Celsius) -> Self { let mut this = Self { taken: 0, @@ -57,6 +61,7 @@ impl Owner { }; this } + #[inline] pub unsafe fn new_2(c: *mut Celsius) -> Self { let mut this = Self { taken: (*c).degrees, @@ -72,6 +77,7 @@ pub struct Holder { pub value: i32, } impl Holder { + #[inline] pub unsafe fn new(mut c: Celsius) -> Self { let mut this = Self { value: c.degrees }; this @@ -84,6 +90,7 @@ pub struct Fallback { pub value: i32, } impl Fallback { + #[inline] pub unsafe fn new(mut v: Option) -> Self { let mut v: i32 = v.unwrap_or_else(|| unsafe { -1_i32 }); let mut this = Self { value: v }; @@ -107,6 +114,7 @@ pub struct Observer { pub seen: i32, } impl Observer { + #[inline] pub unsafe fn new(c: *mut Counter) -> Self { let mut this = Self { seen: (*c).hits }; (*c).hits.postfix_inc(); @@ -114,6 +122,7 @@ impl Observer { } } impl Tag { + #[inline] pub unsafe fn new(u: *const Celsius) -> Self { let mut this = Self { code: (((*u).degrees) + (100)), @@ -134,6 +143,7 @@ pub struct Name { pub len: i32, } impl Name { + #[inline] pub unsafe fn new(mut s: *const libc::c_char) -> Self { let mut this = Self { len: 0 }; 'loop_: while ((*s.offset((this.len) as isize)) != 0) { diff --git a/tests/unit/out/unsafe/pointers.rs b/tests/unit/out/unsafe/pointers.rs index 7f8b04ccd..730d42efb 100644 --- a/tests/unit/out/unsafe/pointers.rs +++ b/tests/unit/out/unsafe/pointers.rs @@ -12,15 +12,19 @@ pub struct Test { pub x: i32, } impl Test { + #[inline] pub unsafe fn inc(&mut self) { self.x.postfix_inc(); } + #[inline] pub unsafe fn dec(&mut self) { self.x.postfix_dec(); } + #[inline] pub unsafe fn as_ptr(&mut self) -> *mut i32 { return (&mut self.x as *mut i32); } + #[inline] pub unsafe fn update(&mut self, mut x: i32, mut y: i32) { self.x = ((x) + (y)); } diff --git a/tests/unit/out/unsafe/polymorphism.rs b/tests/unit/out/unsafe/polymorphism.rs index 0e2324375..ce9fe7d67 100644 --- a/tests/unit/out/unsafe/polymorphism.rs +++ b/tests/unit/out/unsafe/polymorphism.rs @@ -16,6 +16,7 @@ pub struct Dog {} #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct Cat {} impl Cat { + #[inline] unsafe fn meow(&self) -> bool { return true; } @@ -37,11 +38,13 @@ unsafe fn main_0() -> i32 { return 0; } unsafe impl Animal for Cat { + #[inline] unsafe fn bark(&self) -> bool { return false; } } unsafe impl Animal for Dog { + #[inline] unsafe fn bark(&self) -> bool { return true; } diff --git a/tests/unit/out/unsafe/push_emplace_back.rs b/tests/unit/out/unsafe/push_emplace_back.rs index 7be6ac68a..0b9fb6003 100644 --- a/tests/unit/out/unsafe/push_emplace_back.rs +++ b/tests/unit/out/unsafe/push_emplace_back.rs @@ -24,6 +24,7 @@ pub struct JPEGData { pub app_data: Vec>, } impl JPEGData { + #[inline] pub unsafe fn move_from(_a0: *mut JPEGData) -> Self { let mut this = Self { com_data: std::mem::take(&mut (*_a0).com_data), @@ -31,6 +32,7 @@ impl JPEGData { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut JPEGData) -> *mut JPEGData { self.com_data = std::mem::take(&mut (*_a0).com_data); self.app_data = std::mem::take(&mut (*_a0).app_data); @@ -118,6 +120,7 @@ pub struct Pair { pub second: i32, } impl Pair { + #[inline] pub unsafe fn new_2() -> Self { let mut this = Self { first: -1_i32, @@ -125,6 +128,7 @@ impl Pair { }; this } + #[inline] pub unsafe fn new_1(mut a: i32) -> Self { let mut this = Self { first: a, @@ -132,6 +136,7 @@ impl Pair { }; this } + #[inline] pub unsafe fn new_3(mut a: i32, mut b: i32) -> Self { let mut this = Self { first: a, diff --git a/tests/unit/out/unsafe/random.rs b/tests/unit/out/unsafe/random.rs index c1f55cb03..f93a1ff50 100644 --- a/tests/unit/out/unsafe/random.rs +++ b/tests/unit/out/unsafe/random.rs @@ -18,6 +18,7 @@ pub struct Pair { pub ap: [*mut i32; 2], } impl Pair { + #[inline] pub unsafe fn method(&mut self) { self.x.postfix_inc(); self.y.prefix_inc(); @@ -27,12 +28,15 @@ impl Pair { self.pair = std::ptr::null_mut(); self.ap[(0) as usize] = std::ptr::null_mut(); } + #[inline] pub unsafe fn as_val(&mut self) -> i32 { return self.x; } + #[inline] pub unsafe fn as_ref(&mut self) -> *mut i32 { return &mut self.x; } + #[inline] pub unsafe fn as_ptr(&mut self) -> *mut i32 { return (&mut self.x as *mut i32); } diff --git a/tests/unit/out/unsafe/rule_of_five.rs b/tests/unit/out/unsafe/rule_of_five.rs index 7eeff4375..893c55b69 100644 --- a/tests/unit/out/unsafe/rule_of_five.rs +++ b/tests/unit/out/unsafe/rule_of_five.rs @@ -26,6 +26,7 @@ pub struct Buffer { pub size: i32, } impl Buffer { + #[inline] pub unsafe fn new(mut size: i32) -> Self { let mut this = Self { data: [0_i32; 4], @@ -39,9 +40,11 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut alive_0)).prefix_inc(); this } + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut alive_0)).prefix_dec(); } + #[inline] pub unsafe fn copy_from(o: *const Buffer) -> Self { let mut this = Self { data: [0_i32; 4], @@ -56,6 +59,7 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_1)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Buffer) -> Self { let mut this = Self { data: [0_i32; 4], @@ -72,6 +76,7 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut moves_2)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Buffer) -> *mut Buffer { if (((self as *mut Buffer).cast_const()) == (o)) { return &mut (*(self as *mut Buffer)); @@ -85,6 +90,7 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_1)).prefix_inc(); return &mut (*(self as *mut Buffer)); } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut Buffer) -> *mut Buffer { if ((self as *mut Buffer) == (o)) { return &mut (*(self as *mut Buffer)); diff --git a/tests/unit/out/unsafe/rule_of_three.rs b/tests/unit/out/unsafe/rule_of_three.rs index ceeea0002..31ca1ec02 100644 --- a/tests/unit/out/unsafe/rule_of_three.rs +++ b/tests/unit/out/unsafe/rule_of_three.rs @@ -16,6 +16,7 @@ pub struct Buffer { pub size: i32, } impl Buffer { + #[inline] pub unsafe fn new(mut size: i32) -> Self { let mut this = Self { data: [0_i32; 4], @@ -29,9 +30,11 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut alive_0)).prefix_inc(); this } + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut alive_0)).prefix_dec(); } + #[inline] pub unsafe fn copy_from(o: *const Buffer) -> Self { let mut this = Self { data: [0_i32; 4], @@ -46,6 +49,7 @@ impl Buffer { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_1)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Buffer) -> *mut Buffer { if (((self as *mut Buffer).cast_const()) == (o)) { return &mut (*(self as *mut Buffer)); diff --git a/tests/unit/out/unsafe/rvalue_rule_arg_move.rs b/tests/unit/out/unsafe/rvalue_rule_arg_move.rs index d973c000b..0f38b253a 100644 --- a/tests/unit/out/unsafe/rvalue_rule_arg_move.rs +++ b/tests/unit/out/unsafe/rvalue_rule_arg_move.rs @@ -15,20 +15,24 @@ pub struct Elem { pub v: i32, } impl Elem { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Elem) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Elem) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut moves_1)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Elem) -> *mut Elem { self.v = (*_a0).v; return &mut (*(self as *mut Elem)); diff --git a/tests/unit/out/unsafe/rvalue_struct.rs b/tests/unit/out/unsafe/rvalue_struct.rs index 4e63a7151..8810ac2a6 100644 --- a/tests/unit/out/unsafe/rvalue_struct.rs +++ b/tests/unit/out/unsafe/rvalue_struct.rs @@ -13,6 +13,7 @@ pub struct S { pub b: i32, } impl S { + #[inline] pub unsafe fn new(mut a: i32, mut b: i32) -> Self { let mut this = Self { a: a, b: b }; this diff --git a/tests/unit/out/unsafe/size_t_template_param.rs b/tests/unit/out/unsafe/size_t_template_param.rs index 70248f463..b445fa2e8 100644 --- a/tests/unit/out/unsafe/size_t_template_param.rs +++ b/tests/unit/out/unsafe/size_t_template_param.rs @@ -17,6 +17,7 @@ pub struct PtrCtor_unsigned_long_ { pub v: u64, } impl PtrCtor_unsigned_long_ { + #[inline] pub unsafe fn new(mut p: *const u64) -> Self { let mut this = Self { v: (*p.offset((1) as isize)), @@ -31,6 +32,7 @@ pub struct RefCtor_unsigned_long_ { pub v: u64, } impl RefCtor_unsigned_long_ { + #[inline] pub unsafe fn new(x: *const u64) -> Self { let mut this = Self { v: (*x).wrapping_add(1_u64), diff --git a/tests/unit/out/unsafe/sort_no_copy.rs b/tests/unit/out/unsafe/sort_no_copy.rs index ebd4f6044..46ebaf7ef 100644 --- a/tests/unit/out/unsafe/sort_no_copy.rs +++ b/tests/unit/out/unsafe/sort_no_copy.rs @@ -14,28 +14,34 @@ pub struct Tracked { pub v: i32, } impl Tracked { + #[inline] pub unsafe fn new_2() -> Self { let mut this = Self { v: 0 }; this } + #[inline] pub unsafe fn new_1(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v }; this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Tracked) -> *mut Tracked { self.v = (*o).v; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); return &mut (*(self as *mut Tracked)); } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut Tracked) -> *mut Tracked { self.v = (*o).v; return &mut (*(self as *mut Tracked)); @@ -90,12 +96,14 @@ pub struct Bag { pub items: Vec, } impl Bag { + #[inline] pub unsafe fn move_from(_a0: *mut Bag) -> Self { let mut this = Self { items: std::mem::take(&mut (*_a0).items), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Bag) -> *mut Bag { self.items = std::mem::take(&mut (*_a0).items); return &mut (*(self as *mut Bag)); diff --git a/tests/unit/out/unsafe/static_local.rs b/tests/unit/out/unsafe/static_local.rs index 15b480a54..fab4ab53b 100644 --- a/tests/unit/out/unsafe/static_local.rs +++ b/tests/unit/out/unsafe/static_local.rs @@ -25,6 +25,7 @@ static mut x_7: std::cell::LazyCell = std::cell::LazyCell::new(|| unsafe { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct S_8 {} impl S_8 { + #[inline] pub unsafe fn get(&self) -> i32 { return (*std::cell::LazyCell::force_mut(&mut *&raw mut x_7)).prefix_inc(); } diff --git a/tests/unit/out/unsafe/static_var_in_class.rs b/tests/unit/out/unsafe/static_var_in_class.rs index f7001c0fc..e8be30ae2 100644 --- a/tests/unit/out/unsafe/static_var_in_class.rs +++ b/tests/unit/out/unsafe/static_var_in_class.rs @@ -11,6 +11,7 @@ static mut inner_const_0: std::cell::LazyCell = std::cell::LazyCell::new(|| #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct C {} impl C { + #[inline] pub unsafe fn get(&mut self) -> i32 { return (*std::cell::LazyCell::force_mut(&mut *&raw mut inner_const_0)); } @@ -22,6 +23,7 @@ pub const anon_3_kValue: anon_3 = 3; #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct S {} impl S { + #[inline] pub unsafe fn f() -> i32 { return (*std::cell::LazyCell::force_mut(&mut *&raw mut counter_2)); } diff --git a/tests/unit/out/unsafe/stdcopy.rs b/tests/unit/out/unsafe/stdcopy.rs index 2ef8e4d22..9472d7ed1 100644 --- a/tests/unit/out/unsafe/stdcopy.rs +++ b/tests/unit/out/unsafe/stdcopy.rs @@ -13,6 +13,7 @@ pub struct Degrees { pub value: i32, } impl Degrees { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { value: v }; this diff --git a/tests/unit/out/unsafe/struct_ctor.rs b/tests/unit/out/unsafe/struct_ctor.rs index 3e63641a7..26a5da408 100644 --- a/tests/unit/out/unsafe/struct_ctor.rs +++ b/tests/unit/out/unsafe/struct_ctor.rs @@ -13,15 +13,18 @@ pub struct StructWithCtor { x2_: i32, } impl StructWithCtor { + #[inline] pub unsafe fn new(mut x1: i32, mut x2: i32) -> Self { let mut this = Self { x1_: x1, x2_: x2 }; this.x1_.prefix_inc(); this.x2_.prefix_dec(); this } + #[inline] pub unsafe fn x1(&self) -> *const i32 { return &self.x1_; } + #[inline] pub unsafe fn x2(&self) -> *const i32 { return &self.x2_; } @@ -36,6 +39,7 @@ pub struct Value_ { pub v: i32, } impl Value_ { + #[inline] pub unsafe fn new(mut u: i32) -> Self { let mut this = Self { v: u }; this @@ -48,6 +52,7 @@ pub struct Ptr_ { pub v2: Value_, } impl Ptr_ { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { v1: Value_::new({ 11 }), diff --git a/tests/unit/out/unsafe/struct_default_ctor.rs b/tests/unit/out/unsafe/struct_default_ctor.rs index bdcc7d4a6..7ba55b7b1 100644 --- a/tests/unit/out/unsafe/struct_default_ctor.rs +++ b/tests/unit/out/unsafe/struct_default_ctor.rs @@ -13,6 +13,7 @@ pub struct S { pub b: bool, } impl S { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { a: 11, b: true }; this diff --git a/tests/unit/out/unsafe/structured_binding_copy_ctor.rs b/tests/unit/out/unsafe/structured_binding_copy_ctor.rs index cdbeebc6b..d82fa013e 100644 --- a/tests/unit/out/unsafe/structured_binding_copy_ctor.rs +++ b/tests/unit/out/unsafe/structured_binding_copy_ctor.rs @@ -14,10 +14,12 @@ pub struct Counted { pub y: i32, } impl Counted { + #[inline] pub unsafe fn new(mut x: i32, mut y: i32) -> Self { let mut this = Self { x: x, y: y }; this } + #[inline] pub unsafe fn copy_from(other: *const Counted) -> Self { let mut this = Self { x: (((*other).x) * (2)), @@ -26,6 +28,7 @@ impl Counted { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Counted) -> *mut Counted { self.x = (*_a0).x; self.y = (*_a0).y; diff --git a/tests/unit/out/unsafe/structured_binding_element_ctor.rs b/tests/unit/out/unsafe/structured_binding_element_ctor.rs index 5db619669..b59cff140 100644 --- a/tests/unit/out/unsafe/structured_binding_element_ctor.rs +++ b/tests/unit/out/unsafe/structured_binding_element_ctor.rs @@ -15,10 +15,12 @@ pub struct Elem { pub v: i32, } impl Elem { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(other: *const Elem) -> Self { let mut this = Self { v: (((*other).v) + (100)), @@ -26,6 +28,7 @@ impl Elem { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(other: *mut Elem) -> Self { let mut this = Self { v: (((*other).v) + (1000)), @@ -47,6 +50,7 @@ pub struct Two { pub b: Elem, } impl Two { + #[inline] pub unsafe fn move_from(_a0: *mut Two) -> Self { let mut this = Self { a: Elem::move_from({ &mut (*_a0).a }), diff --git a/tests/unit/out/unsafe/structured_binding_move_ctor.rs b/tests/unit/out/unsafe/structured_binding_move_ctor.rs index 4aedbd57f..333a83aee 100644 --- a/tests/unit/out/unsafe/structured_binding_move_ctor.rs +++ b/tests/unit/out/unsafe/structured_binding_move_ctor.rs @@ -15,10 +15,12 @@ pub struct Movable { pub y: i32, } impl Movable { + #[inline] pub unsafe fn new(mut x: i32, mut y: i32) -> Self { let mut this = Self { x: x, y: y }; this } + #[inline] pub unsafe fn copy_from(other: *const Movable) -> Self { let mut this = Self { x: (*other).x, @@ -27,6 +29,7 @@ impl Movable { (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(other: *mut Movable) -> Self { let mut this = Self { x: (*other).x, @@ -50,12 +53,14 @@ pub struct Holder { pub ys: Vec, } impl Holder { + #[inline] pub unsafe fn extract(&mut self) -> Holder { return Holder { xs: std::mem::take(&mut self.xs), ys: std::mem::take(&mut self.ys), }; } + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { xs: std::mem::take(&mut (*_a0).xs), @@ -63,6 +68,7 @@ impl Holder { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.xs = std::mem::take(&mut (*_a0).xs); self.ys = std::mem::take(&mut (*_a0).ys); diff --git a/tests/unit/out/unsafe/swap_map_no_copy.rs b/tests/unit/out/unsafe/swap_map_no_copy.rs index 7078d0882..9b4e36bfe 100644 --- a/tests/unit/out/unsafe/swap_map_no_copy.rs +++ b/tests/unit/out/unsafe/swap_map_no_copy.rs @@ -14,28 +14,34 @@ pub struct Tracked { pub v: i32, } impl Tracked { + #[inline] pub unsafe fn new_2() -> Self { let mut this = Self { v: 0 }; this } + #[inline] pub unsafe fn new_1(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Tracked) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Tracked) -> Self { let mut this = Self { v: (*o).v }; this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Tracked) -> *mut Tracked { self.v = (*o).v; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); return &mut (*(self as *mut Tracked)); } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut Tracked) -> *mut Tracked { self.v = (*o).v; return &mut (*(self as *mut Tracked)); @@ -58,6 +64,7 @@ pub struct Pair { pub y: Tracked, } impl Pair { + #[inline] pub unsafe fn move_from(_a0: *mut Pair) -> Self { let mut this = Self { x: Tracked::move_from({ &mut (*_a0).x }), @@ -65,6 +72,7 @@ impl Pair { }; this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Pair) -> *mut Pair { (unsafe { let _o: *const Tracked = &(*_a0).x; @@ -76,6 +84,7 @@ impl Pair { }); return &mut (*(self as *mut Pair)); } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Pair) -> *mut Pair { (unsafe { let _o: *mut Tracked = &mut (*_a0).x; @@ -95,6 +104,7 @@ pub struct Arrays { pub b: [Tracked; 2], } impl Arrays { + #[inline] pub unsafe fn move_from(_a0: *mut Arrays) -> Self { let mut this = Self { a: std::array::from_fn::<_, 2, _>(|__i: usize| { @@ -106,6 +116,7 @@ impl Arrays { }; this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const Arrays) -> *mut Arrays { let mut __i0: usize = 0_usize; 'loop_: while ((__i0) != (2_usize)) { @@ -125,6 +136,7 @@ impl Arrays { } return &mut (*(self as *mut Arrays)); } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Arrays) -> *mut Arrays { let mut __i0: usize = 0_usize; 'loop_: while ((__i0) != (2_usize)) { @@ -156,18 +168,22 @@ pub struct CopyOnly { pub v: i32, } impl CopyOnly { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const CopyOnly) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copy_only_copies_1)).prefix_inc(); this } + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut copy_only_dtors_2)).prefix_inc(); } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const CopyOnly) -> *mut CopyOnly { self.v = (*o).v; (*std::cell::LazyCell::force_mut(&mut *&raw mut copy_only_copies_1)).prefix_inc(); @@ -186,6 +202,7 @@ pub struct CopyOnlyPair { pub y: CopyOnly, } impl CopyOnlyPair { + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const CopyOnlyPair) -> *mut CopyOnlyPair { (unsafe { let _o: *const CopyOnly = &(*_a0).x; @@ -223,32 +240,38 @@ pub struct Moved { pub v: i32, } impl Moved { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn copy_from(o: *const Moved) -> Self { let mut this = Self { v: (*o).v }; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); this } + #[inline] pub unsafe fn move_from(o: *mut Moved) -> Self { let mut this = Self { v: (*o).v }; (*o).v = -1_i32; (*std::cell::LazyCell::force_mut(&mut *&raw mut moves_3)).prefix_inc(); this } + #[inline] pub unsafe fn copy_assign(&mut self, o: *const Moved) -> *mut Moved { self.v = (*o).v; (*std::cell::LazyCell::force_mut(&mut *&raw mut copies_0)).prefix_inc(); return &mut (*(self as *mut Moved)); } + #[inline] pub unsafe fn move_assign(&mut self, o: *mut Moved) -> *mut Moved { self.v = (*o).v; (*o).v = -1_i32; (*std::cell::LazyCell::force_mut(&mut *&raw mut move_assigns_4)).prefix_inc(); return &mut (*(self as *mut Moved)); } + #[inline] pub unsafe fn destructor(&mut self) { (*std::cell::LazyCell::force_mut(&mut *&raw mut moved_dtors_5)).prefix_inc(); } @@ -274,6 +297,7 @@ pub struct MovedPair { pub y: Moved, } impl MovedPair { + #[inline] pub unsafe fn move_from(_a0: *mut MovedPair) -> Self { let mut this = Self { x: Moved::move_from({ &mut (*_a0).x }), @@ -281,6 +305,7 @@ impl MovedPair { }; this } + #[inline] pub unsafe fn copy_assign(&mut self, _a0: *const MovedPair) -> *mut MovedPair { (unsafe { let _o: *const Moved = &(*_a0).x; @@ -292,6 +317,7 @@ impl MovedPair { }); return &mut (*(self as *mut MovedPair)); } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut MovedPair) -> *mut MovedPair { (unsafe { let _o: *mut Moved = &mut (*_a0).x; @@ -329,10 +355,12 @@ pub struct Owner { pub p: Option>, } impl Owner { + #[inline] pub unsafe fn move_from(_a0: *mut Owner) -> Self { let mut this = Self { p: (*_a0).p.take() }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Owner) -> *mut Owner { self.p = (*_a0).p.take(); return &mut (*(self as *mut Owner)); diff --git a/tests/unit/out/unsafe/template_default_arg.rs b/tests/unit/out/unsafe/template_default_arg.rs index 9808d05df..652d1a5fa 100644 --- a/tests/unit/out/unsafe/template_default_arg.rs +++ b/tests/unit/out/unsafe/template_default_arg.rs @@ -13,10 +13,12 @@ pub struct A { pub v: i32, } impl A { + #[inline] pub unsafe fn new_2() -> Self { let mut this = Self { v: 1 }; this } + #[inline] pub unsafe fn new_1(mut v: i32) -> Self { let mut this = Self { v: v }; this @@ -33,6 +35,7 @@ pub struct B { pub v: i32, } impl B { + #[inline] pub unsafe fn new() -> Self { let mut this = Self { v: 2 }; this @@ -50,6 +53,7 @@ pub struct NoDefault { pub v: i32, } impl NoDefault { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this @@ -77,10 +81,12 @@ pub struct S_NoDefault_ { pub v: i32, } impl S_NoDefault_ { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { v: v }; this } + #[inline] pub unsafe fn get(&self, mut t: NoDefault) -> i32 { return ((self.v) + (t.v)); } diff --git a/tests/unit/out/unsafe/this.rs b/tests/unit/out/unsafe/this.rs index d6f623cbf..7d5dd9b78 100644 --- a/tests/unit/out/unsafe/this.rs +++ b/tests/unit/out/unsafe/this.rs @@ -14,6 +14,7 @@ pub struct S { pub self__: *mut S, } impl S { + #[inline] pub unsafe fn new_1(mut a: i32) -> Self { let mut this = Self { a_: a, @@ -21,6 +22,7 @@ impl S { }; this } + #[inline] pub unsafe fn new_2(mut a: i32, mut other: *mut S) -> Self { let mut this = Self { a_: a, @@ -33,6 +35,7 @@ impl S { } this } + #[inline] pub unsafe fn new_3(mut a: i32, mut other: *const S) -> Self { let mut this = Self { a_: a, @@ -43,37 +46,48 @@ impl S { } this } + #[inline] pub unsafe fn returns_this_reference(&mut self) -> *mut S { return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn returns_this_pointer(&mut self) -> *mut S { return (self as *mut S); } + #[inline] pub unsafe fn inc(&mut self) -> *mut S { self.a_.postfix_inc(); return &mut (*(self as *mut S)); } + #[inline] pub unsafe fn set_from_this(&mut self) { self.a_ = ((self.a_) + (1)); } + #[inline] pub unsafe fn get(&mut self) -> i32 { return self.a_; } + #[inline] pub unsafe fn twice(&mut self) -> i32 { return ((unsafe { S::get(self) }) * (2)); } + #[inline] pub unsafe fn link(&mut self) { self.self__ = (self as *mut S); } + #[inline] pub unsafe fn bump_me(&mut self) { (unsafe { bump_0((self as *mut S)) }); } + #[inline] pub unsafe fn cref(&self) -> *const S { return &(*(self as *const S)); } + #[inline] pub unsafe fn is(&self, mut o: *const S) -> bool { return ((o) == (self as *const S)); } + #[inline] pub unsafe fn destroy(&mut self) { { let __p = (self as *mut S); @@ -82,9 +96,11 @@ impl S { } }; } + #[inline] pub unsafe fn reset(&mut self) { (*(self as *mut S)) = S::new_1({ 0 }); } + #[inline] pub unsafe fn copy_if_different_const(&mut self, mut other: *const S) -> bool { if (((self as *mut S).cast_const()) == (other)) { return false; @@ -93,6 +109,7 @@ impl S { self.self__ = (*other).self__; return true; } + #[inline] pub unsafe fn copy_if_different(&mut self, mut other: *mut S) -> bool { if ((self as *mut S) == (other)) { return false; @@ -112,6 +129,7 @@ pub struct D { pub a_: i32, } impl D { + #[inline] pub unsafe fn new(mut a: i32) -> Self { let mut this = Self { a_: a }; this.a_ *= 2; diff --git a/tests/unit/out/unsafe/typedef-anon-struct.rs b/tests/unit/out/unsafe/typedef-anon-struct.rs index eb82dca43..0c7b073f3 100644 --- a/tests/unit/out/unsafe/typedef-anon-struct.rs +++ b/tests/unit/out/unsafe/typedef-anon-struct.rs @@ -18,12 +18,14 @@ pub struct Outer { pub runs: Vec, } impl Outer { + #[inline] pub unsafe fn move_from(_a0: *mut Outer) -> Self { let mut this = Self { runs: std::mem::take(&mut (*_a0).runs), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Outer) -> *mut Outer { self.runs = std::mem::take(&mut (*_a0).runs); return &mut (*(self as *mut Outer)); diff --git a/tests/unit/out/unsafe/unboxed_locals.rs b/tests/unit/out/unsafe/unboxed_locals.rs index c92d1b168..af3e54970 100644 --- a/tests/unit/out/unsafe/unboxed_locals.rs +++ b/tests/unit/out/unsafe/unboxed_locals.rs @@ -169,6 +169,7 @@ unsafe fn main_0() -> i32 { return 0; } unsafe impl Shape for Square { + #[inline] unsafe fn scale(&mut self, factor: i32) -> i32 { return ((factor) * (self.side)); } diff --git a/tests/unit/out/unsafe/unboxed_records.rs b/tests/unit/out/unsafe/unboxed_records.rs index b26a093eb..7a5679ee3 100644 --- a/tests/unit/out/unsafe/unboxed_records.rs +++ b/tests/unit/out/unsafe/unboxed_records.rs @@ -27,6 +27,7 @@ pub struct Counter { pub n: i32, } impl Counter { + #[inline] pub unsafe fn inc(&mut self) { self.n.prefix_inc(); } diff --git a/tests/unit/out/unsafe/unique_ptr.rs b/tests/unit/out/unsafe/unique_ptr.rs index ecf05f274..f21ad10e2 100644 --- a/tests/unit/out/unsafe/unique_ptr.rs +++ b/tests/unit/out/unsafe/unique_ptr.rs @@ -12,6 +12,7 @@ pub struct SafePointer { pub ptr: Option>, } impl SafePointer { + #[inline] pub unsafe fn inc(&mut self) { (*self .ptr @@ -19,12 +20,14 @@ impl SafePointer { .map_or(::std::ptr::null_mut(), |v| v as *const i32 as *mut i32)) .prefix_inc(); } + #[inline] pub unsafe fn move_from(_a0: *mut SafePointer) -> Self { let mut this = Self { ptr: (*_a0).ptr.take(), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut SafePointer) -> *mut SafePointer { self.ptr = (*_a0).ptr.take(); return &mut (*(self as *mut SafePointer)); diff --git a/tests/unit/out/unsafe/unique_ptr_const_deref.rs b/tests/unit/out/unsafe/unique_ptr_const_deref.rs index 0aeedf23c..faa703a7c 100644 --- a/tests/unit/out/unsafe/unique_ptr_const_deref.rs +++ b/tests/unit/out/unsafe/unique_ptr_const_deref.rs @@ -12,12 +12,14 @@ pub struct Holder { pub val: Option>, } impl Holder { + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { val: (*_a0).val.take(), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.val = (*_a0).val.take(); return &mut (*(self as *mut Holder)); diff --git a/tests/unit/out/unsafe/unique_ptr_field_reset.rs b/tests/unit/out/unsafe/unique_ptr_field_reset.rs index 119c4b91a..28ca07c96 100644 --- a/tests/unit/out/unsafe/unique_ptr_field_reset.rs +++ b/tests/unit/out/unsafe/unique_ptr_field_reset.rs @@ -18,6 +18,7 @@ pub struct Holder { pub n: i32, } impl Holder { + #[inline] pub unsafe fn set(&mut self, mut p: *mut Data) { { let _a0: *mut Data = p; @@ -28,6 +29,7 @@ impl Holder { } }; } + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { data: (*_a0).data.take(), @@ -35,6 +37,7 @@ impl Holder { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.data = (*_a0).data.take(); self.n = (*_a0).n; diff --git a/tests/unit/out/unsafe/unique_ptr_nested.rs b/tests/unit/out/unsafe/unique_ptr_nested.rs index 6d35cf2ba..95658e706 100644 --- a/tests/unit/out/unsafe/unique_ptr_nested.rs +++ b/tests/unit/out/unsafe/unique_ptr_nested.rs @@ -18,12 +18,14 @@ pub struct Outer { pub inner: Option>, } impl Outer { + #[inline] pub unsafe fn move_from(_a0: *mut Outer) -> Self { let mut this = Self { inner: (*_a0).inner.take(), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Outer) -> *mut Outer { self.inner = (*_a0).inner.take(); return &mut (*(self as *mut Outer)); diff --git a/tests/unit/out/unsafe/va_list_field.rs b/tests/unit/out/unsafe/va_list_field.rs index d895f9d4f..17d43d272 100644 --- a/tests/unit/out/unsafe/va_list_field.rs +++ b/tests/unit/out/unsafe/va_list_field.rs @@ -27,6 +27,7 @@ pub struct Guard_1 { pub active: bool, } impl Guard_1 { + #[inline] pub unsafe fn new(val: *mut *const VaArg) -> Self { let mut this = Self { ap: val, @@ -34,6 +35,7 @@ impl Guard_1 { }; this } + #[inline] pub unsafe fn destructor(&mut self) { if self.active {} } diff --git a/tests/unit/out/unsafe/vector_iter_range_ctor.rs b/tests/unit/out/unsafe/vector_iter_range_ctor.rs index d2c844b9c..5f340bed5 100644 --- a/tests/unit/out/unsafe/vector_iter_range_ctor.rs +++ b/tests/unit/out/unsafe/vector_iter_range_ctor.rs @@ -13,6 +13,7 @@ pub struct Degrees { pub value: i32, } impl Degrees { + #[inline] pub unsafe fn new(mut v: i32) -> Self { let mut this = Self { value: v }; this @@ -25,6 +26,7 @@ pub struct Reading { pub raw_: i32, } impl Reading { + #[inline] pub unsafe fn to_i64(&self) -> i64 { return ((self.raw_ as i64) * (10_i64)); } diff --git a/tests/unit/out/unsafe/vector_subscript_direct.rs b/tests/unit/out/unsafe/vector_subscript_direct.rs index 49704ecdb..f1c2415de 100644 --- a/tests/unit/out/unsafe/vector_subscript_direct.rs +++ b/tests/unit/out/unsafe/vector_subscript_direct.rs @@ -13,6 +13,7 @@ pub struct Point { pub y: i32, } impl Point { + #[inline] pub unsafe fn sum(&self) -> i32 { return ((self.x) + (self.y)); } @@ -24,6 +25,7 @@ pub struct Holder { pub points: Vec, } impl Holder { + #[inline] pub unsafe fn move_from(_a0: *mut Holder) -> Self { let mut this = Self { values: std::mem::take(&mut (*_a0).values), @@ -31,6 +33,7 @@ impl Holder { }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut Holder) -> *mut Holder { self.values = std::mem::take(&mut (*_a0).values); self.points = std::mem::take(&mut (*_a0).points); diff --git a/tests/unit/out/unsafe/vector_with_allocator.rs b/tests/unit/out/unsafe/vector_with_allocator.rs index 7ee97d609..1baa188b6 100644 --- a/tests/unit/out/unsafe/vector_with_allocator.rs +++ b/tests/unit/out/unsafe/vector_with_allocator.rs @@ -10,9 +10,11 @@ use std::rc::Rc; #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct TestAllocator_int_ {} impl TestAllocator_int_ { + #[inline] pub unsafe fn allocate(&mut self, mut n: usize) -> *mut i32 { return Box::leak((0..n).map(|_| 0_i32).collect::>()).as_mut_ptr(); } + #[inline] pub unsafe fn deallocate(&mut self, mut p: *mut i32, mut _a1: usize) { { let __p = p; @@ -30,9 +32,11 @@ impl TestAllocator_int_ { #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] pub struct TestAllocator_double_ {} impl TestAllocator_double_ { + #[inline] pub unsafe fn allocate(&mut self, mut n: usize) -> *mut f64 { return Box::leak((0..n).map(|_| 0_f64).collect::>()).as_mut_ptr(); } + #[inline] pub unsafe fn deallocate(&mut self, mut p: *mut f64, mut _a1: usize) { { let __p = p; diff --git a/tests/unit/out/unsafe/void_cast.rs b/tests/unit/out/unsafe/void_cast.rs index 376f2f519..558d1ef76 100644 --- a/tests/unit/out/unsafe/void_cast.rs +++ b/tests/unit/out/unsafe/void_cast.rs @@ -15,12 +15,14 @@ pub struct NonTrivial { pub data: Vec, } impl NonTrivial { + #[inline] pub unsafe fn move_from(_a0: *mut NonTrivial) -> Self { let mut this = Self { data: std::mem::take(&mut (*_a0).data), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut NonTrivial) -> *mut NonTrivial { self.data = std::mem::take(&mut (*_a0).data); return &mut (*(self as *mut NonTrivial)); @@ -49,12 +51,14 @@ pub struct NonCopyable { pub value: Option>, } impl NonCopyable { + #[inline] pub unsafe fn move_from(_a0: *mut NonCopyable) -> Self { let mut this = Self { value: (*_a0).value.take(), }; this } + #[inline] pub unsafe fn move_assign(&mut self, _a0: *mut NonCopyable) -> *mut NonCopyable { self.value = (*_a0).value.take(); return &mut (*(self as *mut NonCopyable)); diff --git a/tests/unit/out/unsafe/wide_char.rs b/tests/unit/out/unsafe/wide_char.rs index d79416f7c..97203953a 100644 --- a/tests/unit/out/unsafe/wide_char.rs +++ b/tests/unit/out/unsafe/wide_char.rs @@ -6,33 +6,43 @@ use std::collections::BTreeMap; use std::io::{Read, Seek, Write}; use std::os::fd::{AsFd, FromRawFd, IntoRawFd}; use std::rc::Rc; +#[inline] pub unsafe fn get_0(mut s: *const libc::c_char) -> *const libc::c_char { return s; } +#[inline] pub unsafe fn get_1(mut s: *const i32) -> *const i32 { return s; } +#[inline] pub unsafe fn get_2(mut s: *const u8) -> *const u8 { return s; } +#[inline] pub unsafe fn get_3(mut s: *const u16) -> *const u16 { return s; } +#[inline] pub unsafe fn get_4(mut s: *const u32) -> *const u32 { return s; } +#[inline] pub unsafe fn second_5(s: *const [libc::c_char; 3]) -> libc::c_char { return (*s)[(1) as usize]; } +#[inline] pub unsafe fn second_6(s: *const [i32; 3]) -> i32 { return (*s)[(1) as usize]; } +#[inline] pub unsafe fn second_7(s: *const [u8; 3]) -> u8 { return (*s)[(1) as usize]; } +#[inline] pub unsafe fn second_8(s: *const [u16; 3]) -> u16 { return (*s)[(1) as usize]; } +#[inline] pub unsafe fn second_9(s: *const [u32; 3]) -> u32 { return (*s)[(1) as usize]; } From 303e83da89ee8c821d279523c9d767acfc3bfa9e Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Thu, 5 Nov 2026 09:22:20 +0000 Subject: [PATCH 3/3] Drop unsupported derived to base cast --- tests/unit/inline_functions.cpp | 10 +--------- tests/unit/out/refcount/inline_functions.rs | 11 +---------- tests/unit/out/unsafe/inline_functions.rs | 11 +---------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/tests/unit/inline_functions.cpp b/tests/unit/inline_functions.cpp index 3812e4bb5..bdf8fb928 100644 --- a/tests/unit/inline_functions.cpp +++ b/tests/unit/inline_functions.cpp @@ -15,8 +15,6 @@ static int not_inlined_static_free(int a) { return a + 5; } class Base { public: virtual int inlined_override(int a) const = 0; - - virtual int not_inlined_override(int a) const = 0; }; class Derived : public Base { @@ -25,8 +23,6 @@ class Derived : public Base { int inlined_override(int a) const override { return v_ + a; } - int not_inlined_override(int a) const override; - int inlined_in_class() const { return v_ * 2; } static int inlined_static_in_class(int a) { return a * 3; } @@ -43,8 +39,6 @@ class Derived : public Base { int v_; }; -int Derived::not_inlined_override(int a) const { return v_ - a; } - int Derived::inlined_declared_in_class() const { return v_ * 4; } inline int Derived::inlined_defined_out_of_line() const { return v_ * 5; } @@ -55,14 +49,12 @@ int Derived::not_inlined_static_out_of_line(int a) { return a * 7; } int main() { Derived d(3); - const Base &b = d; assert(inlined_free(1) == 2); assert(inlined_constexpr_free(1) == 3); assert(inlined_declared_free(1) == 4); assert(not_inlined_free(1) == 5); assert(not_inlined_static_free(1) == 6); - assert(b.inlined_override(1) == 4); - assert(b.not_inlined_override(1) == 2); + assert(d.inlined_override(1) == 4); assert(d.inlined_in_class() == 6); assert(Derived::inlined_static_in_class(2) == 6); assert(d.inlined_declared_in_class() == 12); diff --git a/tests/unit/out/refcount/inline_functions.rs b/tests/unit/out/refcount/inline_functions.rs index 03a7e7b17..231abfd87 100644 --- a/tests/unit/out/refcount/inline_functions.rs +++ b/tests/unit/out/refcount/inline_functions.rs @@ -26,7 +26,6 @@ pub fn not_inlined_static_free_4(mut a: i32) -> i32 { } pub trait Base { fn inlined_override(&self, a: i32) -> i32; - fn not_inlined_override(&self, a: i32) -> i32; } #[derive(Clone, Record, ByteRepr, VaArg, FnPtrArg, Default)] #[byte_size(16)] @@ -55,14 +54,12 @@ pub fn main() { } fn main_0() -> i32 { let d: Value = Rc::new(RefCell::new(Derived::new({ 3 }))); - let b: Ptr = d.as_pointer(); assert!((({ inlined_free_0(1,) }) == 2)); assert!((({ inlined_constexpr_free_1(1,) }) == 3)); assert!((({ inlined_declared_free_2(1,) }) == 4)); assert!((({ not_inlined_free_3(1,) }) == 5)); assert!((({ not_inlined_static_free_4(1,) }) == 6)); - assert!(({ (({ (*b.upgrade().deref()).inlined_override(1,) }) == 4) })); - assert!(({ (({ (*b.upgrade().deref()).not_inlined_override(1,) }) == 2) })); + assert!(({ (({ (*d.borrow()).inlined_override(1,) }) == 4) })); assert!((({ DerivedImpl::inlined_in_class(&d.as_pointer(),) }) == 6)); assert!((({ Derived::inlined_static_in_class(2,) }) == 6)); assert!((({ DerivedImpl::inlined_declared_in_class(&d.as_pointer(),) }) == 12)); @@ -76,12 +73,6 @@ impl Base for Derived { fn inlined_override(&self, mut a: i32) -> i32 { return ({ self.v_ } + a); } - fn not_inlined_override(&self, mut a: i32) -> i32 { - return ({ self.v_ } - a); - } - fn not_inlined_override(&self, mut a: i32) -> i32 { - return ({ self.v_ } - a); - } } pub trait DerivedImpl { fn inlined_in_class(&self) -> i32; diff --git a/tests/unit/out/unsafe/inline_functions.rs b/tests/unit/out/unsafe/inline_functions.rs index a5c9c292e..0b7c65bda 100644 --- a/tests/unit/out/unsafe/inline_functions.rs +++ b/tests/unit/out/unsafe/inline_functions.rs @@ -26,7 +26,6 @@ pub unsafe fn not_inlined_static_free_4(mut a: i32) -> i32 { } pub unsafe trait Base { unsafe fn inlined_override(&self, a: i32) -> i32; - unsafe fn not_inlined_override(&self, a: i32) -> i32; } #[repr(C)] #[derive(Copy, Clone, VaArg, FnPtrArg, Default)] @@ -78,14 +77,12 @@ pub fn main() { } unsafe fn main_0() -> i32 { let mut d: Derived = Derived::new({ 3 }); - let b: *const Base = &d; assert!(((unsafe { inlined_free_0(1,) }) == (2))); assert!(((unsafe { inlined_constexpr_free_1(1,) }) == (3))); assert!(((unsafe { inlined_declared_free_2(1,) }) == (4))); assert!(((unsafe { not_inlined_free_3(1,) }) == (5))); assert!(((unsafe { not_inlined_static_free_4(1,) }) == (6))); - assert!(((unsafe { (*b).inlined_override(1,) }) == (4))); - assert!(((unsafe { (*b).not_inlined_override(1,) }) == (2))); + assert!(((unsafe { d.inlined_override(1,) }) == (4))); assert!(((unsafe { Derived::inlined_in_class(&d,) }) == (6))); assert!(((unsafe { Derived::inlined_static_in_class(2,) }) == (6))); assert!(((unsafe { Derived::inlined_declared_in_class(&d,) }) == (12))); @@ -99,11 +96,5 @@ unsafe impl Base for Derived { unsafe fn inlined_override(&self, a: i32) -> i32 { return ((self.v_) + (a)); } - unsafe fn not_inlined_override(&self, a: i32) -> i32 { - return ((self.v_) - (a)); - } - unsafe fn not_inlined_override(&self, a: i32) -> i32 { - return ((self.v_) - (a)); - } } pub unsafe fn __cpp2rust_init_globals() {}