Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 1 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 2 | // Exceptions. See /LICENSE for license information. |
| 3 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | |
Lukasz Anforowicz | 19e057d | 2022-10-28 12:03:23 -0700 | [diff] [blame] | 5 | // Automatically @generated Rust bindings for the following C++ target: |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 6 | // //rs_bindings_from_cc/test/golden:friend_functions_cc |
Devin Jeanpierre | 6ed0f60 | 2023-03-01 17:22:54 -0800 | [diff] [blame] | 7 | // Features: experimental, supported |
Lukasz Anforowicz | 19e057d | 2022-10-28 12:03:23 -0700 | [diff] [blame] | 8 | |
Devin Jeanpierre | 4335643 | 2023-01-13 12:39:02 -0800 | [diff] [blame] | 9 | #![rustfmt::skip] |
Devin Jeanpierre | 162d21f | 2023-11-21 15:14:00 -0800 | [diff] [blame] | 10 | #![feature(custom_inner_attributes, register_tool)] |
Devin Jeanpierre | 4335643 | 2023-01-13 12:39:02 -0800 | [diff] [blame] | 11 | #![allow(stable_features)] |
Googler | 61afe91 | 2023-03-03 13:59:15 -0800 | [diff] [blame] | 12 | #![no_std] |
Devin Jeanpierre | 162d21f | 2023-11-21 15:14:00 -0800 | [diff] [blame] | 13 | #![register_tool(__crubit)] |
Lukasz Anforowicz | 4bb78a7 | 2023-03-06 14:10:37 -0800 | [diff] [blame] | 14 | #![allow(improper_ctypes)] |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 15 | #![allow(non_camel_case_types)] |
| 16 | #![allow(non_snake_case)] |
| 17 | #![allow(non_upper_case_globals)] |
| 18 | #![deny(warnings)] |
| 19 | |
| 20 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 21 | // Exceptions. See /LICENSE for license information. |
| 22 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 23 | |
| 24 | #[derive(Clone, Copy)] |
| 25 | #[repr(C)] |
Devin Jeanpierre | 162d21f | 2023-11-21 15:14:00 -0800 | [diff] [blame] | 26 | #[__crubit::annotate(cc_type = "SomeClass")] |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 27 | pub struct SomeClass { |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 28 | __non_field_data: [::core::mem::MaybeUninit<u8>; 1], |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 29 | } |
| 30 | forward_declare::unsafe_define!(forward_declare::symbol!("SomeClass"), crate::SomeClass); |
| 31 | |
| 32 | impl Default for SomeClass { |
| 33 | #[inline(always)] |
| 34 | fn default() -> Self { |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 35 | let mut tmp = ::core::mem::MaybeUninit::<Self>::zeroed(); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 36 | unsafe { |
| 37 | crate::detail::__rust_thunk___ZN9SomeClassC1Ev(&mut tmp); |
| 38 | tmp.assume_init() |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 43 | impl<'b> From<::ctor::RvalueReference<'b, Self>> for SomeClass { |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 44 | #[inline(always)] |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 45 | fn from(__param_0: ::ctor::RvalueReference<'b, Self>) -> Self { |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 46 | let mut tmp = ::core::mem::MaybeUninit::<Self>::zeroed(); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 47 | unsafe { |
| 48 | crate::detail::__rust_thunk___ZN9SomeClassC1EOS_(&mut tmp, __param_0); |
| 49 | tmp.assume_init() |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
Googler | 7341f5e | 2023-01-31 14:37:12 -0800 | [diff] [blame] | 54 | impl<'b> ::ctor::UnpinAssign<&'b Self> for SomeClass { |
| 55 | #[inline(always)] |
| 56 | fn unpin_assign<'a>(&'a mut self, __param_0: &'b Self) { |
| 57 | unsafe { |
| 58 | crate::detail::__rust_thunk___ZN9SomeClassaSERKS_(self, __param_0); |
| 59 | } |
| 60 | } |
| 61 | } |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 62 | |
Googler | 7341f5e | 2023-01-31 14:37:12 -0800 | [diff] [blame] | 63 | impl<'b> ::ctor::UnpinAssign<::ctor::RvalueReference<'b, Self>> for SomeClass { |
| 64 | #[inline(always)] |
| 65 | fn unpin_assign<'a>(&'a mut self, __param_0: ::ctor::RvalueReference<'b, Self>) { |
| 66 | unsafe { |
| 67 | crate::detail::__rust_thunk___ZN9SomeClassaSEOS_(self, __param_0); |
| 68 | } |
| 69 | } |
| 70 | } |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 71 | |
| 72 | /// Friend functions that are visible via ADL. |
| 73 | #[inline(always)] |
Lukasz Anforowicz | 81b9687 | 2023-03-17 16:16:32 -0700 | [diff] [blame] | 74 | pub fn visible_val(mut __param_0: crate::SomeClass) { |
| 75 | unsafe { crate::detail::__rust_thunk___Z11visible_val9SomeClass(&mut __param_0) } |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | #[inline(always)] |
| 79 | pub fn visible_ref<'a>(__param_0: &'a mut crate::SomeClass) { |
| 80 | unsafe { crate::detail::__rust_thunk___Z11visible_refR9SomeClass(__param_0) } |
| 81 | } |
| 82 | |
| 83 | #[inline(always)] |
| 84 | pub fn visible_cref<'a>(__param_0: &'a crate::SomeClass) { |
| 85 | unsafe { crate::detail::__rust_thunk___Z12visible_crefRK9SomeClass(__param_0) } |
| 86 | } |
| 87 | |
| 88 | #[inline(always)] |
| 89 | pub fn visible_rref<'a>(__param_0: ::ctor::RvalueReference<'a, crate::SomeClass>) { |
| 90 | unsafe { crate::detail::__rust_thunk___Z12visible_rrefO9SomeClass(__param_0) } |
| 91 | } |
| 92 | |
Lukasz Anforowicz | 6216ea8 | 2022-08-31 09:31:59 -0700 | [diff] [blame] | 93 | /// A function can be declared multiple times - e.g. once in a friend |
| 94 | /// declaration below + in a definition below. This example mimics |
| 95 | /// Uint128Low64 declarations from absl/numeric/int128.h. This is a |
| 96 | /// regression test for b/244311755. |
| 97 | #[inline(always)] |
Lukasz Anforowicz | 460e427 | 2023-05-18 16:11:46 -0700 | [diff] [blame] | 98 | pub fn multiple_declarations<'a>(__param_0: &'a crate::SomeClass) -> ::core::ffi::c_int { |
Lukasz Anforowicz | 6216ea8 | 2022-08-31 09:31:59 -0700 | [diff] [blame] | 99 | unsafe { crate::detail::__rust_thunk___Z21multiple_declarationsRK9SomeClass(__param_0) } |
| 100 | } |
| 101 | |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 102 | // CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_FRIEND_FUNCTIONS_H_ |
| 103 | |
| 104 | mod detail { |
| 105 | #[allow(unused_imports)] |
| 106 | use super::*; |
| 107 | extern "C" { |
| 108 | pub(crate) fn __rust_thunk___ZN9SomeClassC1Ev<'a>( |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 109 | __this: &'a mut ::core::mem::MaybeUninit<crate::SomeClass>, |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 110 | ); |
| 111 | pub(crate) fn __rust_thunk___ZN9SomeClassC1EOS_<'a, 'b>( |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 112 | __this: &'a mut ::core::mem::MaybeUninit<crate::SomeClass>, |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 113 | __param_0: ::ctor::RvalueReference<'b, crate::SomeClass>, |
| 114 | ); |
Googler | 7341f5e | 2023-01-31 14:37:12 -0800 | [diff] [blame] | 115 | pub(crate) fn __rust_thunk___ZN9SomeClassaSERKS_<'a, 'b>( |
| 116 | __this: &'a mut crate::SomeClass, |
| 117 | __param_0: &'b crate::SomeClass, |
| 118 | ) -> &'a mut crate::SomeClass; |
| 119 | pub(crate) fn __rust_thunk___ZN9SomeClassaSEOS_<'a, 'b>( |
| 120 | __this: &'a mut crate::SomeClass, |
| 121 | __param_0: ::ctor::RvalueReference<'b, crate::SomeClass>, |
| 122 | ) -> &'a mut crate::SomeClass; |
Lukasz Anforowicz | 81b9687 | 2023-03-17 16:16:32 -0700 | [diff] [blame] | 123 | pub(crate) fn __rust_thunk___Z11visible_val9SomeClass(__param_0: &mut crate::SomeClass); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 124 | #[link_name = "_Z11visible_refR9SomeClass"] |
| 125 | pub(crate) fn __rust_thunk___Z11visible_refR9SomeClass<'a>( |
| 126 | __param_0: &'a mut crate::SomeClass, |
| 127 | ); |
| 128 | #[link_name = "_Z12visible_crefRK9SomeClass"] |
| 129 | pub(crate) fn __rust_thunk___Z12visible_crefRK9SomeClass<'a>( |
| 130 | __param_0: &'a crate::SomeClass, |
| 131 | ); |
| 132 | #[link_name = "_Z12visible_rrefO9SomeClass"] |
| 133 | pub(crate) fn __rust_thunk___Z12visible_rrefO9SomeClass<'a>( |
| 134 | __param_0: ::ctor::RvalueReference<'a, crate::SomeClass>, |
| 135 | ); |
Lukasz Anforowicz | 6216ea8 | 2022-08-31 09:31:59 -0700 | [diff] [blame] | 136 | pub(crate) fn __rust_thunk___Z21multiple_declarationsRK9SomeClass<'a>( |
| 137 | __param_0: &'a crate::SomeClass, |
Lukasz Anforowicz | 460e427 | 2023-05-18 16:11:46 -0700 | [diff] [blame] | 138 | ) -> ::core::ffi::c_int; |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 139 | } |
| 140 | } |
| 141 | |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 142 | const _: () = assert!(::core::mem::size_of::<Option<&i32>>() == ::core::mem::size_of::<&i32>()); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 143 | |
Googler | bed0a2a | 2023-03-01 11:53:43 -0800 | [diff] [blame] | 144 | const _: () = assert!(::core::mem::size_of::<crate::SomeClass>() == 1); |
| 145 | const _: () = assert!(::core::mem::align_of::<crate::SomeClass>() == 1); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 146 | const _: () = { |
Googler | 9e3ef6d | 2023-05-05 08:09:23 -0700 | [diff] [blame] | 147 | static_assertions::assert_impl_all!(crate::SomeClass:Clone); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 148 | }; |
| 149 | const _: () = { |
Googler | 9e3ef6d | 2023-05-05 08:09:23 -0700 | [diff] [blame] | 150 | static_assertions::assert_impl_all!(crate::SomeClass:Copy); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 151 | }; |
| 152 | const _: () = { |
Googler | 9e3ef6d | 2023-05-05 08:09:23 -0700 | [diff] [blame] | 153 | static_assertions::assert_not_impl_any!(crate::SomeClass:Drop); |
Michael VanBemmel | 7a4d4c0 | 2022-07-27 13:21:47 -0700 | [diff] [blame] | 154 | }; |